Commit graph

7 commits

Author SHA1 Message Date
Dallin Romney
ff89a88299
fix: coerce MCP tool args to match schema string types (#11852)
* fix: coerce MCP tool args to match schema string types

When tool call arguments are parsed via JSON.parse(), string-typed
parameters containing valid JSON (e.g. file content for .json files)
get deeply parsed into objects. Built-in tools handle this via
getStringArg(), but MCP tools with dynamic schemas had no equivalent
fix, causing write_file and similar tools to receive objects instead
of strings.

Add coerceArgsToSchema() that checks the tool's inputSchema and
re-stringifies any values that should be strings before passing
args to the MCP client.

Fixes #8510

* fix: narrow coercion to only objects/arrays, not numbers/booleans

Only re-stringify values that are objects or arrays (the actual
deep-parsing issue). Numbers and booleans passed to a string-typed
parameter are left as-is so they surface as type errors rather than
being silently converted.
2026-03-25 16:39:01 -07:00
Matt Cowger
e04c21f9c8 Address comments from @RomneyDa 2025-12-02 20:28:45 +00:00
Matt Cowger
a3810024c6 Add tests to match. 2025-12-02 20:15:10 +00:00
chezsmithy
7ffc6fb67d fix: 🎨 Prettier and Linting 2025-08-27 22:27:15 -07:00
chezsmithy
820822196b feat: ✨ Add range and head tools for file operations 2025-08-27 22:27:15 -07:00
Dallin Romney
1c5df69a3f
fix: grep escaped chars and empty results (#7323)
* fix: grep search escape and better truncation warnings

* fix: grep search tweaks

* fix: grep no results

* Fix: url test
2025-08-25 07:20:26 -07:00
Dallin Romney
1ee5c54151 feat: more thorough tool arg checking utils with tests 2025-07-21 15:31:52 +02:00