Repository navigation
Type coersion
#1381
Replies: 3 comments 4 replies
|
I'm about to start wrestling with this. I'm a little surprised because Pydantic running in non-strict mode is supposed to coerce strings to integeres fairly readily. Of course, YMMV in the "real world" and I need to go build some test frameworks to figure out what's going on myself. Will edit into this answer as I dig through it. |
3 replies
|
I think I am experiencing a similar problem: my LLM sets parameters as strings and when I call the tool I get formatting errors (for booleans as well for example). I do not experience this with the Python SDK implementation |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have a server with a tool that takes an
intargument. But many LLMs actually provide me with a string instead, like"5". Then I get errors likefastmcp.exceptions.ToolError: Input validation error: '5' is not of type 'integer'.As LLMs make minor type mistakes like that with some regularity, some automatic type coercion would be very helpful. Is there some easy way to handle such errors, and try to coerce the type before throwing exceptions?
All reactions