diff --git a/src/core/prompts/sections/mcp-servers.ts b/src/core/prompts/sections/mcp-servers.ts index 643233ab6f..658c0a3573 100644 --- a/src/core/prompts/sections/mcp-servers.ts +++ b/src/core/prompts/sections/mcp-servers.ts @@ -58,7 +58,11 @@ The Model Context Protocol (MCP) enables communication between the system and MC # Connected MCP Servers -When a server is connected, you can use the server's tools via the \`use_mcp_tool\` tool, and access the server's resources via the \`access_mcp_resource\` tool. +When a server is connected, you MUST use the server's tools via the \`use_mcp_tool\` wrapper, and access the server's resources via the \`access_mcp_resource\` wrapper. + +**CRITICAL**: Never call MCP tools directly by their tool name. Always use the \`use_mcp_tool\` wrapper format: +- ❌ WRONG: \`...\\` +- ✅ CORRECT: \`...\...\...\\\` ${connectedServers}` diff --git a/src/core/prompts/tools/use-mcp-tool.ts b/src/core/prompts/tools/use-mcp-tool.ts index ac9ef5b075..6693ed691c 100644 --- a/src/core/prompts/tools/use-mcp-tool.ts +++ b/src/core/prompts/tools/use-mcp-tool.ts @@ -6,32 +6,58 @@ export function getUseMcpToolDescription(args: ToolArgs): string | undefined { } return `## use_mcp_tool Description: Request to use a tool provided by a connected MCP server. Each MCP server can provide multiple tools with different capabilities. Tools have defined input schemas that specify required and optional parameters. + +**IMPORTANT**: You MUST always use the \`use_mcp_tool\` wrapper format shown below. Do NOT call MCP tools directly by their tool name. + Parameters: - server_name: (required) The name of the MCP server providing the tool - tool_name: (required) The name of the tool to execute - arguments: (required) A JSON object containing the tool's input parameters, following the tool's input schema -Usage: + +Correct Usage Format: server name here tool name here { - "param1": "value1", - "param2": "value2" + "param1": "value1", + "param2": "value2" } -Example: Requesting to use an MCP tool +❌ INCORRECT - Do NOT use this format: + +username +repository +123 + + +✅ CORRECT - Always use this format: + +github +get_pull_request + +{ + "owner": "username", + "repo": "repository", + "pullNumber": 123 +} + + + +Example: Using a weather MCP tool weather-server get_forecast { - "city": "San Francisco", - "days": 5 + "city": "San Francisco", + "days": 5 } -` + + +Remember: ALWAYS wrap MCP tool calls in the \`use_mcp_tool\` format, never call them directly by their tool name.` }