Commit 9f9c65f
committed
fix: parse JSON-string MCP tool arguments before type check
Some LLMs (DeepSeek V4 Pro, others) emit MCP tool call arguments as
JSON-encoded strings (e.g. '{"headless": true}') rather than as
native objects. This causes validateParams() to reject valid MCP
tool calls with 'Invalid JSON argument' errors.
The fix adds a JSON.parse() guard before the existing type check,
falling through silently if parsing fails. The existing code path
then handles it as before (either accepts the object or rejects
malformed input).
This matches the fix applied to Roo Code v3.54.0 which was field-
tested across multiple MCP providers (playwright-stealth etc).1 parent 45b239c commit 9f9c65f
1 file changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
| |||
0 commit comments