From 273e1165265e2227a615c698899795fa66438545 Mon Sep 17 00:00:00 2001 From: Tadeu Tupinamba Date: Mon, 30 Mar 2026 18:32:54 -0300 Subject: [PATCH 1/2] fix(sdk): strip input_examples from Anthropic tool definitions 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. --- packages/sdk/codegen/src/generate-intent-tools.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/sdk/codegen/src/generate-intent-tools.mjs b/packages/sdk/codegen/src/generate-intent-tools.mjs index cf88051474..33a1ad3808 100644 --- a/packages/sdk/codegen/src/generate-intent-tools.mjs +++ b/packages/sdk/codegen/src/generate-intent-tools.mjs @@ -500,9 +500,10 @@ function toAnthropicTool(entry) { description: entry.description, input_schema: entry.inputSchema, }; - if (entry.inputExamples?.length) { - tool.input_examples = entry.inputExamples; - } + // input_examples omitted: Anthropic validates examples against the merged + // input_schema, but some examples use target shapes (e.g. kind:"block") + // that the merged oneOf schema doesn't expose at the top level. + // Re-enable once the schema properly supports all target variants. return tool; } From c12fb718004f0e1453cef6523946271c4a15ec22 Mon Sep 17 00:00:00 2001 From: Tadeu Tupinamba Date: Mon, 30 Mar 2026 19:17:27 -0300 Subject: [PATCH 2/2] refactor(sdk): reorder imports and simplify Anthropic tool return 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. --- packages/sdk/codegen/src/generate-intent-tools.mjs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/sdk/codegen/src/generate-intent-tools.mjs b/packages/sdk/codegen/src/generate-intent-tools.mjs index 33a1ad3808..8fe3b45a00 100644 --- a/packages/sdk/codegen/src/generate-intent-tools.mjs +++ b/packages/sdk/codegen/src/generate-intent-tools.mjs @@ -1,5 +1,5 @@ -import path from 'node:path'; import { readFile } from 'node:fs/promises'; +import path from 'node:path'; import { loadContract, REPO_ROOT, stripBoundParams, writeGeneratedFile } from './shared.mjs'; const TOOLS_OUTPUT_DIR = path.join(REPO_ROOT, 'packages/sdk/tools'); @@ -495,16 +495,11 @@ function toOpenAiTool(entry) { } function toAnthropicTool(entry) { - const tool = { + return { name: entry.toolName, description: entry.description, input_schema: entry.inputSchema, }; - // input_examples omitted: Anthropic validates examples against the merged - // input_schema, but some examples use target shapes (e.g. kind:"block") - // that the merged oneOf schema doesn't expose at the top level. - // Re-enable once the schema properly supports all target variants. - return tool; } function toVercelTool(entry) {