Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Nov 11, 2025

Add native tool call support to RCC and OpenRouter, work in progress

Changes

  • Add tool_call chunk type to ApiStream
  • Add supportsNativeTools flag to ModelInfo
  • Create NativeToolCallParser for converting native tool calls to ToolUse format
  • Add tool_call handling in RooHandler to accumulate and yield tool calls
  • Add tool_call case in Task.ts stream processing
  • Add native tool support detection in RooHandler for dynamic models
  • Add comprehensive logging for debugging native tool flow

It also includes changes to make the conversation look like this when using native tool calls (without the parallel tool calls since Roo only supports one tool call at a time for now):
image

Testing

To test native tool call support:

  1. Open src/core/prompts/toolProtocolResolver.ts
  2. Change line 9 from:
    const CURRENT_TOOL_PROTOCOL: ToolProtocol = TOOL_PROTOCOL.XML
    to:
    const CURRENT_TOOL_PROTOCOL: ToolProtocol = TOOL_PROTOCOL.NATIVE
  3. Restart the extension or reload VS Code
  4. Test with a model that supports native tools (e.g., RCC or OpenRouter models)

Important

Adds native tool call support, refactoring tools to support both XML and native protocols, and updates system configurations and tests accordingly.

  • Behavior:
    • Adds native tool call support to RCC and OpenRouter.
    • Introduces tool_call chunk type in ApiStream and supportsNativeTools flag in ModelInfo.
    • Implements NativeToolCallParser for converting native tool calls to ToolUse format.
    • Updates RooHandler and Task.ts to handle tool_call chunks and stream processing.
    • Adds dynamic model support detection for native tools in RooHandler.
  • Tools:
    • Refactors tools into classes (e.g., ApplyDiffTool, AskFollowupQuestionTool) to support both XML and native protocols.
    • Removes old tool functions and replaces them with class-based implementations.
    • Updates tool tests to use new class-based structure.
  • Configuration:
    • Adds toolProtocol setting in package.json to switch between XML and native protocols.
    • Updates ToolProtocol handling in Task.ts and other files to support new configuration.
  • Misc:
    • Updates README.md and other documentation to reflect new tool call support.
    • Fixes various minor issues and refactors code for clarity and maintainability.

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

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 11, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Nov 11, 2025
@hannesrudolph hannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 11, 2025
@daniel-lxs daniel-lxs force-pushed the native-tool-support branch 2 times, most recently from e4b8841 to 11b0d4f Compare November 13, 2025 01:49
@daniel-lxs daniel-lxs marked this pull request as ready for review November 13, 2025 02:01
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request labels Nov 13, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 13, 2025

Rooviewer Clock   See task on Roo Cloud

Reviewed commit e8d52f1. This commit contains only a typo fix in the Indonesian localization file. No new issues found.

Previous reviews

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

allow_fallbacks: false,
},
}),
parallel_tool_calls: false, // Ensure only one tool call at a time
Copy link
Collaborator

Choose a reason for hiding this comment

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

Someday...

Copy link
Collaborator

@mrubens mrubens left a comment

Choose a reason for hiding this comment

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

I left a couple nitpicky comments but looks good to me overall! Feel free to merge once the conflicts are resolved and the worthwhile parts of my and the bots' comments are addressed 🚀

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 13, 2025
daniel-lxs and others added 2 commits November 13, 2025 12:37
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@daniel-lxs daniel-lxs merged commit 5e6e601 into main Nov 13, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 13, 2025
@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Nov 13, 2025
@daniel-lxs daniel-lxs deleted the native-tool-support branch November 13, 2025 17:48
@daniel-lxs daniel-lxs mentioned this pull request Nov 13, 2025
daniel-lxs added a commit that referenced this pull request Nov 15, 2025
- Add protocol detection in Task.ts to prevent merging parsed tool blocks with native tool blocks when using XML protocol
- Fix approval feedback flow in presentAssistantMessage.ts to add feedback directly without calling pushToolResult
- Resolves bug introduced in PR #9159 where tool blocks were duplicated, causing false 'already used' errors
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Nov 17, 2025