Skip to main content
Resources expose content that clients can discover and read by URI. Use a resource when the client should inspect data without invoking an action-oriented workflow. This guide focuses on when and how to register resources. Use the Resources API reference for exact definition fields, callback signatures, MIME behavior, annotations, and return types.

Choose static resources or templates

Use a static resource for one known URI. Use a resource template when the URI contains a variable segment. Resources are best for readable content. If the model should decide to perform work, use a tool instead.

Register a static resource

Register a static resource when the URI is fixed and the callback can return the current content for that URI.
Use stable URI schemes that describe your domain, such as inventory://, docs://, or app://. Keep the URI meaningful enough that a client can display it without extra context.

Register a resource template

Register a resource template when clients should read many related resources through one URI pattern.
Template parameters are extracted from the URI and passed to the callback. Keep parameter names descriptive, because clients may expose them in autocomplete or resource pickers.

Add autocomplete for template parameters

Use completion callbacks when a client can help users choose valid URI values.
Use list-based completion for small fixed sets. Use callback-based completion when suggestions depend on live data or another argument.

Return content with helpers

Use response helpers to return resource content. They set the MCP-compatible content shape and MIME metadata for common cases.
See Response Helpers for a chooser and Response helpers API reference for exact MIME and return behavior.

Notify clients when resources change

When a resource changes after clients have listed or subscribed to resources, notify clients so they can refresh.
Use sendResourcesListChanged() when the set of available resources changes. Use notifyResourceUpdated(uri) when content at an existing URI changes and subscribers should read it again. See Resource Subscriptions and Notifications for update workflows.

Test resources locally

Run the development server and inspect resources in the Inspector.
Open http://localhost:3000/inspector, select the Resources tab, read each resource, and test both successful reads and not-found cases.

Next steps

Resources API reference

Look up resource definitions, callback signatures, template types, and annotations.

Response Helpers

Choose helpers for text, JSON, Markdown, media, and mixed content.

Resource Subscriptions

Notify subscribed clients when resource content changes.

Tools

Use tools for actions, lookups, mutations, and workflows.