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