mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-01 13:13:33 +00:00
* fix(llm): coerce stringified JSON arrays/objects in tool argument validation When LLMs serialize array or object tool parameters as JSON strings (e.g. tags: '["test","debug"]' instead of tags: ["test","debug"]), validateToolArguments now attempts JSON.parse coercion before rejecting the value. This mirrors the existing numeric string coercion path and fixes MCP tool calls from providers like MiMo, Ollama, and others that stringify complex parameters. Fixes #96916 * fix(llm): bound JSON.parse size for schema-gated array/object coercion Add MAX_JSON_COERCE_LENGTH (64KB) guard before JSON.parse in the array and object coercion branches. Oversized stringified arguments are left for normal validation to reject rather than synchronously parsed. Addresses Codex review finding: unbounded JSON.parse on model-controlled tool arguments could block the event loop or spike memory.