fix(agent): parse MiniMax tool call formats for execution#1131
fix(agent): parse MiniMax tool call formats for execution#1131chumyin merged 5 commits intozeroclaw-labs:mainfrom
Conversation
|
Thanks for contributing to ZeroClaw. For faster review, please ensure:
See |
|
Status update: this PR is currently blocked by merge conflicts against Please rebase/update the branch on top of the latest We are conducting automation testing, and this issue or PR is actually being handled automatically by ZeroClaw. If anything goes wrong or you have any questions, please contact @chumyin directly for better assistance. |
Add parsers for two additional tool call formats that MiniMax LLM uses:
- XML attribute style: <minimax:toolcall><invoke name="shell"><parameter name="command">ls</parameter></invoke></minimax:toolcall>
- Perl/hash-ref style: {tool => "shell", args => { --command "ls" }}
Previously these were sent as plain text to Telegram channel instead of
being executed as tool calls.
Also fixes build warnings:
- Add #[allow(unused_imports)] to cost/mod.rs and onboard/mod.rs re-exports
- Change channels::handle_command visibility to pub(crate)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add parser for <FunctionCall> style that MiniMax also uses: <FunctionCall> file_read <code>path>/Users/.../file.md</code> </FunctionCall> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The previous regex couldn't handle nested braces in:
{tool => "shell", args => { --command "ls" }}
Now uses multi-stage parsing: find TOOL_CALL block, extract
tool name, then extract args block.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive tool name alias mapping: - fileread -> file_read - filewrite -> file_write - memoryrecall -> memory_recall - bash/sh/cmd -> shell - etc. Apply to all new parsers (XML attribute, Perl, FunctionCall). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The format ends with }} before /TOOL_CALL, not a single }. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1bb593d to
16985ac
Compare
16985ac to
779de19
Compare
|
Thanks for the contribution. I rebased this PR onto the latest We are currently conducting ZeroClaw automated testing. This is an automated comment from ZeroClaw. If you have any questions, please contact @chumyin. |
Summary
Describe this PR in 2-5 bullets:
src/agent/loop_.rsto handle XML attribute style (<invoke name="shell"><parameter name="command">ls</parameter></invoke>) and Perl/hash-ref style ({tool => "shell", args => { --command "ls" }})Label Snapshot (required)
risk: low|medium|high): mediumsize: XS|S|M|L|XL, auto-managed/read-only): Score|agent|channel|config|cron|daemon|doctor|gateway|health|heartbeat|integration|memory|observability|onboard|provider|runtime|security|service|skillforge|skills|tool|tunnel|docs|dependencies|ci|tests|scripts|dev, comma-separated): agent, tool<module>: <component>, for examplechannel: telegram,provider: kimi,tool: shell): agent: loop, tool: parsingtrusted contributor|experienced contributor|principal contributor|distinguished contributor, auto-managed/read-only; author merged PRs >=5/10/20/50): N/A (first PR)Change Metadata
bug|feature|refactor|docs|security|chore): bugruntime|provider|channel|memory|security|ci|docs|multi): agentLinked Issue
Supersede Attribution (required when
Supersedes #is used)#<pr> by @<author>, one per line): N/ACo-authored-bytrailers added for materially incorporated contributors? (Yes/No): N/ANo, explain why (for example: inspiration-only, no direct code/design carry-over): N/A\n): (Pass/Fail): N/AValidation Evidence (required)
Commands and result summary:
cargo build --releasepasses with no warningscargo testhas pre-existing compilation errors unrelated to these changes (rand::RngExt trait issue in test code)Security Impact (required)
Yes/No): NoYes/No): NoYes/No): NoYes/No): NoYes, describe risk and mitigation: N/APrivacy and Data Hygiene (required)
pass|needs-follow-up): passCompatibility / Migration
Yes/No): YesYes/No): NoYes/No): NoHuman Verification (required)
What was personally validated beyond CI:
shellandfile_readtoolsSide Effects / Blast Radius (required)
Agent Collaboration Notes (recommended)
AGENTS.md+CONTRIBUTING.md): YesRollback Plan (required)
git revert HEADorgit checkout main -- src/agent/loop_.rsRisks and Mitigations
List real risks in this PR (or write
None).