Skip to content

Conversation

@pdecat
Copy link
Contributor

@pdecat pdecat commented Jan 12, 2026

Related GitHub Issue

Closes: #10642

Roo Code Task Context (Optional)

Description

This PR fixes an MCP tool name normalization bug where models (especially Claude) convert hyphens to underscores in tool names when using native tool calling. This caused MCP tools with hyphens in their names (e.g., atlassian-jira_search) to fail because the tool name couldn't be matched after the model mangled it.

Test Procedure

New unit tests are added, and I installed it locally with pnpm install:vsix.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

N/A

Documentation Updates

Additional Notes

Get in Touch


Important

Fix MCP tool name handling by encoding hyphens as triple underscores to prevent conversion by models, ensuring correct parsing and matching.

  • Behavior:
    • Encode hyphens in MCP tool names as triple underscores in mcp-name.ts to prevent conversion to underscores by models.
    • Update NativeToolCallParser.ts to normalize tool names using normalizeMcpToolName() before parsing.
  • Functions:
    • Add normalizeMcpToolName() and decodeMcpName() in mcp-name.ts to handle encoding and decoding of hyphens.
  • Tests:
    • Add tests for normalizeMcpToolName() and decodeMcpName() in mcp-name.spec.ts.
    • Update existing tests to reflect new encoding behavior in mcp-name.spec.ts.

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

@pdecat pdecat requested review from cte, jr and mrubens as code owners January 12, 2026 20:13
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jan 12, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 12, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The implementation correctly addresses the MCP tool name normalization bug by encoding hyphens as triple underscores (___) during sanitization and decoding them back when parsing. All 58 tests pass.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jan 12, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 12, 2026
@mrubens mrubens merged commit a682908 into RooCodeInc:main Jan 12, 2026
24 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jan 12, 2026
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jan 12, 2026
@pdecat pdecat deleted the fix/encode_hyphens_in_mcp_tool_names branch January 12, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] MCP tool names with hyphens fail when using native tool calling

4 participants