A useful but little-known Claude API feature
🔒 Tool arguments occasionally not matching the schema? Fix it structurally, not with more validation code.
Claude's Strict Tool Use guarantees that tool calls always exactly match the defined schema when you add strict: true. No more missing required fields, type mismatches, or unexpected extras.
📌 Title: Strict Tool Use
🔗 URL:
🧩 Overview
When models call tools, arguments occasionally deviate from the schema: missing required fields, wrong types, extra properties. Enabling Strict Tool Use constrains the model's output to strictly conform to the tool's JSON schema. Invalid arguments become structurally impossible, letting you dramatically simplify your validation code.
🛠 How to use it
Add strict: true at the top level of your tool definition. Your schema does have to stay within the supported JSON Schema subset, and objects must set `additionalProperties: false` (constraints like `minimum` and `maxLength` aren't supported and return a 400). Once enabled, the model generates only schema-compliant arguments. You can drop or reduce type and required field validation code, simplifying error handling on the tool execution side.
🏗 Building it into production
・Agent tool infrastructure: add strict: true to all tools and eliminate runtime errors from bad arguments. Debugging time drops significantly.
・External API integrations: when tool arguments are used directly as external API request bodies, schema compliance guarantees safe passthrough.
・Multi-step pipelines: ensure type-safe data flow when using tools for data handoffs between steps.
・Validation cost reduction: remove or simplify argument validation logic, lowering code maintenance burden.
💡 Use cases
🤖 Tool argument quality assurance for agents
🔌 Safe argument passthrough to external APIs
🔗 Type-safe data handoffs between pipeline steps
🧹 Elimination of validation boilerplate
⚠️ Watch out
Strict mode constrains output with a grammar compiled from your schema, so the first request using a given schema pays extra compilation latency (compiled grammars are cached for 24 hours after last use). There are explicit complexity limits: 20 strict tools, 24 optional parameters, and 16 union-typed parameters in total per request, and exceeding them returns a 400. It works best with straightforward schemas.
✨ Stop writing "hope the arguments are valid" code. One line, strict: true, and your tool calls become reliably correct.
#
Claude# #
LLM#