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
4245const 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. */
4551function 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
131166describe ( "icons on the raw 2026-07-28 wire" , ( ) => {
0 commit comments