Study FAQ
How do I design a narrow input contract for a Claude client tool?
Also asked as 2
- What should the name, description and JSON schema of a Claude tool communicate?
- How should I constrain the inputs of a client tool Claude can call?
Answer
Give each Claude client tool one coherent business action, a descriptive name, and a JSON Schema input_schema for its inputs. Use the description to say when to use it, when to choose another action, what units or formats it expects, and what its result represents. Check authorization and business validity in the executor before allowing an effect.
For example, get_customer_order can require a single order ID and return a bounded order summary. Keep unrelated search, update and administrative actions separate. Keep an operation that must succeed atomically behind one interface so implementation details do not become partially completed agent steps. Choose required fields, constrained enumerations and specific property descriptions where they help distinguish valid requests.
When the Claude API deployment supports strict tool use, strict: true on a compatible tool definition constrains emitted arguments to the supported schema. Check model, provider and schema restrictions. String enum or const values can vary in case. Validate exact spelling where case matters. Shape validation leaves questions such as whether the current caller may see the order or whether a requested amount exceeds a business limit to the executor.
Claude API tool use · Strict tool use · Structured output schema limits · Writing effective tools for agents
Full explanation
Designing Claude Tool Interfaces and Execution Contracts
Study guide · CCAR-F
Read the full explanation