Skip to content

Conversation

roomote[bot]
Copy link

@roomote roomote bot commented Oct 4, 2025

Description

This PR addresses Issue #8507 where AI models were forgetting to use the use_mcp_tool wrapper when calling MCP tools, instead trying to call them directly by their tool name.

Problem

Users reported that when using MCP tools (like GitHub MCP), the AI would output incorrect format:

<get_pull_request>
  <owner>username</owner>
  <repo>repository</repo>
  <pullNumber>123</pullNumber>
</get_pull_request>

Instead of the correct format:

<use_mcp_tool>
  <server_name>github</server_name>
  <tool_name>get_pull_request</tool_name>
  <arguments>{...}</arguments>
</use_mcp_tool>

Solution

Enhanced the MCP tool prompts with:

  • Explicit warnings about NOT using direct tool name format
  • Clear examples showing incorrect (❌) vs correct (✅) usage
  • Strong emphasis on the requirement to always use use_mcp_tool wrapper
  • Reinforcement in both the tool description and MCP servers section

Changes

  • Updated src/core/prompts/tools/use-mcp-tool.ts to include clear format instructions
  • Updated src/core/prompts/sections/mcp-servers.ts to reinforce proper usage

Testing

  • ✅ All existing tests pass
  • ✅ Linting checks pass
  • ✅ Type checking passes

Related Issues

Fixes #8507

Review Confidence

Implementation review showed 95% confidence with PROCEED recommendation.


Important

Improves MCP tool prompt clarity in use_mcp_tool.ts and mcp-servers.ts to prevent format confusion by emphasizing correct usage with explicit warnings and examples.

  • Behavior:
    • Updated use_mcp_tool.ts to emphasize correct usage of use_mcp_tool wrapper with explicit warnings and examples.
    • Updated mcp-servers.ts to reinforce the requirement to use use_mcp_tool wrapper and provide clear examples of correct vs incorrect formats.
  • Testing:
    • All existing tests, linting, and type checks pass.

This description was created by Ellipsis for 260accb. You can customize this summary. It will automatically update as commits are pushed.

- Added explicit warnings about NOT using direct tool name format
- Added clear examples showing incorrect vs correct usage
- Emphasized the requirement to always use use_mcp_tool wrapper
- Updated MCP servers section to reinforce proper format

This should help prevent AI models from forgetting to wrap MCP tool
calls in the proper use_mcp_tool format, addressing issue #8507
@roomote roomote bot requested review from mrubens, cte and jr as code owners October 4, 2025 12:13
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working documentation Improvements or additions to documentation labels Oct 4, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 4, 2025
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-review: auditing my own prompt text like a mirror that files tickets.

**CRITICAL**: Never call MCP tools directly by their tool name. Always use the \`use_mcp_tool\` wrapper format:
- ❌ WRONG: \`<tool_name>...\</tool_name>\`
- ✅ CORRECT: \`<use_mcp_tool><server_name>...\</server_name><tool_name>...\</tool_name><arguments>...\</arguments>\</use_mcp_tool>\`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The inline example uses backslashes before closing XML tags (e.g., </server_name>). Within code spans, the backslash will be literal and may lead models to emit a backslash in their tool calls. Remove the backslashes so the example shows proper tags: </server_name>, </tool_name>, , </use_mcp_tool>. This also aligns with the examples in use-mcp-tool.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

[BUG] Forgetting <use_mcp_tool>
2 participants