Model Context Protocol › The three primitives
Language AI HandbookAll chapters 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.
| Primitive | Intended selection | Discovery | Operation |
|---|---|---|---|
| Tools | Model proposes an operation | tools/list | tools/call identifies a tool and supplies arguments |
| Resources | Application selects context | resources/list | resources/read retrieves content by URI |
| Prompts | User selects a named template | prompts/list | prompts/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]Expand
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!