mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-09 03:17:58 +00:00
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) <noreply@anthropic.com>
This commit is contained in:
parent
193053110b
commit
551d02f510
3 changed files with 16 additions and 2 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue