Home
cd ../playbooks
Developer ToolsAdvanced

Tool Interface Design for Agents

Design agent-facing tools as contracts an agent must infer entirely from the description alone — the consolidation principle over narrow overlapping tools, architectural reduction toward primitives, actionable error-recovery messages, and an 8-point audit checklist.

10 minutes
By muratcankoylanSource
#tool-design#mcp#agent-tooling#api-design#error-handling#claude-code

A human reads docs, understands conventions, and can ask a colleague when a tool call is unclear. An agent has to infer the entire contract from one description block in a single shot — every ambiguity in that block becomes a real failure mode no amount of prompt engineering downstream can fully fix.

Who it's for: developers building MCP servers or tool catalogs for AI agents, teams debugging why an agent keeps picking the wrong tool or generating malformed calls, anyone consolidating a sprawling tool catalog where agents pick wrong half the time, engineers designing error messages agents can actually recover from

Example

"Why does my agent keep calling the wrong tool?" → An audit against the consolidation principle (do list_users, list_events, and create_event overlap enough to merge into one schedule_event call?), a description rewritten to answer what/when/returns explicitly, error messages redesigned to tell the agent what to change before retrying instead of returning a bare 'failed', and an 8-point checklist run against every tool before it ships

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

Or install from your terminal:
npx ccplaybooks add tool-interface-design
# Tool Interface Design for Agents

Design every tool as a contract between a deterministic system and a non-deterministic agent. Unlike human-facing APIs, agent-facing tools must make the whole contract unambiguous through the description alone — an agent infers intent from a description block and generates calls that must match expected formats. Every ambiguity becomes a real failure mode no amount of prompt engineering can fully fix.

This is for the tool-interface layer specifically: writing tool descriptions agents can route on, designing schemas and response formats, naming conventions, actionable error-recovery messages, MCP server design, tool-set consolidation, and deciding when to add or remove an individual tool.

## Core Concepts

### Tools as Contracts

When a human calls an API, they read docs, understand conventions, and can ask a colleague when unsure. An agent has to infer the entire contract from a single description block, in one shot, with no chance to ask a clarifying question before making the call. Make the contract unambiguous by including format examples, expected patterns, and explicit constraints — omit nothing a caller needs to know.

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

Treats every agent-facing tool as a contract the agent must infer entirely from its description, in one shot, with no chance to ask a clarifying question the way a human developer reading API docs could. The core move is the consolidation principle: build single comprehensive tools instead of multiple narrow ones that overlap, because every tool in a collection competes for the agent's attention during selection and overlapping functionality creates genuine ambiguity, not just clutter — real production evidence shows collapsing a sprawling specialized tool set into fewer well-designed primitives measurably improves outcomes. It pushes that principle further with architectural reduction: giving an agent direct filesystem or command-execution access instead of custom wrapper tools, when the underlying capability is already well-documented and the model has the reasoning capability to use it directly.

Beyond consolidation, it covers writing descriptions that answer what/when/inputs/returns explicitly (since the description is the prompt that steers tool selection, not documentation on the side), designing error messages actionable enough for an agent to actually recover from, a consistent naming schema across a whole catalog, MCP-specific namespace-collision gotchas, and a concrete tool audit checklist — name, description, schema, return shape, recovery, overlap, consolidation decision, token impact — to run on every tool before it ships.


Quick Start

Step 1: Create a Project Folder

mkdir tool-design && cd tool-design

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ./

Step 3: Audit or Design a Tool Catalog

claude

Point Claude at an existing tool catalog or MCP server and ask it to audit each tool against the 8-point checklist, or describe a new set of tools you're planning and ask it to apply the consolidation principle before you build them.


Tips & Best Practices

  • Read every tool description as prompt engineering, because it is — it loads into context and steers behavior exactly like an instruction would.
  • When debugging why an agent picked the wrong tool, check for overlap first — two tools with similar activation scenarios is a far more common cause than one poorly worded description.
  • Prefer primitive, general-purpose tools over specialized wrappers whenever the underlying capability (a real filesystem, a real shell) already gives the model what it needs — a wrapper built as a guardrail for a weaker model can become the thing constraining a stronger one later.

Limitations

  • This is the interface layer specifically — whether a project needs LLMs at all, what the pipeline stages should be, or whether to introduce sub-agents are separate, adjacent design questions this doesn't cover.
  • The consolidation principle is a strong default, not an absolute rule — pushed too far, it produces an unusable mega-tool with too many parameters for an agent to reliably fill in correctly.
  • Architectural reduction works best with a well-documented, consistently structured data layer and a capable model — it's the wrong call for messy data or a domain that genuinely needs specialized guardrails.

$Related Playbooks

Developer Tools

PR Queue Triage

Clear a backlog of open pull requests before a release by classifying every PR into an evidence-based disposition — never by title — with a real git merge-tree test against the actual release branch, not the platform's often-wrong mergeable flag.

10 minutes
Intermediate
Developer Tools

Reproducible Database Lookup

A methodology for querying public database APIs — scientific, regulatory, financial, or otherwise — so another agent or human can repeat exactly what you did: bounded calls, count reconciliation, identifier-conversion tracking, and untrusted-data handling for every response.

10 minutes
Advanced
Developer Tools

Semantic Prompt Compression

Re-encode verbose system prompts, tool descriptions, and skill bodies into a dense telegraphic register — punctuation as connectives, label frames, verbless assertions — via re-encoding, not word deletion, with a density gate and a declared-loss verification pass.

5 minutes
Advanced
Developer Tools

Simplified Technical English for Docs

Write or rewrite technical documentation with the ASD-STE100 Simplified Technical English discipline — the aerospace maintenance-manual standard adapted for READMEs, runbooks, error messages, incident reports, and agent instructions.

10 minutes
Intermediate
Developer Tools

Project Graveyard: Autopsy Your Abandoned Side Projects

Scan local repos for dead side projects, autopsy each one from its git history, surface your personal death patterns, and pick the one corpse most worth resurrecting — then help ship it.

10 minutes
Intermediate
Developer Tools

Secure Coding Practices

A threat-model-first secure coding reference — trust-boundary mapping, a STRIDE quick-pass, a three-tier always/ask-first/never boundary system, and copy-paste prevention patterns for injection, XSS, broken access control, and SSRF.

10 minutes
Intermediate
Developer Tools

PR Review Toolkit

Six specialist reviewers — comments, tests, error handling, type design, general quality, and simplification — each triggered by name or automatically based on what changed in the diff.

5 minutes
Intermediate
Developer Tools

Security Guidance Review

Three-layer continuous security review for AI-generated code — instant regex warnings on edit, an LLM diff review at end of turn, and an agentic commit-time reviewer that traces data flow across files.

10 minutes
Advanced
Developer Tools

Vercel Analytics & Speed Insights Setup

Wire up Vercel Analytics, Speed Insights, and SPA routing rewrites into a React/Vite project in one pass — including the routing fix most people miss.

5 minutes
Beginner
Developer Tools

Shannon: Autonomous Pentesting for Your Own Apps

An operating guide for driving Keygraph's Shannon CLI: scope a white-box pentest against an app you own, run it, and turn the proven findings into fix tasks

15 minutes
Advanced
Developer Tools

Unslop UI Skill for Claude: Kill the AI Design Tells

A frontend guardrail built from a 3.2M-post Reddit analysis of what people actually call AI slop, with a build mode that forces design decisions up front and an audit mode that scans existing code for the tells

10 minutes
Intermediate
Developer Tools

Redesign Existing Projects: UI Audit and Upgrade

A design audit checklist that finds generic AI-look patterns in an existing codebase and fixes them without breaking functionality or migrating frameworks

10 minutes
Intermediate

Browse all Developer Tools playbooks →