Skip to content

Commit ee12fb1

Browse files
cliffhallclaude
andcommitted
fix(everything): give gzip-file-as-resource's resource the resource icons
#3131 put a light/dark icon pair on every primitive, and the docs say every resources/list entry carries one, but the resource the gzip tool creates had none: the 2025-era session resource (its list entry and link) and the 2026-07-28 minted link. Both now carry RESOURCE_ICONS, and the icon tests cover the generated resource in both eras. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent cc60278 commit ee12fb1

5 files changed

Lines changed: 51 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@modelcontextprotocol/server-everything": patch
3+
---
4+
5+
Give the resource `gzip-file-as-resource` creates the light and dark resource icons, like every other resource. A 2025-era client now sees them on the session resource's `resources/list` entry and on the returned link; a 2026-07-28 client sees them on the minted resource link.

‎src/everything/__tests__/gzip-file-as-resource.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
textOf,
2323
type Session,
2424
} from "./harness.js";
25+
import { RESOURCE_ICONS } from "../server/icons.js";
2526

2627
const TEXT = "hello, gzip";
2728
const DATA_URI = `data:text/plain;base64,${Buffer.from(TEXT).toString("base64")}`;
@@ -100,6 +101,7 @@ describe("gzip-file-as-resource", () => {
100101
uri: "demo://resource/session/hello.txt.gz",
101102
name: "hello.txt.gz",
102103
mimeType: "application/gzip",
104+
icons: RESOURCE_ICONS,
103105
},
104106
]);
105107
const blob = await readBlob(s, "demo://resource/session/hello.txt.gz");
@@ -114,6 +116,7 @@ describe("gzip-file-as-resource", () => {
114116
uri: "demo://resource/session/listed.gz",
115117
name: "listed.gz",
116118
mimeType: "application/gzip",
119+
icons: RESOURCE_ICONS,
117120
});
118121
expect(
119122
ofMethod(s.notifications, "notifications/resources/list_changed").length,

‎src/everything/__tests__/icons.test.ts‎

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
* (server/icons.ts). These tests read what crosses the wire, in both
77
* protocol eras: `serverInfo` from `initialize` (2025-era) or
88
* `server/discover` (2026-07-28), and every entry of `tools/list`,
9-
* `prompts/list`, `resources/list` and `resources/templates/list`. Each
9+
* `prompts/list`, `resources/list` and `resources/templates/list`, and the
10+
* resource link a tool returns for a resource it creates (#5434). Each
1011
* must carry a "light" and a "dark" icon, and each icon must be a scalable
1112
* SVG `data:` URI that decodes to an SVG document.
1213
*/
@@ -17,6 +18,8 @@ import {
1718
connect,
1819
connectModern,
1920
connectRaw,
21+
contentOf,
22+
contentOfType,
2023
MODERN_CAPABILITIES,
2124
type RawSession,
2225
type Session,
@@ -41,6 +44,9 @@ afterEach(async () => {
4144

4245
const SVG_DATA_URI = "data:image/svg+xml;base64,";
4346

47+
/** A small file for gzip-file-as-resource; a data: URI needs no network. */
48+
const DATA_URI = `data:text/plain;base64,${Buffer.from("icons").toString("base64")}`;
49+
4450
/** Assert that `icons` is a themed pair of decodable SVG icons. */
4551
function expectThemedPair(icons: Icon[] | undefined): void {
4652
expect(icons).toBeDefined();
@@ -126,6 +132,35 @@ describe.each([
126132
expect(template.icons).toEqual(RESOURCE_TEMPLATE_ICONS);
127133
}
128134
});
135+
136+
// #5434: a resource a tool creates is a resource too: its link carries the
137+
// resource pair, whichever era's mechanism keeps it readable (a session
138+
// resource for a 2025-era client, a minted URI on 2026-07-28).
139+
it("puts the resource pair on the link gzip-file-as-resource returns", async () => {
140+
session = await open();
141+
const result = await session.client.callTool({
142+
name: "gzip-file-as-resource",
143+
arguments: { name: "icons.gz", data: DATA_URI },
144+
});
145+
const link = contentOfType(contentOf(result)[0], "resource_link");
146+
expect(link.icons).toEqual(RESOURCE_ICONS);
147+
});
148+
});
149+
150+
// #5434: on the 2025 era the tool also registers the file as a session
151+
// resource, which then appears in resources/list with the pair.
152+
it("puts the resource pair on the session resource gzip-file-as-resource lists", async () => {
153+
session = await connect({ capabilities: ALL_CAPABILITIES });
154+
await session.client.callTool({
155+
name: "gzip-file-as-resource",
156+
arguments: { name: "listed-icons.gz", data: DATA_URI },
157+
});
158+
const { resources } = await session.client.listResources();
159+
const generated = resources.find((r) => r.name === "listed-icons.gz");
160+
expect(generated?.icons).toEqual(RESOURCE_ICONS);
161+
for (const resource of resources) {
162+
expect(resource.icons).toEqual(RESOURCE_ICONS);
163+
}
129164
});
130165

131166
describe("icons on the raw 2026-07-28 wire", () => {

‎src/everything/resources/minted.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
ResourceTemplate,
2121
type ResourceLink,
2222
} from "@modelcontextprotocol/server";
23-
import { RESOURCE_TEMPLATE_ICONS } from "../server/icons.js";
23+
import { RESOURCE_ICONS, RESOURCE_TEMPLATE_ICONS } from "../server/icons.js";
2424

2525
/** How long a minted resource stays readable, in milliseconds. */
2626
export const MINTED_RESOURCE_TTL_MS = 10 * 60_000;
@@ -110,6 +110,8 @@ export function mintBlobResource(
110110
name,
111111
mimeType,
112112
description: `Created by a tool call; readable for ${MINTED_RESOURCE_TTL_MS / 60_000} minutes at this URI`,
113+
// #5434: a minted resource is a resource like any other (#3131).
114+
icons: RESOURCE_ICONS,
113115
};
114116
}
115117

‎src/everything/tools/gzip-file-as-resource.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
registerSessionResource,
3535
} from "../resources/session.js";
3636
import type { ServerContext } from "../server/context.js";
37-
import { TOOL_ICONS } from "../server/icons.js";
37+
import { RESOURCE_ICONS, TOOL_ICONS } from "../server/icons.js";
3838

3939
// Maximum input file size - 10 MB default
4040
const GZIP_MAX_FETCH_SIZE = Number(
@@ -230,7 +230,9 @@ export const registerGZipFileAsResourceTool = (
230230
const uri = getSessionResourceURI(name);
231231
const blob = compressedBuffer.toString("base64");
232232
const mimeType = "application/gzip";
233-
const resource = <Resource>{ uri, name, mimeType };
233+
// #5434: the session resource is listed like any other, so it carries
234+
// the resource icons (#3131) in resources/list and in its link.
235+
const resource = <Resource>{ uri, name, mimeType, icons: RESOURCE_ICONS };
234236

235237
// Return the resource or a resource link that can be used to access this resource later
236238
if (outputType === "resource") {

0 commit comments

Comments
 (0)