Skip to content

fix: parse plugin tool args with Zod schema before execute - #49289

Closed
CodeAlex52 wants to merge 1 commit into
anomalyco:devfrom
CodeAlex52:plugin-zod-parse
Closed

CodeAlex52 wants to merge 1 commit into
anomalyco:devfrom
CodeAlex52:plugin-zod-parse

Conversation

@CodeAlex52

Copy link
Copy Markdown

Fixes #49279.

fromPlugin() built the Zod object for the JSON schema but handed raw LLM args to def.execute(), so .default() never applied and constraints like .min() never rejected. Now it safe-parses with the existing zodParams first (legacy JSON-schema tools unchanged) and raises Tool.InvalidArgumentsError on violation, matching Tool.define() behavior.

Verified: new regression test in test/tool/registry.test.ts covers the issue repro (defaults filled, min violation rejected, mutation-checked against unfixed code). Full registry suite: 16 pass locally except one pre-existing flaky timeout on 'does not expose execute unless code mode is enabled', which also times out on pristine dev. tool-define suite: 5 pass. bun typecheck clean.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Sep 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions

Copy link
Copy Markdown
Contributor

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

Potential Related PR Found

PR #43460: fix(core): decode plugin tool input with the schema's own instance

This PR is potentially related because it also addresses plugin tool input handling with schema validation. Both PRs deal with ensuring plugin tool arguments are properly validated against their schemas before execution. Your PR (49289) extends this by specifically handling Zod schema parsing with default values and constraint validation (like .min()), whereas #43460 addressed decoding with the schema's own instance.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Sep 16, 2026
@github-actions github-actions Bot closed this Sep 16, 2026
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.

Plugin tool args skip Zod parsing: defaults dropped, constraints unenforced

1 participant