From 551d02f51056f00883557c7f3ae287764c51cdbf Mon Sep 17 00:00:00 2001 From: daniel-lxs Date: Fri, 27 Feb 2026 15:45:44 -0500 Subject: [PATCH] feat: pipe MCP annotations.title through to ClineAskUseMcpServer Add annotations field to McpTool type to capture MCP tool metadata (title, readOnlyHint, destructiveHint, etc). Pass annotations.title as toolTitle in the ClineAskUseMcpServer payload so downstream consumers (web UI) can display human-readable labels instead of generic "Used MCP tool" text. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/types/src/mcp.ts | 7 +++++++ packages/types/src/vscode-extension-host.ts | 1 + src/core/tools/UseMcpToolTool.ts | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/types/src/mcp.ts b/packages/types/src/mcp.ts index f1bfde325d..f4a013c43e 100644 --- a/packages/types/src/mcp.ts +++ b/packages/types/src/mcp.ts @@ -73,6 +73,13 @@ export type McpTool = { inputSchema?: object alwaysAllow?: boolean enabledForPrompt?: boolean + annotations?: { + title?: string + readOnlyHint?: boolean + destructiveHint?: boolean + idempotentHint?: boolean + openWorldHint?: boolean + } } export type McpResource = { diff --git a/packages/types/src/vscode-extension-host.ts b/packages/types/src/vscode-extension-host.ts index ab06f0dabb..e2097a27ae 100644 --- a/packages/types/src/vscode-extension-host.ts +++ b/packages/types/src/vscode-extension-host.ts @@ -845,6 +845,7 @@ export interface ClineAskUseMcpServer { serverName: string type: "use_mcp_tool" | "access_mcp_resource" toolName?: string + toolTitle?: string arguments?: string uri?: string response?: string diff --git a/src/core/tools/UseMcpToolTool.ts b/src/core/tools/UseMcpToolTool.ts index 7cbc09bfd7..c63fff1d24 100644 --- a/src/core/tools/UseMcpToolTool.ts +++ b/src/core/tools/UseMcpToolTool.ts @@ -56,6 +56,7 @@ export class UseMcpToolTool extends BaseTool<"use_mcp_tool"> { type: "use_mcp_tool", serverName, toolName: resolvedToolName, + toolTitle: toolValidation.resolvedToolTitle, arguments: params.arguments ? JSON.stringify(params.arguments) : undefined, } satisfies ClineAskUseMcpServer) @@ -142,7 +143,7 @@ export class UseMcpToolTool extends BaseTool<"use_mcp_tool"> { serverName: string, toolName: string, pushToolResult: (content: string) => void, - ): Promise<{ isValid: boolean; availableTools?: string[]; resolvedToolName?: string }> { + ): Promise<{ isValid: boolean; availableTools?: string[]; resolvedToolName?: string; resolvedToolTitle?: string }> { try { // Get the MCP hub to access server information const provider = task.providerRef.deref() @@ -238,7 +239,12 @@ export class UseMcpToolTool extends BaseTool<"use_mcp_tool"> { } // Tool exists and is enabled - return the original tool name for use with the MCP server - return { isValid: true, availableTools: server.tools.map((t) => t.name), resolvedToolName: tool.name } + return { + isValid: true, + availableTools: server.tools.map((t) => t.name), + resolvedToolName: tool.name, + resolvedToolTitle: tool.annotations?.title, + } } catch (error) { // If there's an error during validation, log it but don't block the tool execution // The actual tool call might still fail with a proper error