Design Claude tools with narrow inputs and truthful error results
Define tool schemas and access boundaries, return the matching result and test refusal, timeout and continuation paths.
In brief
Claude tool use connects model proposals with actions implemented by your application or supported service. The tool definition should describe the job precisely, while your application enforces who may use it and on what resource.
Explicit error handling prevents a missing lookup from turning into an invented answer.
Choose an inspectable tool
A function reading an authorized document section is easier to validate than an arbitrary command executor. Define the identifier and allowed operation and keep secrets outside the arguments. Read the current tool format instead of copying a different provider’s request shape.
Return failure accurately
If the file is missing or access denied, report that state rather than an empty document presented as a successful read. Do not let the model infer that it has verified a fact when the tool returned no evidence. Keep error detail useful without exposing credentials or private paths.
Test the continuation
Use harmless fixtures for invalid input and a timeout. Check that tool loops stop and consequential actions are not repeated blindly. Keep user authorization and permissions in force even if a later model message asks for broader access.
Before you act
Client and server tool mechanisms differ, and capabilities depend on the actual service. A schema is not an access-control policy.
What to do next
- Use the current Claude tool mechanism and define narrow inputs.
- Validate authorization and arguments before a client tool executes.
- Return the real result or error in the documented matching format, with bounded continuation.