Giving Agents Safe, Reliable Hands
Great tools are small, clearly described, protected by strict JSON schemas so malformed arguments fail cleanly, and stamped with unique keys so retries never double-charge or double-send.
Networks drop packets and models occasionally format numbers as text. Strict schemas catch bad inputs before they crash APIs, while idempotency keys stop automatic retries from creating duplicate payments or emails.
Mental Model
Like a bank teller form with strict checkboxes (JSON Schema) and a unique receipt number (Idempotency) so submitting twice never withdraws twice.
What Breaks Without This
A brief Wi-Fi hiccup triggers 3 automatic retries on charge_invoice—charging the customer $150 instead of $50—or "$fifty" crashes the payment API.
Key Concepts
- Tool & MCP Design: Building focused, single-purpose tools with crisp descriptions and helpful error hints. Writing atomic, narrowly scoped tools with clear descriptions, strict parameter types, and actionable error messages.
- JSON & Schema Enforcement: Strict data templates guaranteeing the AI fills out tool inputs in the exact right format. Constrained decoding and runtime validation (e.g., Pydantic/Zod) guaranteeing valid tool arguments and UI payloads.
- Idempotency: Giving every tool request a unique ID so retries never pay twice or send duplicate emails. Designing tool calls with unique request keys so retries never duplicate database writes, emails, or payments.
Key Takeaway
Design small, focused tools guarded by strict JSON schemas and unique idempotency keys on every write.