goose icon indicating copy to clipboard operation
goose copied to clipboard

fix: Add schema-aware numeric coercion for MCP tool arguments

Open tlongwell-block opened this issue 1 month ago • 0 comments

Some LLMs quote numeric arguments when calling MCP tools (e.g., sending "42" instead of 42), which can cause tool execution failures. This change adds schema-aware coercion that automatically converts string representations of numbers to their proper numeric types, but only when the tool's schema explicitly indicates a parameter should be numeric. The implementation is conservative - if no schema is available, no coercion is performed to avoid accidentally modifying strings that should remain as strings.

tlongwell-block avatar Oct 30 '25 14:10 tlongwell-block