-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Runtime Type Validation for Tool Results #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dsp-ant
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the improvement! This is quite sensible.
ashwin-ant
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Left one small comment
client/src/components/ToolsTab.tsx
Outdated
| </pre> | ||
| <h4 className="font-semibold mb-2">Errors:</h4> | ||
| {parsedResult.error.errors.map((error) => ( | ||
| <pre className="bg-gray-50 dark:bg-gray-800 dark:text-gray-100 p-4 rounded text-sm overflow-auto max-h-64"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think this might need a key prop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ashwin-ant Perfect! I've applied your suggestion.
Co-authored-by: ashwin-ant <[email protected]>
6057831
Fixes #80
Problem
The inspector crashes when tool handlers return malformed responses. Specifically, when following the weather example from the docs, the inspector throws
TypeError: f.content.map is not a functionbecause the response structure doesn't match expectations.Solution
Changes
safeParse()to validate without throwingTesting