Model Context Protocol › The three primitives

Michael BrenndoerferDecember 1, 20263 min read
Language AI HandbookAll chapters
Part 49 of 67Long-Horizon Agents and Interoperability
Chapter 377Model Context Protocol › The three primitives
Reading section 7 of 14 · The three primitives · 3 minSection 7 of 14 · 3 min

Section 7 of 14 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

MCP servers can expose different capabilities. The table describes the intended interaction patterns of the three server primitives. Hosts can build different interfaces around them.

Selection and methods for the three server primitives.
PrimitiveIntended selectionDiscoveryOperation
ToolsModel proposes an operationtools/listtools/call identifies a tool and supplies arguments
ResourcesApplication selects contextresources/listresources/read retrieves content by URI
PromptsUser selects a named templateprompts/listprompts/get returns messages with supplied arguments

Tools

A tool uses a name and a JSON Schema for inputs. A description helps the host and model identify its purpose. An optional output schema describes structured results. When the tool advertises an output schema, a successful structured result must conform to it and clients should validate it. Responses can also carry typed content, for example a text representation of the same result. Tools specification.

A JSON-RPC error reports a protocol problem, such as an unknown method or a malformed request. A tool execution failure can instead return a result with isError: true, so the host can present useful information from the operation. A non-object arguments field fails at the protocol boundary. If the arguments object is well formed but its values fail the tool's own input rules, the tool reports the validation problem in its result. Both still need explicit handling in the host.

Resources and prompts

A resource has a URI. resources/read can return text or base64-encoded binary data. For a family of related resources the server may list URI templates through resources/templates/list. The application still chooses which returned content to include in model context. Resources specification.

A server defines prompt templates and their arguments. A user might pick a catalog summary template in a menu, and the application would request its messages with prompts/get. The prompt name describes a user-facing choice. Returned messages still come from the server and the host controls how they enter the conversation. Prompts specification.

A concrete primitive test can use the app's own routing table. This one keeps discovery and follow-up operations paired. The resource-template route is listed separately because it lists families of resource URIs. Operations such as writing a reading list belong to the service design and do not enter this fixture.

PythonIn [9]
CollapseExpand
primitive_methods = {
    "tool": ("tools/list", "tools/call"),
    "resource": ("resources/list", "resources/read"),
    "prompt": ("prompts/list", "prompts/get"),
}
resource_template_method = "resources/templates/list"
assert (
    len({method for pair in primitive_methods.values() for method in pair}) == 6
)
assert all(
    discovery.split("/")[0] == operation.split("/")[0]
    for discovery, operation in primitive_methods.values()
)

When teaching these routes to a model-facing application, keep discovery information and fetched content in separate fields. A retrieved resource might provide a sentence to cite. A tool description helps decide whether an operation fits the request. A selected prompt becomes input to the conversation under the host's chosen roles. The application uses those fields to choose what it shows the model and which role to give each item.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy