-
Notifications
You must be signed in to change notification settings - Fork 268
"Export toJSONSchema doesn't exist in target module" from betaZodTool #919
Copy link
Copy link
Open
Description
i'm trying to use beta.messages.toolRunner with custom tools. This is an example:
const defaultTools: Record<string, ReturnType<typeof betaZodTool>> = {
execute_sql: betaZodTool({
name: "execute_sql",
description: "Execute validated SQL and return sample results (max 5 rows)",
inputSchema: z.object({
sql: z.string().describe("Validated SQL query to execute"),
}),
run: async (args) => {
return "";
},
}),
validate_sql_output_against_widget_data_schema: betaZodTool({
name: "validate_sql_output_against_widget_data_schema",
description: "Validate SQL against widget data schema",
inputSchema: z.object({
sql: z.string().describe("SQL query to validate"),
widgetType: z
.string()
.describe(
`Widget type to validate against. Must be one of: ${Object.keys(
widgetRegistry.getTypes(),
).join(", ")}`,
),
}),
run: async (args) => {
return "";
},
}),
};
const runner = await this.client.beta.messages.toolRunner({
model: this.model,
max_tokens: this.maxOutputTokens,
system: systemPrompt,
messages,
tools: Object.values(this.tools),
output_config: {
format: {
type: "json_schema",
schema: zodToJsonSchema(AIOutputFormat, {
name: "widget_generation_response_format",
}),
},
},
});
Then i get this error:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels