Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Jan 11, 2026

Summary

Anthropic rejects third-party tools when using Claude Code OAuth tokens. This PR prefixes tool names with oc_ when sending requests to the API and strips the prefix from tool names in responses, allowing Roo Code tools to work with Claude Code OAuth authentication.

This is based on the approach suggested in #10570 - thank you to @anomalyco @fernando234234.

⚠️ Important Notice

This PR is blocked pending approval from Anthropic.

We are concerned that implementing this workaround could lead to widespread bans of users utilizing the Claude Code integration in Roo Code. Anthropic has recently taken action against third-party clients, and we want to ensure this change does not put our users at risk.

We will not merge this PR until we receive explicit confirmation from Anthropic that this approach is acceptable.

Changes

src/integrations/claude-code/streaming-client.ts

  • Added TOOL_NAME_PREFIX = "oc_" constant
  • Created exported helper functions prefixToolName() and stripToolNamePrefix() for use by other modules
  • Added internal helper functions prefixToolNames() and prefixToolNamesInMessages()
  • Modified createStreamingMessage() to:
    • Prefix all tool names in the tools array before sending to the API
    • Prefix tool_use blocks in conversation messages (for multi-turn conversations)
    • Strip the prefix from tool names when processing streaming responses (content_block_start events with tool_use)

src/integrations/claude-code/__tests__/streaming-client.spec.ts

  • Added unit tests for prefixToolName and stripToolNamePrefix functions
  • Added integration tests verifying tool name prefixing in API requests
  • Added integration test verifying prefix stripping in responses

Testing

All 23 tests in the streaming-client test suite pass, including the new tests for the tool name prefixing functionality.


Important

This PR prefixes tool names with oc_ in API requests and strips the prefix in responses to bypass Anthropic's OAuth validation, pending approval from Anthropic.

  • Behavior:
    • Prefixes tool names with oc_ in API requests and strips prefix in responses in createStreamingMessage() in streaming-client.ts.
    • Handles tool names in tool_use blocks and tool_choice.
  • Functions:
    • Adds prefixToolName(), stripToolNamePrefix(), prefixToolNames(), prefixToolNamesInMessages(), and prefixToolChoice() in streaming-client.ts.
  • Tests:
    • Adds unit tests for prefixing functions in streaming-client.spec.ts.
    • Adds integration tests for tool name prefixing and stripping in API requests and responses.

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

Anthropic rejects third-party tools when using Claude Code OAuth tokens.
This adds an 'oc_' prefix to tool names when sending to the API and
strips the prefix from responses, allowing Roo Code tools to work with
Claude Code OAuth authentication.
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jan 11, 2026
@roomote
Copy link
Contributor

roomote bot commented Jan 11, 2026

Oroocle Clock   See task on Roo Cloud

Re-review complete. Previously flagged item is resolved.

  • Prefix tool_choice when sending requests so forced tool selection matches prefixed tool names
Previous reviews

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

@hannesrudolph hannesrudolph marked this pull request as draft January 11, 2026 18:40
@hannesrudolph hannesrudolph moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Jan 11, 2026
Addresses review feedback: when tool_choice specifies a specific tool
(type: 'tool'), the name must also be prefixed to match the prefixed
tool names in the tools array.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR - Draft / In Progress size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: PR [Draft / In Progress]

Development

Successfully merging this pull request may close these issues.

2 participants