Skip to content

2.1 Tool Interface Design

A tool is a function that an agent can call. It has a name and a plain-language description. Tool descriptions are the primary mechanism LLMs use for tool selection. Given a set of tools, the model reads the tool descriptions to decide which tool to call. Tool descriptions are not supplementary metadata. Minimal descriptions, such as “Retrieves customer information”, give the model no way to distinguish overlapping tools.

This lesson uses one made-up example throughout: a tailor whose booking agent has two tools. Their descriptions are “Retrieves client information” and “Retrieves alteration details”. When the agent is asked whether a hem is ready, it calls the client tool, because both descriptions fit.

A production-grade tool description includes five elements.

  1. What the tool does: its primary purpose, stated unambiguously
  2. What inputs it expects: data types, formats, constraints, and required versus optional fields
  3. Example queries it handles well: concrete use cases that show the model what the tool is for
  4. Edge cases and limitations: what the tool does not do, and what happens when inputs are outside expected ranges
  5. Explicit boundaries: when to use this tool versus similar tools in the same toolkit

The tailor’s alteration tool would name the ticket number it accepts. It would list “is my hem ready?” as a query.

Minimal (causes misrouting):

get_customer: "Retrieves customer information"
lookup_order: "Retrieves order details"

Production-grade (reliable selection):

