Skip to content

Add claude_tool_bridge plugin - #613

Open
spcdatapro wants to merge 1 commit into
agent0ai:mainfrom
spcdatapro:add-claude-tool-bridge
Open

spcdatapro wants to merge 1 commit into
agent0ai:mainfrom
spcdatapro:add-claude-tool-bridge

Conversation

@spcdatapro

Copy link
Copy Markdown

Add claude_tool_bridge

Claude Tool Bridge makes Claude 5 models (for example claude-sonnet-5-5) work in Agent Zero's chat mode.
Agent Zero talks to Anthropic in chat mode, without native tools, so a model must write each call as
{"tool_name": ..., "tool_args": {...}}. Some Claude models keep writing their native syntax instead
(<invoke name="..."><parameter name="...">...</parameter></invoke>); Agent Zero treats those replies as unusable and
stops the agent after repeated ones. In a replay of 20 real prompts, claude-sonnet-5-5 produced an unusable reply in
45-90 % of the turns depending on its thinking settings, almost always a correct call in the wrong syntax.

  • Translates the first complete <invoke> of a reply into a JSON tool request before _context_doctor sees it; prose
    written before the call becomes thoughts.

  • Types arguments from the tool schema, then from Agent Zero's own usage examples; strings that look like JSON stay strings.

  • Understands tool:method names, MCP tools, antml: prefixes, <function_calls> wrappers and thoughts / headline /
    tool_args written as parameters.

  • Optionally stops the model stream at the first translatable </invoke> (early_stop, on by default).

  • Leaves a reply untouched when it already holds a JSON call, when the <invoke> is quoted (code fence or mid-line),
    when the tool is unknown or a required argument is missing, or when the chat model is not configured
    (providers: [anthropic], model_patterns: ["claude-*"] by default).

  • Plugin repository: https://github.com/spcdatapro/claude-tool-bridge

  • License: MIT (LICENSE at the repository root)

  • plugin.yaml name (claude_tool_bridge) matches the folder name in this PR

Checks

  • Ran scripts/validate_plugin_submission.py locally on this branch, with the current generated-index release
    index.json in place for the duplicate checks: passed.
  • The PR adds exactly one file: plugins/claude_tool_bridge/index.yaml.
  • Tested on Agent Zero v2.13: 47 unit tests; an offline replay of 120 recorded model outputs (29 of 36 unusable
    Sonnet 5.5 replies rescued, no change to the 84 usable ones); a live replay of the same 20 prompts with the plugin
    (claude-sonnet-5-5: 18/20 to 1/20 unusable replies in one configuration and 9/20 to 1/20 in another;
    claude-opus-5-5 control unchanged at 0/20); and a multi-step task in a real instance.
  • Overlap: the community context_doctor plugin repairs malformed JSON tool calls; this plugin handles replies that
    use Claude's XML call syntax instead of JSON, and defers to JSON whenever the reply holds a usable call.

Safety notes for reviewers

  • No network calls, no subprocesses, no eval/exec, no third-party dependencies (standard library and the framework only).
  • It only rewrites the text of the model reply in memory (message_loop_result) and wraps the response callback of the
    current model call (call_chat_model_turn). Nothing is written to disk and no API handlers are added.
  • A translated call goes through the framework's normal path afterwards (history, _context_doctor, tool policy and
    tool execution). If anything in the plugin fails, the reply is left untouched.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant