Skip to content

Conversation

@daniel-lxs
Copy link
Member

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

Summary

Enable native tools by default for Anthropic provider and add telemetry tracking to errors, matching OpenRouter's approach.

Changes

1. packages/types/src/providers/anthropic.ts

Added defaultToolProtocol: "native" to all 13 Anthropic model definitions to enable native tools by default through the resolveToolProtocol() utility.

2. src/api/providers/anthropic.ts

  • Added imports for TOOL_PROTOCOL and resolveToolProtocol
  • Updated shouldIncludeNativeTools logic to use resolveToolProtocol(this.options, model.info) which respects the model's defaultToolProtocol
  • Added telemetry tracking using TelemetryService.instance.captureException() with ApiProviderError for all API calls (createMessage and completePrompt)

3. src/api/providers/__tests__/anthropic.spec.ts

  • Updated tests to remove explicit toolProtocol: "native" from handler options since native is now the default
  • All 29 tests pass

4. src/core/task/__tests__/Task.spec.ts

  • Added getMcpHub mock to provider in Subtask Rate Limiting tests to support native tools code path

How It Works

  • Native tools are now enabled by default for all Anthropic models via defaultToolProtocol: "native" in model definitions
  • Users can still override to XML by setting toolProtocol: "xml" in their profile settings
  • Error telemetry captures provider name ("Anthropic"), model ID, and method name for debugging

Testing

  • All 4625 tests pass
  • Manually verified native tool functionality

Important

Enable native tools by default for Anthropic models and add error telemetry tracking.

  • Behavior:
    • Enable native tools by default for all Anthropic models by setting defaultToolProtocol: "native" in anthropic.ts.
    • Add telemetry tracking for errors using TelemetryService.instance.captureException() in anthropic.ts.
  • Tests:
    • Update tests in anthropic.spec.ts to reflect native tools as default, removing explicit toolProtocol: "native".
    • Add mock for getMcpHub in Task.spec.ts to support native tools code path.
  • Misc:
    • Import TOOL_PROTOCOL and resolveToolProtocol in anthropic.ts to manage tool protocol logic.

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

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Dec 11, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 11, 2025

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

This PR cleanly enables native tools by default for Anthropic models and adds telemetry tracking, following the same patterns established in the OpenRouter provider. The additional changes for auto-approval pause functionality and tool result validation are well-implemented and tested.

Previous reviews

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

@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Dec 11, 2025
…cking

- Add defaultToolProtocol: 'native' to all Anthropic model definitions
- Use resolveToolProtocol() to properly resolve tool protocol based on model defaults
- Add telemetry tracking to createMessage and completePrompt errors using ApiProviderError
- Update tests to reflect native tools being enabled by default

This matches OpenRouter's approach of enabling native tools by default.
@daniel-lxs daniel-lxs force-pushed the feat/anthropic-native-tools-default branch from f5520f1 to 491d4dd Compare December 12, 2025 16:06
daniel-lxs added a commit that referenced this pull request Dec 12, 2025
Following the pattern established in PR #10021 for Anthropic, enable native tools
by default across multiple providers by adding `defaultToolProtocol: "native"`
to model definitions.

Providers updated:
- Gemini (10 models)
- Vertex (18 models)
- OpenAI Native (32 models)
- xAI (8 models)
- Mistral (9 models)
- Cerebras (5 models)
- Bedrock Claude (16 models)
- Groq (7 models)
- Fireworks (13 models)
- SambaNova (8 models)
- Doubao (3 models)

Total: ~129 models now default to native tool protocol.

Also updated tests to reflect native as default:
- openai-native.spec.ts
- xai.spec.ts
- mistral.spec.ts
daniel-lxs added a commit that referenced this pull request Dec 15, 2025
Following the pattern established in PR #10021 for Anthropic, enable native tools
by default across multiple providers by adding `defaultToolProtocol: "native"`
to model definitions.

Providers updated:
- Gemini (10 models)
- Vertex (18 models)
- OpenAI Native (32 models)
- xAI (8 models)
- Mistral (9 models)
- Cerebras (5 models)
- Bedrock Claude (16 models)
- Groq (7 models)
- Fireworks (13 models)
- SambaNova (8 models)
- Doubao (3 models)

Total: ~129 models now default to native tool protocol.

Also updated tests to reflect native as default:
- openai-native.spec.ts
- xai.spec.ts
- mistral.spec.ts
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 16, 2025
@cte cte merged commit 6619d46 into main Dec 16, 2025
10 checks passed
@cte cte deleted the feat/anthropic-native-tools-default branch December 16, 2025 05:32
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 16, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Dec 16, 2025
@cte cte mentioned this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants