Tool design: narrow, described, idempotent
Tool selection is driven by descriptions, not names. Make tools single-purpose, describe them for the model, take structured args, and make writes safe to retry.
Narrow, single-purpose tools
A tool that does one thing is easier for the model to select correctly and easier for you to test.
- Prefer
create_invoiceandsend_invoiceover onemanage_invoicethat branches on a mode arg. - Narrow tools shrink the decision space, which raises selection accuracy.
Descriptions drive selection
Selection is driven almost entirely by the tool/agent description, not its name.
- Lead the description with concrete trigger phrases: *"Use when running database migrations, altering schemas…"*.
- Add 2–3 example scenarios — they measurably improve routing.
- If the model does the work inline instead of calling your tool, that's a description miss, not a logic bug. See subagent not triggering.
Structured args and idempotency
Tools are an API the model calls — design them like one.
- Take typed, structured arguments with a strict schema rather than a free-text blob.
- Make writes idempotent (accept a client-supplied key) so a retry after a timeout can't double-charge or double-send.
Related patterns
MCP: a standard port for tools and context
MCP is a standard client/server protocol that exposes tools, resources, and prompts to an agent, so you build an integration once and reuse it across every host.
RAG: ground answers in retrieved knowledge
RAG fetches the most relevant chunks from your knowledge store and drops them into context, so the agent answers from retrieved facts with citations instead of guessing from training memory.
Reasoning techniques: think before you answer
Reasoning techniques trade extra tokens for accuracy on hard problems — chain-of-thought, self-consistency voting, ReAct's think-act loop, and tree search — but only when the failure is reasoning, not facts.