Skip to content

fix(sdk): strip input_examples from Anthropic tool definitions#2652

Merged
harbournick merged 2 commits intomainfrom
fix/strip-anthropic-input-examples
Mar 30, 2026
Merged

fix(sdk): strip input_examples from Anthropic tool definitions#2652
harbournick merged 2 commits intomainfrom
fix/strip-anthropic-input-examples

Conversation

@tupizz
Copy link
Copy Markdown
Contributor

@tupizz tupizz commented Mar 30, 2026

Summary

Anthropic validates input_examples against the tool's input_schema. The superdoc_format tool has examples with target: {kind: "block"} but the merged schema only exposes {kind: "selection"}. This causes Anthropic to reject the tool definitions with a validation error.

Strips input_examples from the Anthropic tool output in generate-intent-tools.mjs until the schema properly supports all target variants via oneOf.

Changes

  • packages/sdk/codegen/src/generate-intent-tools.mjs: Remove input_examples from toAnthropicTool() output

Test plan

  • bun test packages/sdk/codegen/src/__tests__/ — 38 passed, 0 failed
  • Verified tools.anthropic.json has 0 occurrences of input_examples
  • Other tool formats (OpenAI, catalog) unaffected

Anthropic validates input_examples against the tool's input_schema.
The superdoc_format tool has examples with target {kind:"block"} but
the merged schema only exposes {kind:"selection"}. This causes
Anthropic to reject the tool definitions with a validation error.

Strip input_examples from Anthropic output until the schema properly
supports all target variants via oneOf.
Moved the import statement for 'path' to the correct position and simplified the return structure of the toAnthropicTool function by directly returning the object instead of assigning it to a variable first.
@harbournick harbournick merged commit e1dc6d5 into main Mar 30, 2026
19 checks passed
@harbournick harbournick deleted the fix/strip-anthropic-input-examples branch March 30, 2026 23:47
@edoversb
Copy link
Copy Markdown
Contributor

Woot~!

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in superdoc-sdk v1.3.0-next.48

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Apr 2, 2026

🎉 This PR is included in superdoc-sdk v1.3.0

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants