Skip to content

Interview question · Tool Calling & Tool Contracts

Design the tool definitions an agent sees for an order-management API.

The API already exists; the question is what the model should see. Strong answers turn endpoints into decisions, take identity out of the arguments and design the results as carefully as the inputs.

easyEssentialNewUpdated Nov 2026

TL;DR: Do not mirror the endpoints. Expose one tool per decision the agent makes (orders_recent, orders_get, orders_cancel, returns_start, shipping_track), each with a description that says when to use it and when not to, a few constrained arguments, no customer identity argument, and a compact result with the facts the next step needs. Then test selection on a labelled set of requests.

How to approach it

Ask what the agent is for before designing anything: a customer-facing support agent needs different tools from an internal operations agent with broader authority. Then ask which actions are irreversible or cost money, because those shape the arguments and the policy around them. Say out loud that you will design for a model reader, which rereads every definition on every turn.

A strong answer

Start from the customer's intents, not from the API's endpoints. A support agent for an online store serves a short list of decisions: find my order, where is it, cancel it, return it, why was I charged. Each becomes one tool:

ToolDecisionArgumentsSide effect
orders_recentWhich orders is the customer talking about?limit (1 to 20)None
orders_getWhat is the state of this order?order_idNone
shipping_trackWhere is the parcel?order_idNone
orders_cancelCancel before shippingorder_id, reason (enum)Order cancelled, customer emailed
returns_startReturn a delivered itemorder_id, sku, reason (enum)Return label created

Three choices carry most of the value. Identity is not an argument. Every tool acts on the customer in the authenticated session; there is no customer_id for an injected instruction to set. Cancel and return are separate tools, because they have different rules and different consequences, and their descriptions point at each other ("for an item that has already arrived, use returns_start"). Reasons are enums, so the harness can apply policy per reason and the model cannot invent one.

Write one definition in full so the interviewer sees the detail:

name: orders_cancel
description: >
  Cancel an order that has not shipped. For a delivered item use returns_start.
  Fails with precondition_failed if the order has shipped. Side effect: the
  customer is emailed a cancellation confirmation.
input_schema:
  type: object
  properties:
    order_id: {type: string, pattern: "^ord_[0-9]{6}$"}
    reason:
      type: string
      enum: [customer_request, duplicate_order, wrong_item_ordered]
  required: [order_id, reason]
  additionalProperties: false

Then design the results. orders_get returns status, a precomputed cancellable and returnable flag, the first few line items with a count, and the dates the customer will ask about, not the 30 KB internal record. When a list is truncated, the result says so and how to get more.

Finish with how you would know it works: a few hundred labelled requests, weighted toward ambiguous ones ("I want to send this back", "I changed my mind"), scored for which tool a correct agent calls. The confusion matrix tells you which descriptions to fix.

What interviewers probe next

"The API has 40 endpoints. Why only five tools?" Most endpoints are implementation steps (look up customer, list orders, fetch lines). Tools map to decisions; the steps happen inside the tool. Fewer, clearer tools mean fewer tokens per turn and fewer wrong choices.

"An operations agent needs to cancel shipped orders as an exception. Same tool?" A different tool with its own permission check (orders_force_cancel, available only to the operations agent's task and requiring an approval), so the customer-facing agent never sees it.

"How long should a description be?" As long as it takes to say what the tool does, when to use it instead of its nearest neighbour, how it fails and what it changes. Usually two to four sentences; the "when not to" clause is the one most often missing.

What if?

What if · interview follow-ups

Hold your answer as the constraints change

Your support agent has orders_recent, orders_get, orders_cancel and returns_start. Selection works well in testing.

  1. Start here

    What if customers often say 'cancel' about orders that have already arrived?

How it's scored

Weak: Lists the API's endpoints as tools, includes a customer or user id argument, and returns raw records.

Hire: Designs tools around customer intents, separates cancel from return, constrains arguments and keeps identity in the session.

Strong Hire: Writes a full definition with when-not-to-use guidance, precondition errors that name the right tool, designs compact results with precomputed flags and truncation notices, keeps privileged variants for other agents, and evaluates selection with a labelled, ambiguity-weighted set.

Common mistakes

  • A generic orders_update(order_id, fields) that lets the model guess field names and values.
  • Descriptions that say what a tool does but never when to use a different one.
  • Treating the result format as an afterthought, then paying for oversized results on every later turn.
  • Testing selection with the same handful of clear requests the demo used.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 6, and the site remembers where you stopped in each one.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in raises your free answers from 5 to 6 per topic, adds an applied lesson in every topic and easy practice tests, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

Nobody has commented. Post a correction or another way to answer.