From 6a7ef8f955c282f6a834129d5f9bc5017ed74bb5 Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Thu, 3 Jul 2025 22:50:51 -0700 Subject: [PATCH 1/4] Add getResourceLinks tool to return multiple resource references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Implement new tool that returns configurable number of resource links (1-10) - Each link includes URI, name, description, and MIME type from available resources - Minor formatting fixes for trailing commas and whitespace 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/everything/everything.ts | 57 ++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/src/everything/everything.ts b/src/everything/everything.ts index 2abce9a075..2d06c71336 100644 --- a/src/everything/everything.ts +++ b/src/everything/everything.ts @@ -86,6 +86,15 @@ const GetResourceReferenceSchema = z.object({ .describe("ID of the resource to reference (1-100)"), }); +const GetResourceLinksSchema = z.object({ + count: z + .number() + .min(1) + .max(10) + .default(3) + .describe("Number of resource links to return (1-10)"), +}); + enum ToolName { ECHO = "echo", ADD = "add", @@ -95,6 +104,7 @@ enum ToolName { GET_TINY_IMAGE = "getTinyImage", ANNOTATED_MESSAGE = "annotatedMessage", GET_RESOURCE_REFERENCE = "getResourceReference", + GET_RESOURCE_LINKS = "getResourceLinks", } enum PromptName { @@ -117,7 +127,7 @@ export const createServer = () => { logging: {}, completions: {}, }, - instructions + instructions, } ); @@ -164,13 +174,12 @@ export const createServer = () => { server.notification(message); }, 20000); - // Set up update interval for stderr messages stdErrUpdateInterval = setInterval(() => { const shortTimestamp = new Date().toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", - second: "2-digit" + second: "2-digit", }); server.notification({ method: "notifications/stderr", @@ -459,6 +468,12 @@ export const createServer = () => { "Returns a resource reference that can be used by MCP clients", inputSchema: zodToJsonSchema(GetResourceReferenceSchema) as ToolInput, }, + { + name: ToolName.GET_RESOURCE_LINKS, + description: + "Returns multiple resource links that reference different types of resources", + inputSchema: zodToJsonSchema(GetResourceLinksSchema) as ToolInput, + }, ]; return { tools }; @@ -648,6 +663,42 @@ export const createServer = () => { return { content }; } + if (name === ToolName.GET_RESOURCE_LINKS) { + const { count } = GetResourceLinksSchema.parse(args); + const content = []; + + // Add intro text + content.push({ + type: "text", + text: `Here are ${count} resource links to resources available in this server:`, + }); + + // Return resource links to actual resources from ALL_RESOURCES + const actualCount = Math.min(count, ALL_RESOURCES.length); + for (let i = 0; i < actualCount; i++) { + const resource = ALL_RESOURCES[i]; + content.push({ + type: "resource_link", + uri: resource.uri, + name: resource.name, + description: `Resource ${i + 1}: ${ + resource.mimeType === "text/plain" + ? "plaintext resource" + : "binary blob resource" + }`, + mimeType: resource.mimeType, + }); + } + + // Add summary text + content.push({ + type: "text", + text: `\nThese resource links reference actual resources available through the resources/read endpoint.`, + }); + + return { content }; + } + throw new Error(`Unknown tool: ${name}`); }); From 291ef214606b9ca9f9cd7c9f8d0d3608d71ebac0 Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Fri, 4 Jul 2025 09:52:49 -0700 Subject: [PATCH 2/4] clarify message --- src/everything/everything.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/everything/everything.ts b/src/everything/everything.ts index 2d06c71336..50264954fe 100644 --- a/src/everything/everything.ts +++ b/src/everything/everything.ts @@ -670,7 +670,7 @@ export const createServer = () => { // Add intro text content.push({ type: "text", - text: `Here are ${count} resource links to resources available in this server:`, + 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):`, }); // Return resource links to actual resources from ALL_RESOURCES From 0af52a9c22be97514e4bcdb110ab4f205129f0f1 Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Fri, 4 Jul 2025 10:39:07 -0700 Subject: [PATCH 3/4] remove summary --- src/everything/everything.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/everything/everything.ts b/src/everything/everything.ts index 50264954fe..227fd45562 100644 --- a/src/everything/everything.ts +++ b/src/everything/everything.ts @@ -690,12 +690,6 @@ export const createServer = () => { }); } - // Add summary text - content.push({ - type: "text", - text: `\nThese resource links reference actual resources available through the resources/read endpoint.`, - }); - return { content }; } From 8dde417d103e9061ecbb4c18c5c654d69f166de8 Mon Sep 17 00:00:00 2001 From: Ashwin Bhat Date: Fri, 4 Jul 2025 10:45:29 -0700 Subject: [PATCH 4/4] formatting --- src/everything/everything.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/everything/everything.ts b/src/everything/everything.ts index 227fd45562..541b83825e 100644 --- a/src/everything/everything.ts +++ b/src/everything/everything.ts @@ -127,7 +127,7 @@ export const createServer = () => { logging: {}, completions: {}, }, - instructions, + instructions } ); @@ -174,12 +174,13 @@ export const createServer = () => { server.notification(message); }, 20000); + // Set up update interval for stderr messages stdErrUpdateInterval = setInterval(() => { const shortTimestamp = new Date().toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", - second: "2-digit", + second: "2-digit" }); server.notification({ method: "notifications/stderr",