The Model Context Protocol (MCP) defines three structures offered by a server: tools, resources, and prompts. A tool is an operation that a language model can call. A resource is data that provides context to the model. A prompt is a template containing structured messages and instructions for interacting with a language model.
This distinction also appears in protocol requests. A client sends tools/call to call a tool, resources/read to retrieve resource content, and prompts/get to retrieve a specific prompt. Each structure also has a separate request that lists available items.
Control models
The MCP specification defines a model-controlled interaction model for tools. The language model can discover and automatically call tools based on the context and the user's prompts. The specification does not require applications to use a particular interface format.
Resources are designed to be application-driven. The host application determines how to incorporate context according to its own needs. The specification gives explicit selection from a list or tree view, and searching and filtering resources, as examples. Automatic inclusion of context is also among the options described.
Prompts are designed to be user-controlled. The server offers them to the client so that the user can explicitly select them. Commands initiated by the user in the interface are among the usage examples given in the specification. MCP does not require a particular interface format for prompts either.
Tool: Callable operation
According to the MCP specification, a server can offer tools that language models can call. These allow models to interact with external systems. Querying databases, calling APIs, and performing calculations are among the examples in the specification.
Each tool is identified by a name. The inputSchema in its definition specifies the expected parameters as JSON Schema. The optional title provides a human-readable name for display. The description explains its function. A tool can also include an optional outputSchema to specify the output structure.
The client sends tools/list to retrieve the list of available tools. This operation supports pagination. A tool call uses tools/call; the request carries the tool name and the arguments in arguments. A server that supports tools must declare the tools capability.
The listChanged property in the tools capability indicates whether the server will send a notification when the list of available tools changes. According to the MCP specification, a server that declares this capability should send a notifications/tools/list_changed notification when the list changes.
A tool result can carry structured or unstructured content. An unstructured result is returned in the content field and can contain multiple content items of different types. The specification lists text, image, audio, resource link, and embedded resource types. Structured content is returned as a JSON object in the structuredContent field.
If a tool provides an outputSchema, the server's structured results must conform to that schema. The MCP specification also specifies that the client should validate the structured result against the schema. A tool that returns structured content is expected to also return the serialized JSON content in a TextContent block for backward compatibility.
A tool can return a resource link to provide additional context or data. The link contains a URI that the client can read or subscribe to for changes. However, resource links returned by a tool are not guaranteed to appear in the result of resources/list.
There are two mechanisms for tool errors. Cases such as an unknown tool or invalid arguments can be reported as protocol errors. Errors that occur during tool execution can be reported with isError: true in the result. The specification gives API errors and invalid input data as examples of the second group.
Resource: Data for context
The MCP specification defines resources as a way for a server to share context data with a client. Files, database schemas, and application-specific information are examples of this data. Each resource is identified by a unique URI.
A resource definition contains uri and name. The optional title provides a human-readable name for display. description, mimeType, and size in bytes are also optional fields. Resource content can be text or binary data; the specification examples show these with the text and blob fields, respectively.