100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Tool Use, Function Calling & MCP
30 minadvanced

Anatomy of a Tool Definition

A tool definition is the only thing the model ever sees of your tool. It never reads your implementation, never inspects your database schema, never sees the try/except block around your API call — it sees a name, a description, and an input_schema, and from that alone it decides whether to call the tool, which one to call, and what arguments to send. Get the definition wrong and no amount of correct implementation behind it saves you: the model was never going to call it, or was going to call it with the wrong arguments, because the interface it was reasoning against didn't say what the tool actually does.

That makes the tool definition a strange kind of object. It is documentation, in the sense that its entire job is to be read and understood correctly by a reasoning system. But unlike documentation a human reads once and remembers, a tool definition is retransmitted and reread on every single API call in the conversation, whether or not the tool ends up being used that turn. Claude Opus 5 pays for the tokens in every tool definition on every call, the same way it pays for every other token in the request — a verbose, imprecise definition is not a one-time authoring cost, it's a recurring tax for the life of the session.

This lesson treats the tool definition as having exactly that dual nature — interface documentation and permanent token cost at the same time — and walks through what follows from taking both halves seriously: how to write a description that actually steers selection, how naming and parameter design act as affordances rather than decoration, and how to think about the token bill a toolset accumulates before a single tool has run.

Analogy🏏Cricket
🏏 Think of it like cricket: Every squad member submitted for a series carries a role card that the team management reads before every single match, not just the ones he plays in. Take Ravindra Jadeja's card ahead of a home Test series: left-arm orthodox spinner, capable lower-order bat, most effective on turning tracks from day three onward, not the first option on a fresh, seaming Wankhede pitch on day one. The captain and think tank read that exact card before the toss of every single Test in the series, whether Jadeja ends up bowling forty overs or none at all, because the card is what tells them whether to even consider him for that day's conditions. That reading carries a cost independent of whether he's used — team meetings run longer, the whole management group carries his profile in their heads for the entire tour. A vague card ('bowls a bit, useful with the bat') forces the captain to guess mid-session; a precise one lets him decide in seconds. A tool definition works exactly the same way: the model reads name, description and input_schema in full on every API call, whether or not it ends up calling the tool, so the same object has to serve two jobs at once — complete documentation, and a permanent tax paid every turn.
Lesson 3 of 35
0% complete