Skip to main content

Resources and Prompts

6.1 Resources in Detail

Resources allow Servers to expose data to AI applications. The distinction from Tools:

Resource URIs

Each resource has a unique URI identifier:

URI Templates (RFC 6570)

MCP supports RFC 6570 URI template syntax for defining dynamic resources. Servers can include URI templates in resources/list responses, and Clients fill in template variables to request specific resources:
Common URI template patterns:
Client usage with filled variables:

Annotations

Each resource can carry Annotations metadata to help the Host decide how to use the resource:
Annotations field descriptions:

Resource Subscriptions

If the Server declares resources: { subscribe: true } during initialization, the Client can subscribe to resource changes:
Upon receiving the notification, the Client re-calls resources/read to get the latest data. This pattern suits scenarios with high real-time requirements, such as inventory monitoring. To unsubscribe:

Resource List Change Notifications

When the Server’s resource collection changes (resources added or removed), it can notify the Client:
The Client then re-calls resources/list to get the latest resource list.

Implementation Example

6.2 Prompts in Detail

Prompts are predefined interaction templates provided by the Server. Unlike Tools and Resources, Prompts are user-controlled — users actively select which template to use in the Host application.

Prompt Structure

Getting a Prompt (with Arguments)

Commerce Prompt Examples

Multi-Message Prompts

Prompts can return multiple messages, including the system role:

Prompts with Embedded Resources

Messages in Prompts can use the embedded_resource type to embed resource data:

When to Use Prompt vs Tool vs Resource


Next Chapter: Security and Authentication — OAuth 2.1 integration and permission management