Skip to content

fix: preserve additional properties in tool output schemas - #373

Merged
punkpeye merged 1 commit into
punkpeye:mainfrom
yunfeizhu:fix/preserve-output-schema-properties
Sep 11, 2026
Merged

punkpeye merged 1 commit into
punkpeye:mainfrom
yunfeizhu:fix/preserve-output-schema-properties

Conversation

@yunfeizhu

Copy link
Copy Markdown
Contributor

Closes #372.

A tool returning a warehouse-to-stock map can pass server-side validation and still fail at the client after tools/list. strictJsonSchema replaces the record's additionalProperties: { type: "number" } with false, so the advertised schema rejects every warehouse key.

Preserve the converted output schema when listing tools. This keeps record, nested record, loose-object, and catchall results consistent with runtime validation. Explicitly strict output objects stay closed, and invalid output values still produce tool errors. Input schema handling is unchanged.

Add seven regression cases that discover the tool before calling it, and update the JSON Schema adapter's listing test and documentation to reflect the output contract.

Validation

  • Full test suite (vitest run): 785 passed.
  • OpenAPI benchmark and live tests (OPENAPI_NETWORK=1 vitest run src/openapi/fromOpenAPI.benchmark.test.ts src/openapi/fromOpenAPI.live.test.ts): 15 passed.
  • Prettier, ESLint, TypeScript, ESM/CJS build, and JSR publish dry run passed.
  • The four permissive-output regression cases fail on the unchanged base; all seven new cases pass with the fix.
  • Ran the HTTP reproduction in Record output schemas reject valid tool results after tools/list #372 against both the unchanged base and the fix. The original fails after discovery; the fix returns the same inventory successfully before and after discovery.

Keep advertised output schemas consistent with runtime validation so record
and catchall results remain valid after tool discovery.

Fixes punkpeye#372
@punkpeye
punkpeye merged commit 6872cf0 into punkpeye:main Sep 11, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 4.20.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Record output schemas reject valid tool results after tools/list

2 participants