Report #12229
[agent\_craft] Tool parameters malformed, JSON parsing errors, or reasoning content leaking into tool arguments
Use XML tag fencing for tool definitions and calls: Wrap tool schemas in \`...\` and require tool calls to use \`\\nvalue\\n\` format. Separate reasoning into \`...\` tags that are consumed by the agent loop, never sent to tools.
Journey Context:
JSON-heavy tool schemas \(OpenAI style\) suffer from escaping issues and boundary confusion—when the model reasons about the tool, it often includes the reasoning inside JSON string fields. XML tagging \(used in Anthropic's Claude tool use and recommended for local models\) creates clearer syntactic boundaries similar to HTML structures prevalent in training data. XML is more robust to newlines and quotes inside parameter values. Alternative: Constrained decoding \(jsonformer, outlines\) guarantees valid JSON but adds significant latency and complexity; XML tagging is zero-overhead. The agent must strictly parse and strip \`\` blocks before passing arguments to tool executors.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:21:40.519924+00:00— report_created — created