Skip to content

fix: respect optional strict validation params#25

Open
IFAKA wants to merge 1 commit into
cloudflare:mainfrom
IFAKA:fix/strict-validation-optional
Open

fix: respect optional strict validation params#25
IFAKA wants to merge 1 commit into
cloudflare:mainfrom
IFAKA:fix/strict-validation-optional

Conversation

@IFAKA

@IFAKA IFAKA commented Jul 1, 2026

Copy link
Copy Markdown

Fixes #17

Summary

  • Preserve JSON Schema optional parameters during strict tool argument validation.
  • Pass the tool parameter required list into the Zod validation helper.
  • Mark non-required schema properties as optional in the generated Zod object.

Test Plan

  • npx esbuild src/utils.ts --bundle --platform=node --format=cjs --outfile=/tmp/ai-utils-utils.cjs plus a Node smoke test verifying optional params may be omitted and required params are still enforced.
  • npm run build after installing the package's declared Workers types version locally: npm install --no-save @cloudflare/workers-types@4.20240620.0.

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.

strictValidation triggers an "Invalid arguments for tool {X}" error when some params are optional

1 participant