From 778039c8794cd2f4abffb68546387fc1141a15f3 Mon Sep 17 00:00:00 2001 From: Niels Kaspers Date: Fri, 13 Mar 2026 09:12:42 +0200 Subject: [PATCH] feat(everything): add tool annotations to all 18 tools The server-everything reference server is the primary example developers use to learn MCP. Adding tool annotations brings it in line with server-filesystem, which already annotates all its tools. Annotations per tool: - Read-only tools (echo, get-env, get-sum, etc.): readOnlyHint: true - Toggle tools: readOnlyHint: false, destructiveHint: false, idempotentHint: false - gzip-file-as-resource: readOnlyHint: false, idempotentHint: true, openWorldHint: true - Sampling/elicitation tools: readOnlyHint: false, destructiveHint: false Fixes #3401 --- src/everything/tools/echo.ts | 1 + src/everything/tools/get-annotated-message.ts | 1 + src/everything/tools/get-env.ts | 1 + src/everything/tools/get-resource-links.ts | 1 + src/everything/tools/get-resource-reference.ts | 1 + src/everything/tools/get-roots-list.ts | 1 + src/everything/tools/get-structured-content.ts | 1 + src/everything/tools/get-sum.ts | 1 + src/everything/tools/get-tiny-image.ts | 1 + src/everything/tools/gzip-file-as-resource.ts | 1 + src/everything/tools/simulate-research-query.ts | 1 + src/everything/tools/toggle-simulated-logging.ts | 1 + src/everything/tools/toggle-subscriber-updates.ts | 1 + src/everything/tools/trigger-elicitation-request-async.ts | 1 + src/everything/tools/trigger-elicitation-request.ts | 1 + src/everything/tools/trigger-long-running-operation.ts | 1 + src/everything/tools/trigger-sampling-request-async.ts | 1 + src/everything/tools/trigger-sampling-request.ts | 1 + 18 files changed, 18 insertions(+) diff --git a/src/everything/tools/echo.ts b/src/everything/tools/echo.ts index 204a2fb49b..df24fcfac7 100644 --- a/src/everything/tools/echo.ts +++ b/src/everything/tools/echo.ts @@ -13,6 +13,7 @@ const config = { title: "Echo Tool", description: "Echoes back the input string", inputSchema: EchoSchema, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/get-annotated-message.ts b/src/everything/tools/get-annotated-message.ts index ead0660e8f..ba4da94c68 100644 --- a/src/everything/tools/get-annotated-message.ts +++ b/src/everything/tools/get-annotated-message.ts @@ -21,6 +21,7 @@ const config = { description: "Demonstrates how annotations can be used to provide metadata about content.", inputSchema: GetAnnotatedMessageSchema, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/get-env.ts b/src/everything/tools/get-env.ts index 0adbf5a14d..6e75f98f86 100644 --- a/src/everything/tools/get-env.ts +++ b/src/everything/tools/get-env.ts @@ -8,6 +8,7 @@ const config = { description: "Returns all environment variables, helpful for debugging MCP server configuration", inputSchema: {}, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/get-resource-links.ts b/src/everything/tools/get-resource-links.ts index b1fc627e20..767f6e71ab 100644 --- a/src/everything/tools/get-resource-links.ts +++ b/src/everything/tools/get-resource-links.ts @@ -25,6 +25,7 @@ const config = { description: "Returns up to ten resource links that reference different types of resources", inputSchema: GetResourceLinksSchema, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/get-resource-reference.ts b/src/everything/tools/get-resource-reference.ts index d3dc5d3ecb..0d0e1721b8 100644 --- a/src/everything/tools/get-resource-reference.ts +++ b/src/everything/tools/get-resource-reference.ts @@ -28,6 +28,7 @@ const config = { title: "Get Resource Reference Tool", description: "Returns a resource reference that can be used by MCP clients", inputSchema: GetResourceReferenceSchema, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/get-roots-list.ts b/src/everything/tools/get-roots-list.ts index 62363da26a..07602baace 100644 --- a/src/everything/tools/get-roots-list.ts +++ b/src/everything/tools/get-roots-list.ts @@ -9,6 +9,7 @@ const config = { description: "Lists the current MCP roots provided by the client. Demonstrates the roots protocol capability even though this server doesn't access files.", inputSchema: {}, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/get-structured-content.ts b/src/everything/tools/get-structured-content.ts index 83c98c0ab6..f85a5ade09 100644 --- a/src/everything/tools/get-structured-content.ts +++ b/src/everything/tools/get-structured-content.ts @@ -27,6 +27,7 @@ const config = { "Returns structured content along with an output schema for client data validation", inputSchema: GetStructuredContentInputSchema, outputSchema: GetStructuredContentOutputSchema, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/get-sum.ts b/src/everything/tools/get-sum.ts index 522043c88f..8c25e78cb5 100644 --- a/src/everything/tools/get-sum.ts +++ b/src/everything/tools/get-sum.ts @@ -14,6 +14,7 @@ const config = { title: "Get Sum Tool", description: "Returns the sum of two numbers", inputSchema: GetSumSchema, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/get-tiny-image.ts b/src/everything/tools/get-tiny-image.ts index 720707d0ce..3de892ea74 100644 --- a/src/everything/tools/get-tiny-image.ts +++ b/src/everything/tools/get-tiny-image.ts @@ -11,6 +11,7 @@ const config = { title: "Get Tiny Image Tool", description: "Returns a tiny MCP logo image.", inputSchema: {}, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/gzip-file-as-resource.ts b/src/everything/tools/gzip-file-as-resource.ts index 608fcf4a0d..8922a1410e 100644 --- a/src/everything/tools/gzip-file-as-resource.ts +++ b/src/everything/tools/gzip-file-as-resource.ts @@ -48,6 +48,7 @@ const config = { description: "Compresses a single file using gzip compression. Depending upon the selected output type, returns either the compressed data as a gzipped resource or a resource link, allowing it to be downloaded in a subsequent request during the current session.", inputSchema: GZipFileAsResourceSchema, + annotations: { readOnlyHint: false, idempotentHint: true, openWorldHint: true }, }; /** diff --git a/src/everything/tools/simulate-research-query.ts b/src/everything/tools/simulate-research-query.ts index 8b485ca2ba..883d45ba57 100644 --- a/src/everything/tools/simulate-research-query.ts +++ b/src/everything/tools/simulate-research-query.ts @@ -254,6 +254,7 @@ export const registerSimulateResearchQueryTool = (server: McpServer) => { "Demonstrates MCP task-based operations with progress through multiple stages. " + "If 'ambiguous' is true and client supports elicitation, sends an elicitation request for clarification.", inputSchema: SimulateResearchQuerySchema, + annotations: { readOnlyHint: true }, execution: { taskSupport: "required" }, }, { diff --git a/src/everything/tools/toggle-simulated-logging.ts b/src/everything/tools/toggle-simulated-logging.ts index 4941ed77d0..e71b4fc2ca 100644 --- a/src/everything/tools/toggle-simulated-logging.ts +++ b/src/everything/tools/toggle-simulated-logging.ts @@ -11,6 +11,7 @@ const config = { title: "Toggle Simulated Logging", description: "Toggles simulated, random-leveled logging on or off.", inputSchema: {}, + annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }, }; // Track enabled clients by session id diff --git a/src/everything/tools/toggle-subscriber-updates.ts b/src/everything/tools/toggle-subscriber-updates.ts index 03b949e232..9fb1e36044 100644 --- a/src/everything/tools/toggle-subscriber-updates.ts +++ b/src/everything/tools/toggle-subscriber-updates.ts @@ -11,6 +11,7 @@ const config = { title: "Toggle Subscriber Updates", description: "Toggles simulated resource subscription updates on or off.", inputSchema: {}, + annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }, }; // Track enabled clients by session id diff --git a/src/everything/tools/trigger-elicitation-request-async.ts b/src/everything/tools/trigger-elicitation-request-async.ts index 6cf6f3e581..6ecac21e8d 100644 --- a/src/everything/tools/trigger-elicitation-request-async.ts +++ b/src/everything/tools/trigger-elicitation-request-async.ts @@ -11,6 +11,7 @@ const config = { "Demonstrates bidirectional MCP tasks where the server sends an elicitation request and " + "the client handles user input asynchronously, allowing the server to poll for completion.", inputSchema: {}, + annotations: { readOnlyHint: false, destructiveHint: false }, }; // Poll interval in milliseconds diff --git a/src/everything/tools/trigger-elicitation-request.ts b/src/everything/tools/trigger-elicitation-request.ts index 4de7993e9a..8d9da7261e 100644 --- a/src/everything/tools/trigger-elicitation-request.ts +++ b/src/everything/tools/trigger-elicitation-request.ts @@ -10,6 +10,7 @@ const config = { title: "Trigger Elicitation Request Tool", description: "Trigger a Request from the Server for User Elicitation", inputSchema: {}, + annotations: { readOnlyHint: false, destructiveHint: false }, }; /** diff --git a/src/everything/tools/trigger-long-running-operation.ts b/src/everything/tools/trigger-long-running-operation.ts index 8af45ce60b..90776350e5 100644 --- a/src/everything/tools/trigger-long-running-operation.ts +++ b/src/everything/tools/trigger-long-running-operation.ts @@ -17,6 +17,7 @@ const config = { title: "Trigger Long Running Operation Tool", description: "Demonstrates a long running operation with progress updates.", inputSchema: TriggerLongRunningOperationSchema, + annotations: { readOnlyHint: true }, }; /** diff --git a/src/everything/tools/trigger-sampling-request-async.ts b/src/everything/tools/trigger-sampling-request-async.ts index 2e9fad96bc..e7ce922afb 100644 --- a/src/everything/tools/trigger-sampling-request-async.ts +++ b/src/everything/tools/trigger-sampling-request-async.ts @@ -23,6 +23,7 @@ const config = { "Demonstrates bidirectional MCP tasks where the server sends a request and the client " + "executes it asynchronously, allowing the server to poll for progress and results.", inputSchema: TriggerSamplingRequestAsyncSchema, + annotations: { readOnlyHint: false, destructiveHint: false }, }; // Poll interval in milliseconds diff --git a/src/everything/tools/trigger-sampling-request.ts b/src/everything/tools/trigger-sampling-request.ts index 5785f5210f..61aa231421 100644 --- a/src/everything/tools/trigger-sampling-request.ts +++ b/src/everything/tools/trigger-sampling-request.ts @@ -21,6 +21,7 @@ const config = { title: "Trigger Sampling Request Tool", description: "Trigger a Request from the Server for LLM Sampling", inputSchema: TriggerSamplingRequestSchema, + annotations: { readOnlyHint: false, destructiveHint: false }, }; /**