fix: preserve tool argument descriptions in schema conversion#22080
fix: preserve tool argument descriptions in schema conversion#22080bensantora wants to merge 2 commits intoanomalyco:devfrom
Conversation
Uses zodToJsonSchema instead of z.toJSONSchema to preserve .describe() metadata from zod schemas, matching the approach in server.ts
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found several potentially related PRs addressing similar issues with tool argument descriptions and schema conversion: Potential Duplicates/Related PRs:
These PRs appear to be addressing the same or very closely related issues with tool argument descriptions not being preserved during schema conversion. PR #14476 has the exact same title, suggesting this may be a re-opened or related issue. |
Issue for this PR
Closes #4357
Type of change
What does this PR do?
Uses zodToJsonSchema instead of z.toJSONSchema when converting tool parameter schemas to JSON Schema. This preserves the .describe() metadata from zod schemas, matching the approach already used in server.ts (line 307).
The issue was that z.toJSONSchema() doesn't extract .describe() metadata from schema properties, so tool argument descriptions weren't being passed to the LLM.
How did you verify your code works?
The fix follows the same pattern used in server.ts for converting tool schemas, ensuring consistency.
Checklist