get_customer: "Looks up a customer account by email address,
phone number, or customer ID. Returns customer profile
(name, contact details, account status, loyalty tier).
Use this when you need to verify who the customer is.
Do NOT use for order-specific queries — use lookup_order
for those."
lookup_order: "Retrieves order details by order number
(format: #NNNNN) or tracking ID. Returns order status,
items, shipping details, and refund eligibility.
Use this when a customer asks about a specific order.
Do NOT use for customer identity verification —
use get_customer for that."

The second version states explicitly how the tools differ: which identifiers each tool accepts, what each tool returns, and when not to use each tool.

Two tools with overlapping or near-identical descriptions confuse the model when it selects a tool. Both descriptions fit a request like the hem question, so nothing in the descriptions shows the model which tool is right. Expand both descriptions with the five elements.

Generic tools with broad responsibilities create ambiguity, because a broad description fits many requests. Split them into purpose-specific tools with defined input and output contracts, as a tailor might split one garment tool into fittings and alterations.

Before splitting:

analyze_document: "Analyses a document and returns results"

After splitting:

extract_data_points: "Extracts structured data fields
(dates, amounts, names) from a document"
summarize_content: "Produces a concise summary of a
document's key arguments and conclusions"
verify_claim_against_source: "Checks whether a specific
claim is supported by the source document, returning
supporting/contradicting evidence"

Each resulting tool does one narrow, clearly described job the model can match to the user’s need.

When two tools have confusingly similar names, renaming fixes the overlap at the interface level. Rename analyze_content to extract_web_results with a web-specific description, and its purpose becomes unambiguous without touching its implementation. The tailor’s tools could become find_client and find_alteration.

Keyword-sensitive instructions in system prompts can create unintended tool associations that override well-written descriptions. When the system prompt says “always check customer details before proceeding”, the model may route any customer-related query to get_customer, whatever the descriptions say. The tailor’s “always check client details first” could send hem questions to the client tool. After you update descriptions, reread your system prompt for conflicts. These conflicts are a subtle failure mode.

In the exam guide’s sample Question 2, get_customer and lookup_order have minimal descriptions, and the agent routes “check my order #12345” to the wrong tool. Pick the correct fix from four plausible options.

  • Expand descriptions: correct. It needs low effort, has a large effect, and addresses the root cause directly.
  • Few-shot examples: wrong. They add token overhead without fixing why the model is confused. They address the effects and leave the cause in place.
  • Routing classifier: wrong. A routing classifier is code that parses the user input before each turn and selects the tool from detected keywords. It is over-engineered as a first step. It bypasses the LLM’s natural language understanding and adds infrastructure complexity.
  • Tool consolidation: wrong as a first step. It is a valid architectural choice long-term, but it costs far more effort than expanding descriptions.

The exam consistently favours low-effort fixes with a large effect: better descriptions before routing classifiers, scoped access before full access, community servers (servers built by other people) before servers you build yourself. The exam also tests system prompt conflicts.

Five exam-style multiple-choice questions on Tool Interface Design. Pick an answer, then open the explanation.

Production logs show an agent frequently calls get_customer when users ask about orders (e.g., “check my order #12345”), instead of calling lookup_order. Both tools have minimal descriptions (“Retrieves customer information” / “Retrieves order details”) and accept similar identifier formats. What is the most effective first step to improve tool selection reliability?

  • A. Add 5-8 few-shot examples to the system prompt covering order-shaped queries.
  • B. Add a routing layer that parses each user turn and pre-selects a tool from keywords.
  • C. Consolidate both into a single lookup_entity tool that accepts any identifier and internally determines which backend to query.
  • D. Expand both descriptions to cover input formats, example queries, edge cases, and explicit boundaries.
Answer & explanation

Correct: D

  • D is correct because tool descriptions are the primary mechanism LLMs use for tool selection. Expanding them is the lowest-effort, highest-leverage fix, and it addresses the root cause directly, because neither description currently says what its tool is for or when to prefer the other one.
  • A is wrong because few-shot examples add token overhead to every request while leaving the ambiguity in place. They compensate for descriptions that still fail to differentiate the tools.
  • B is wrong because a routing layer is over-engineered as a first step. It bypasses the model’s own language understanding and adds infrastructure that must be maintained as the tool set changes.
  • C is wrong because consolidation is a legitimate architectural choice but a far larger change than rewriting two descriptions. The exam favours proportionate first steps.

A tool named analyse_document has the description “Analyses a document and returns results.” Users report that the agent sometimes extracts data when they want a summary, and vice versa. What is the best approach?

  • A. Split it into purpose-specific tools, each with a narrow description and its own input/output contract.
  • B. Add few-shot examples that show when to extract data points and when to summarise instead.
  • C. Rename it extract_and_summarise_document so both operations are visible in the name.
  • D. Add a pre-processing step that classifies intent first.
Answer & explanation

Correct: A

  • A is correct because a generic tool with broad responsibilities forces the model to guess which operation the user wants. Splitting it into extract_data_points, summarise_content and verify_claim_against_source gives the model narrow options with defined input/output contracts.
  • B is wrong because few-shot examples treat the symptom. The root problem is one tool carrying several responsibilities, and no number of examples removes that ambiguity.
  • C is wrong because the name now lists both operations but the tool still performs both, so the model must still infer which one is wanted on any given call.
  • D is wrong because a pre-processing step is over-engineered. The fix belongs at the tool interface, not in an external routing layer.

After improving tool descriptions for get_customer and lookup_order, a developer notices that order-related queries still sometimes route to get_customer. The system prompt contains: “Always check customer details before proceeding with any request.” What is the likely cause?

  • A. The descriptions need more detail still, so that they outweigh the instruction sitting in the system prompt.
  • B. A keyword-sensitive system prompt instruction is creating a competing association on every turn.
  • C. The model has cached the earlier descriptions and needs a context reset.
  • D. The two tool names remain too similar to each other, and both of them should be renamed for clarity.
Answer & explanation

Correct: B

  • B is correct because keyword-sensitive instructions in a system prompt can silently override well-written tool descriptions. “Always check customer details before proceeding with any request” associates every request with get_customer, and it is weighed alongside the descriptions rather than beneath them.
  • A is wrong because description quality is no longer the constraint; the descriptions were already improved. Adding further detail does not remove a competing instruction.
  • C is wrong because tool descriptions are not cached between API calls. Each request is evaluated against the definitions sent with it.
  • D is wrong because get_customer and lookup_order are already distinct names. The remaining misrouting traces to the system prompt, not to the names.

Two tools have confusingly similar names: analyse_content and analyse_web_content. Both handle web data. What is the most effective fix?

  • A. Add detailed descriptions to both tools, setting out how their scopes differ from one another and which to prefer.
  • B. Merge both into a single analyse_all_content tool that handles every type.
  • C. Rename analyse_content to extract_web_results and give it a description scoped to web results.
  • D. Add a routing classifier that picks between the two tools by inspecting the input content first.
Answer & explanation

Correct: C

  • C is correct because the overlap sits at the interface, not in the implementation. Renaming to extract_web_results with a specific description makes the tool’s purpose unambiguous without changing what it does.
  • A is wrong because when two names are confusingly similar, the descriptions have to work against the names themselves. Ambiguity the name creates is better removed than compensated for.
  • B is wrong because merging recreates the generic-tool problem: one tool carrying several responsibilities.
  • D is wrong because a routing classifier is over-engineered when a rename resolves the ambiguity outright.

A production-grade tool description should include which five elements?

  • A. Purpose, expected inputs, example queries, edge cases, and explicit boundaries against similar tools.
  • B. Name, version, author, licence, and dependencies.
  • C. Endpoint URL, authentication method, rate limits, response schema, and the documented error codes it can return.
  • D. Function signature, return type, unit test coverage, a documentation link, and the full release changelog.
Answer & explanation

Correct: A

  • A is correct because these five give the model enough context to differentiate one tool from another: what it is for, what it accepts (with formats and constraints), what queries suit it, where it stops, and when a neighbouring tool is the better call.
  • B is wrong because these are package metadata fields. None of them tells the model what the tool is for or when to select it.
  • C is wrong because these are API specification fields. Inputs partly overlap, but the set omits example queries and boundaries, which are the two that drive selection between similar tools.
  • D is wrong because these are software documentation fields aimed at maintainers, not selection signals aimed at the model.