Skip to content

Commit e1dc6d5

Browse files
authored
fix(sdk): strip input_examples from Anthropic tool definitions (#2652)
* 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. * 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.
1 parent a8859df commit e1dc6d5

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

packages/sdk/codegen/src/generate-intent-tools.mjs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import path from 'node:path';
21
import { readFile } from 'node:fs/promises';
2+
import path from 'node:path';
33
import { loadContract, REPO_ROOT, stripBoundParams, writeGeneratedFile } from './shared.mjs';
44

55
const TOOLS_OUTPUT_DIR = path.join(REPO_ROOT, 'packages/sdk/tools');
@@ -495,15 +495,11 @@ function toOpenAiTool(entry) {
495495
}
496496

497497
function toAnthropicTool(entry) {
498-
const tool = {
498+
return {
499499
name: entry.toolName,
500500
description: entry.description,
501501
input_schema: entry.inputSchema,
502502
};
503-
if (entry.inputExamples?.length) {
504-
tool.input_examples = entry.inputExamples;
505-
}
506-
return tool;
507503
}
508504

509505
function toVercelTool(entry) {

0 commit comments

Comments
 (0)