Skip to content

fix(custom-tools): preserve arg descriptions and enforce validation#19916

Open
khimaros wants to merge 1 commit intoanomalyco:devfrom
khimaros:tool-descriptions
Open

fix(custom-tools): preserve arg descriptions and enforce validation#19916
khimaros wants to merge 1 commit intoanomalyco:devfrom
khimaros:tool-descriptions

Conversation

@khimaros
Copy link
Copy Markdown

rehydrate cross-instance zod metadata so .describe() survives JSON schema export, and validate tool input at runtime before execute.

based on #15957 by @ashleytowner but rebased against latest dev branch.

Issue for this PR

Closes #4357

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

resolve an issue where custom tools created by plugins do not have their parameter descriptions passed through to the LLM.

How did you verify your code works?

i tested my custom plugin with it: https://github.com/khimaros/opencode-evolve and descriptions on params are now present.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found several related PRs:

Related PRs (not duplicates of 19916):

  1. fix(opencode): missing custom tool arg descriptions #15957 - fix(opencode): missing custom tool arg descriptions

  2. fix: preserve tool argument descriptions in schema conversion #14476 - fix: preserve tool argument descriptions in schema conversion

  3. fix(opencode): preserve custom tool arg descriptions in LLM prompts #13417 - fix(opencode): preserve custom tool arg descriptions in LLM prompts

    • Another earlier attempt to preserve custom tool argument descriptions.

Note: The current PR (#19916) appears to be a rebased version of #15957 against the latest dev branch. You should verify whether #15957 is still open or if it should be closed in favor of #19916.

rehydrate cross-instance zod metadata so .describe() survives JSON
schema export, and validate tool input at runtime before execute.
@khimaros khimaros force-pushed the tool-descriptions branch from dcc1bd7 to 22563bc Compare April 9, 2026 21:28
@khimaros
Copy link
Copy Markdown
Author

khimaros commented Apr 9, 2026

@rekram1-node this continues to be a major issue for custom tool which confuses non-SOTA models like qwen3.5 or gemma4. would be great to have someone look at this.

@ashleytowner
Copy link
Copy Markdown

thanks for keeping this up to date!

I wonder if you'd be willing to add a Co-authored-by line on the commit since it is based on my earlier commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tool argument descriptions lost in schema conversion

2 participants