A plant shop agreed to pilot your ordering assistant. It is a real store with a point-of-sale system (the register software that tracks sales and stock), and the owner is next to you at 4:12 pm when the first customer asks: "do you still have the large monstera?" The reply comes back in two seconds: "Yes! We have 12 large monsteras in stock at $34." The owner does not need to check: she sold the last one eleven days ago and priced the reorder at $42. The facts in your prompt are her inventory export, pasted in the week you built the feature and correct that day. The model answered from that copy, because the copy was all it was given, and nothing in a prompt updates itself when a shelf empties.
In Give the model the facts it wasn't trained on you put your feature's facts in the prompt, stuffed or retrieved, and either way they were a copy made before anyone asked the question. This chapter adds the next rung of the customization ladder (the order this part follows for changing what a model does, cheapest first): a way to fetch a fact at the moment of the question, and a way for the model to request an action that your code carries out.
One tool-call round trip, printed in full
A tool is a function in your own code (a named piece of code that does one job) that the model can request by name. Our fridge feature has never needed one, because the parent gives it the whole input in a photo. But the answer to "what can we cook tonight?" depends on what the kitchen holds at the moment someone asks, so we built the smallest tool worth printing: a lookup of the pantry in the same kitchen. Here is every message that went back and forth.
The definition, sent along with the question. Along with the user's words, the request carries the tool's definition: a name, a description, and the parameters the function accepts (the inputs it can be given).
{
"name": "get_pantry",
"description": "Returns every item currently in the family's pantry, with quantities. Call this before answering any question about what the family has on hand.",
"parameters": {
"type": "object",
"properties": {
"category": { "type": "string", "description": "Optional filter, such as 'grains' or 'canned'" }
}
}
}
The description is not just documentation; it is part of the prompt. Whether the model requests the tool at the right moments, never, or every time depends on those two sentences, and writing them is the same work you did in Write the prompt as a spec, not a sentence, in one new place.
The question, as the parent typed it.
What can we cook tonight without a store run?
The model's reply, which is not an answer.
{ "type": "tool_call", "name": "get_pantry", "arguments": {} }
Apart from small differences in how each provider formats it, that block is the whole tool call: a structured request that names a function and its arguments, the values to pass in (here, none). Nothing has run yet. The model cannot reach a database, a file, or the network; it produced text in a format your code parses, the same kind of fixed structure you already require for its answers.
What our code did. get_pantry is ordinary code: a query against the pantry table (the list of pantry items in our database), run on our server with our credentials (the passwords and keys our server uses), the same place the model call already runs. The result goes back to the model as one more message:
{ "items": ["rice, 2 kg", "black beans, 3 cans", "canned tomatoes, 2", "pasta, 500 g", "onions, 4"] }
The second reply, grounded in the result. Given the result, the model produces the answer the parent sees:
Tonight you can make black bean and rice bowls, or pasta with
tomatoes and onions; everything for both is already in the pantry.
The model never runs anything. A tool call is a request: the model's reply names a function to run, your code runs that function and sends back the result, and the model produces the final answer from that result.
The drawing calls this exchange the tool-call round trip. The question comes in; the model, which has no access to your pantry, sends out a CALL slip for get_pantry; your code runs it; a RESULT slip travels back; and the model answers from real data. A faded lane below shows the same question with no tool, where the model can only guess.
You pay for two model calls for every answer that uses a tool, one before the function runs and one after, and at this size that is still under a cent.
When a tool works better than stuffing
You might reasonably ask why our code does not just run get_pantry itself and stuff the result into the prompt before every call. It could, and when one predictable fact serves every question, that is the right approach; the fridge prompt has no tools at all. A tool is worth building when stuffing cannot keep up.
- Too fresh. For the plant shop, a tool like
get_stock(product): the right answer changed eleven days ago and will change again before closing, so only a lookup at the moment of answering is ever current. - Too large. A support app's
search_help_center(query)searches 4,000 articles: the whole library cannot go out with every call, so a search tool looks things up only when someone asks about them. - Behind an action. With
add_to_list(item)there is no fact to paste, because "rice is on the shopping list" only becomes true when code runs. You can put any fact you have into a prompt, but you cannot put an action into one; the action happens only when code runs.
With the third kind, the model goes from fetching facts to requesting actions. Every tool you connect lets the model use some of your authority, and The Practice covers what an app owes its users before it lets a model act.
MCP: one standard way to connect tools
The code that handled the round trip above was written for one provider's format. The Model Context Protocol, MCP, makes that connection standard: one open format that any app or service can use to offer its tools, and that any client (the app calling the tools, such as an AI assistant) can use to call them. It was published in late 2024 and adopted across the major providers since. In 2026 you mostly meet it as a setting: the connectors page in Claude, ChatGPT, or Gemini, where switching on your calendar or your CRM gives the assistant that service's tools, without anyone writing round-trip code for that pairing. How a tool call works stays the same; what changes is which apps and services can connect to which, and The action surface: every tool is delegated authority takes up the question of authority in The Practice.
The running club's assistant: one tool that looks up a member's own orders
The club's support assistant needs one fact that a facts block cannot hold: the status of a member's own shop order, which is different for every member and changes when the order is paid, collected, or refunded. The assistant gets one tool for it:
{
"name": "get_my_orders",
"description": "Returns the shop orders of the member who is signed in, each with its item, size, and status. Call this before answering any question about the member's own order.",
"parameters": { "type": "object", "properties": {} }
}
This definition protects members in these ways:
- The tool only reads. It looks orders up and changes nothing. The assistant has no tool that issues a refund, cancels an order, or changes a membership, and the model can only request the tools you defined, so it cannot do any of those things, whatever a member types.
- The tool has no parameter for the member. If it accepted a member's id or email address, the model would fill that value in from the conversation, and a member could type someone else's. Your site's code can already tell which member is signed in, from the sign-in you built in Add accounts and member-only pages. When the tool call arrives, your code looks up only that member's orders.
The customization ladder: instructions, then context, then tools, then fine-tuning
When our fridge feature padded a shopping list with yogurt that was not in the photo, we fixed it with instructions: rules and one worked example. When our users needed facts the model was never trained on, we fixed it with context, meaning facts added to the prompt, stuffed or retrieved. When they needed the pantry as it is right now, or a change made in the world, we connected a tool. Each rung costs more than the one below it: a prompt edit is free and you can undo it in a keystroke, context adds tokens to every call and a store of facts to keep current, and a tool adds code you have to write, secure, and maintain.
The drawing shows the four rungs rising from INSTRUCTIONS, marked START HERE, through CONTEXT and TOOLS to FINE-TUNE, marked LAST RESORT. The bottom is labeled cheap, fast, and reversible, and the top costly, slow, and locking you in, because you end up tied to a custom model you trained.
The fourth rung, fine-tuning, trains a model further on your own examples, and the result is a new model, not your old one improved. Fine-tuning is good at changing how the model's replies are written and how the model behaves, such as tone and format, but it is not a reliable way to add facts (when the problem is missing facts, go back down to context), and you have to repeat every check so far from scratch. The providers' own guidance is to try prompting and retrieval fully, with evidence that they fall short, before training anything. The Frontier's Choosing the right model covers the rare case where fine-tuning is worth it.
The ways to customize a model range from cheap and reversible to costly and locking you in: instructions, then context, then tools, then fine-tuning. Use the cheapest rung that works and stop there.
Try it now
This drill takes about twenty minutes; the no-setup path costs nothing and the path with your coding tools a few cents. You bring your feature's facts in its prompt, the artifact from Give the model the facts it wasn't trained on. You leave with your feature's first tool, connected if your coding tools are set up, or fully specified on paper if they are not: a name, a one-line description, the parameters, and what your code does when the tool call arrives.
No setup: Specify the tool on one page. Pick the fact in your prompt that goes out of date fastest, or the one action your feature most needs to take. Then write a name in verb_noun form (like get_pantry); a description saying what comes back and when to call it, written with the same care as the rest of your prompt, because it is part of it; each parameter with a type; and what your code does when the model calls the tool: what it reads, what it returns, and what it refuses. The running club's page is the get_my_orders definition above, plus one line for what the code refuses: any request for another member's orders. Then play the part of the code, using our printed exchange as the pattern: write the result message your function would return for a question your user would really type, and check that the answer you want back contains nothing your result did not provide.
With your tools: Give Claude Code the spec and ask it to connect the tool to your feature's model call: the definition added to the request, the function pointed at wherever the fact is actually stored, and the round trip written to a log. Run one real question and read the log: the tool call going out, the result coming back, and the grounded answer. If the model answers without calling the tool, make the description more specific and rerun; you revise it the way you revise any prompt. If the tool returns one user's data, as the club's does, add this sentence to the ask: "Take the user's id from the sign-in, never from the model's arguments." Same move in Codex or Cursor: paste the spec and ask for the definition, the function, and the logged round trip. If nothing is installed yet, the Setup Clinic gets you running.
Chapter Summary
- A fact stuffed into a prompt is a copy made before anyone asked the question, and nothing in a prompt updates itself when things change.
- A tool is a function in your own code that the model can request by name; its definition is a name, a description, and parameters, sent along with the question.
- The model never runs anything: a tool call is a structured request, your code runs the function and sends back the result, and the model produces the final answer from that result.
- The description is part of the prompt: whether the model requests the tool at the right moments depends on it, and you fix a tool that is requested too rarely or too often by revising the description.
- You pay for two model calls per tool answer, with one function run in between.
- A tool is worth building when facts are too fresh to paste or too large to send every time, or when the feature needs an action that only code can take.
- Connect read tools before write tools, and keep a check in code between the model's request and anything that changes the world.
- When a tool returns one user's data, your code takes that user's id from the sign-in, never from the model's arguments, so no user can get another user's data.
- MCP is the standard way to connect tools: the connectors page in Claude, ChatGPT, or Gemini gives an assistant another service's tools, and The Practice covers the questions of authority this raises.
- The customization ladder is the order for changing what a model does: instructions, then context, then tools, then fine-tuning. Stop at the cheapest rung that works; fine-tuning produces a new model that you have to check again from scratch, so it comes last and is rarely needed at all.
Next, in Choose the model you ship, you test the model you have been using against the same provider's cheaper model, on real inputs of your own.
Sources
- OpenAI, Anthropic, and Google Gemini tool use and function calling documentation (last verified July 2026).
- Model Context Protocol specification, modelcontextprotocol.io (last verified July 2026).
- OpenAI guidance on model optimization order: prompting, retrieval, then fine-tuning (last verified July 2026).
- Qi and colleagues (2023), research finding that fine-tuning can weaken trained refusals.
- FuelTheFam (fuelthefam.com), our family nutrition app; the fridge feature is live in the product, and the pantry exchange was wired and run for this chapter.