@@ -86,6 +86,15 @@ const GetResourceReferenceSchema = z.object({
8686 . describe ( "ID of the resource to reference (1-100)" ) ,
8787} ) ;
8888
89+ const GetResourceLinksSchema = z . object ( {
90+ count : z
91+ . number ( )
92+ . min ( 1 )
93+ . max ( 10 )
94+ . default ( 3 )
95+ . describe ( "Number of resource links to return (1-10)" ) ,
96+ } ) ;
97+
8998enum ToolName {
9099 ECHO = "echo" ,
91100 ADD = "add" ,
@@ -95,6 +104,7 @@ enum ToolName {
95104 GET_TINY_IMAGE = "getTinyImage" ,
96105 ANNOTATED_MESSAGE = "annotatedMessage" ,
97106 GET_RESOURCE_REFERENCE = "getResourceReference" ,
107+ GET_RESOURCE_LINKS = "getResourceLinks" ,
98108}
99109
100110enum PromptName {
@@ -459,6 +469,12 @@ export const createServer = () => {
459469 "Returns a resource reference that can be used by MCP clients" ,
460470 inputSchema : zodToJsonSchema ( GetResourceReferenceSchema ) as ToolInput ,
461471 } ,
472+ {
473+ name : ToolName . GET_RESOURCE_LINKS ,
474+ description :
475+ "Returns multiple resource links that reference different types of resources" ,
476+ inputSchema : zodToJsonSchema ( GetResourceLinksSchema ) as ToolInput ,
477+ } ,
462478 ] ;
463479
464480 return { tools } ;
@@ -648,6 +664,36 @@ export const createServer = () => {
648664 return { content } ;
649665 }
650666
667+ if ( name === ToolName . GET_RESOURCE_LINKS ) {
668+ const { count } = GetResourceLinksSchema . parse ( args ) ;
669+ const content = [ ] ;
670+
671+ // Add intro text
672+ content . push ( {
673+ type : "text" ,
674+ text : `Here are ${ count } resource links to resources available in this server (see full output in tool response if your client does not support resource_link yet):` ,
675+ } ) ;
676+
677+ // Return resource links to actual resources from ALL_RESOURCES
678+ const actualCount = Math . min ( count , ALL_RESOURCES . length ) ;
679+ for ( let i = 0 ; i < actualCount ; i ++ ) {
680+ const resource = ALL_RESOURCES [ i ] ;
681+ content . push ( {
682+ type : "resource_link" ,
683+ uri : resource . uri ,
684+ name : resource . name ,
685+ description : `Resource ${ i + 1 } : ${
686+ resource . mimeType === "text/plain"
687+ ? "plaintext resource"
688+ : "binary blob resource"
689+ } `,
690+ mimeType : resource . mimeType ,
691+ } ) ;
692+ }
693+
694+ return { content } ;
695+ }
696+
651697 throw new Error ( `Unknown tool: ${ name } ` ) ;
652698 } ) ;
653699
0 commit comments