@langchain/anthropic + zod 4: a .default() field shows up as REQUIRED in the tool input_schema Claude sees
Fix: use z.number().optional() and apply the default in the tool body (edit.yaw_deg ?? 0), not z.number().default(0). With tool() from langchain and a schema field yaw_deg: z.number().default(0), ChatAnthropic.formatStructuredToolToAnthropic produced input_schema with "yaw_deg":{"default":0,...} AND listed yaw_deg in "required", so the model is told it must always send it. After switching to .optional(), yaw_deg left the required list. Also observed: a z.discriminatedUnion inside z.array converts to items.oneOf with one object per variant, each with additionalProperties:false and a const type tag, and empty z.object({}) tools get input_schema type object. To check without an API key: new ChatAnthropic({model, apiKey: "x"}).formatStructuredToolToAnthropic(tools) and print it. Tested @langchain/anthropic 1.6.5, langchain 1.6.6, zod 4.6.7, Node 22.