Server primitives — Cheat Sheet
MCP Engineering course · M1
This guide explains, from scratch and taking nothing for granted, the three primitives that every MCP server exposes: tools, resources and prompts. Read it slowly: if you understand what each one is and —above all— who controls it, you've already understood the heart of Module 1.
Revision taught: MCP specification 2026-07-28 (current). The worked JSON comes from the course's lab-l08 notes server (official Python SDKmcp2.3.0, classMCPServer).
In one sentence
An MCP server doesn't expose "just anything": it offers exactly three types of capabilities, and we call those three types primitives. A primitive is simply a basic building block of the protocol. The most important idea in the whole lesson is this: each primitive has a different controller — the model, the application or the user. That separation is no accident: it's the design.
The three primitives at a glance
| Primitive | Who controls it | What it's for | Protocol methods |
|---|---|---|---|
| Tools | The model (the LLM decides to invoke it) | Actions: run functions (create an event, send a message) | tools/list, tools/call |
| Resources | The application (the host decides) | Read-only data (files, images, JSON) addressed by URI | resources/list, resources/read, resources/templates/list |
| Prompts (templates) | The user (triggers them on purpose) | Reusable templates of instructions, e.g. a slash command /… | prompts/list, prompts/get |
1. Tools — controlled by the model
A tool is a function that the server makes available and that the LLM decides to invoke on its own when it thinks it needs it. They are actions: they do something (search an API, write to a database, send a message). The model reads the list of available tools, picks one and runs it with whatever data is needed.
- Who's in charge? The model. That's why tools are said to be model-controlled.
- The two methods:
tools/list(ask for the list of tools available) andtools/call(run one, passing it anameand itsarguments). - Beginner example: a tool
create_event(date, title)in your calendar. You write to the AI "schedule a meeting on Tuesday at 10"; the model, on its own, decides to callcreate_eventwithdate="Tuesday 10:00"andtitle="meeting". You didn't pick the function: the model decided it from your request, and the host asks you to approve the call (or you pre-approved that specific tool). The spec says there SHOULD always be a human able to deny a tool invocation.
2. Resources — controlled by the application
A resource is read-only data: a file, an image, a JSON, a text. It runs no actions; it only delivers information to provide context. Each resource is identified by a URI (a unique address, similar to a web address).
- Who's in charge? The application (the host decides which resources to load and when, by user choice or automatically). They are application-driven. Parameterised resources use URI templates (RFC 6570) from
resources/templates/list. - The two methods:
resources/list(which resources are available) andresources/read(read the content of one, specifying its URI). - Beginner example: the file
file:///return-policy.mdfrom a store. The application attaches it to the model as context so it answers well about returns. The resource itself does nothing: it's only read. Think of it as a note that the app hands to the model, not as a button the model presses.
3. Prompts (templates) — controlled by the user
A prompt is a reusable template of instructions, designed for the user to trigger on purpose. The typical case is a slash command (a command that starts with /) that assembles a ready-made message.
- Who's in charge? The user. They are user-controlled: you choose to use them.
- The two methods:
prompts/list(which templates are available) andprompts/get(fetch one, ready to use, with its data filled in). - Beginner example: a prompt
/summarize-meetingthat, when invoked, assembles a message like "Summarize this transcript into 5 points and a task list". You choose it, with a click or by typing the command; neither the model nor the application decides it.
The key idea: three different controllers
Notice the pattern. The three primitives differ above all by who decides to use them:
- Tools → the model decides (actions, more or less automatic).
- Resources → the application decides (read-only context).
- Prompts → the user decides (templates on demand).
Why does this separation matter so much?
Because it makes a server predictable. If everything were decided by the model, you'd never know what it's going to touch or when. By splitting control, each actor has its lane: the user triggers templates when they want, the app decides what data enters as context, and the model can only act through tools someone exposed to it.
The split describes who decides when; it does not make a server safe on its own. Safety additionally needs host consent, input validation, access control and least privilege in the server. Servers MUST validate all tool inputs.
What a tool definition and result look like (2026-07-28)
From the running lab-l08 server (trimmed). Because get_note returns a Pydantic model, the SDK publishes an outputSchema and returns structuredContent:
{"name":"get_note","title":"Get a note by id",
"description":"Return one note by its id (format N-001).",
"inputSchema":{"type":"object","properties":{"note_id":{"type":"string","description":"Note id such as N-001"}},"required":["note_id"]},
"outputSchema":{"type":"object","properties":{"id":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}}},"required":["id","title","body","tags"]},
"annotations":{"readOnlyHint":true,"openWorldHint":false}}
{"jsonrpc":"2.0","id":2,"result":{
"resultType":"complete","isError":false,
"content":[{"type":"text","text":"{\n \"id\": \"N-001\", ... }"}],
"structuredContent":{"id":"N-001","title":"Demo: buy cables","body":"Two demo USB-C cables.","tags":["demo","shopping"]}}}
- If a tool declares an
outputSchema, servers MUST return conforming structured results; clients SHOULD validate them. A text block with the serialised JSON SHOULD also be returned for compatibility (the SDK does it). - Every result carries
resultType:"complete"or"input_required"(L05). Clients MUST treat a missingresultTypefrom an older server as"complete". - Servers MUST implement
server/discover(clients MAY call it); L06 covers it.
Two kinds of error
| Kind | Shape | Use it for |
|---|---|---|
| Tool execution error | a result with isError: true | API failures, invalid input values, business rules. Clients SHOULD pass it to the model so it can correct itself. |
| Protocol error | a JSON-RPC error, e.g. {"code": -32602, "message": "Unknown tool: invalid_tool_name"} | Unknown tools, malformed requests, server faults. |
SDK behaviour: in mcp 2.3.0, an unknown tool came back as isError: true with Unknown tool: nope, not as a JSON-RPC -32602. Clients should handle both shapes.
Definitions, annotations and caching
- Names: SHOULD be 1 to 128 characters, case-sensitive, only
A-Z a-z 0-9 _ - ., unique per server. inputSchema: MUST be a valid JSON Schema object. No parameters:{"type":"object","additionalProperties":false}.- Annotations (
readOnlyHint,destructiveHint,idempotentHint,openWorldHint): clients MUST treat them as untrusted unless they come from trusted servers. resource_link: a tool may return a link instead of embedding the data.- No protocol session (removed in 2026-07-28): state across calls travels as an explicit handle (for example a
basket_id), and the server re-checks authorisation on every call. - Caching: list results,
resources/readandserver/discovercarryttlMsandcacheScope("public"or"private"). Return tools in a deterministic order. Change notifications such asnotifications/tools/list_changedarrive only on asubscriptions/listenstream the client opens. - A missing resource returns
-32602in 2026-07-28 (-32002in legacy 2025-11-25).
⚠️ Watch out for tool design: exposing too many tools inflates the model's context and confuses it — less is more. How many and which to expose is a debated topic among those who build servers; it's covered in depth in an advanced module. For now, keep it on your radar.
One-line examples
- Tool:
create_event(date, title)— the model calls it on its own when you ask it to "schedule Tuesday". - Resource:
file:///return-policy.md— the app reads it to provide context. - Prompt:
/summarize-meeting— the user invokes it to assemble a ready-made message.
Glossary
- Primitive: basic building block that an MCP server exposes. There are three.
- Tool: function/action that the model decides to invoke (
tools/list,tools/call). - Resource: read-only data identified by URI, driven by the application (
resources/list,resources/read,resources/templates/list). outputSchema/structuredContent: a tool's declared result schema and the conforming result object.isError: the flag that marks a tool execution error (the model sees it); distinct from a JSON-RPC protocol error.- Prompt (template): reusable template triggered by the user (
prompts/list,prompts/get). - URI: unique address that identifies a resource (like a web address, e.g.
file:///notes.txt). - Slash command: command that starts with
/; the typical form of a prompt. .../listand.../call/.../read/.../get: by convention, each primitive has a method to list what's available and another to use a specific item.
To remember
- A server exposes three primitives: tools, resources and prompts.
- What distinguishes them is who controls them: Tools = model, Resources = application, Prompts = user.
- Each one has its pair of methods: list what's available + use a specific one.
- That separation of control makes the server predictable; safety additionally needs host consent, input validation and least privilege.
- Tool errors are results with
isError: true; protocol errors are JSON-RPC errors. - Annotations are untrusted hints unless the server is trusted.
Turning Point Academy · MCP Engineering course · Module 1 · Lesson 4 (L04) · V2, spec 2026-07-28