CourseModel Context Protocol · Module 3: Tools · part 16 of 83
Part 16 · Module 3: Tools

Topic 2: Defining tools

17 min read·22 Sept 2026

What a tool is made of

A tool is a function the server offers and the model decides to call. The model never sees your Python. It sees a tool definition, a small JSON object the client fetches with tools/list, and it answers with a name and a set of arguments that the client forwards in tools/call.

A definition has these parts:

FieldWho reads itWhat it is for
nameThe model and the clientThe identifier the model writes in its tool call. Unique within one server.
titlePeople, in the host's UIA friendly display name such as "Search notes". Optional.
descriptionThe modelPlain-language instructions: what the tool does, when to use it, what comes back.
inputSchemaThe model and the SDKA JSON Schema for the arguments. The model uses it to fill arguments, the SDK uses it to reject bad ones.
outputSchemaThe client applicationA JSON Schema for structuredContent, the typed result. Optional.
annotationsThe hostHints about behavior: read-only, destructive, idempotent, open world.

A JSON Schema is a JSON document that describes the allowed shape of other JSON: which properties exist, their types, which are required, and limits such as a maximum length. Structured content is the typed JSON half of a tool result, meant for code rather than for the model.

The host lists tools from the notes server, passes the definitions to the model with the user's question, receives a search_notes call, forwards it as tools/call, gets content and structuredContent back, and hands the result text to the model.
One tool call end to end: tools/list, the model's choice, tools/call, the result.

In the Python SDK you rarely write any of that JSON by hand. @mcp.tool() reads the function name, the docstring, the type hints, and the return annotation, and builds the definition for you. That convenience is also the trap: whatever you write carelessly becomes the model's instructions.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.