
This page is part of our MCP specification reference, a plain-English guide to the Model Context Protocol spec (version 2026-07-28), within The MCP Guide. Building a server? See MCP development.
An MCP resource template is a pattern for a family of resources, written as a URI template like file:///{path}. Instead of listing every file or record one by one, a server publishes the pattern. The client fills in the variables to build a concrete URI, then reads it with resources/read.
Status in the 2026-07-28 spec: core. Templates are part of the Resources feature and have existed since the first dated spec, 2024-11-05.
Templates solve a scale problem. A server with a million customer records cannot list them all, but it can publish one template. This page is based on the 2026-07-28 Resources page and schema, checked on 28 October 2026.
Key Takeaways
- A resource template is a parameterized resource described by a URI template that follows RFC 6570.
- Clients discover templates with
resources/templates/list, which supports pagination and, as of 2026-07-28, caching hints. - A template has a
uriTemplate, aname, and optionaltitle,description,mimeType,iconsand annotations. - Template arguments can be auto-completed with the
completion/completerequest, if the server supports completions. - Reading still happens through
resources/readwith a concrete URI, so servers must validate every expanded URI.
What a resource template is
RFC 6570 defines a URI template as a compact string that describes a range of URIs by substituting variables. For example, {var} with var set to "value" expands to value.
MCP uses that standard. The spec says resource templates "allow servers to expose parameterized resources using URI templates." The schema defines uriTemplate as "a URI template (according to RFC 6570) that can be used to construct resource URIs."
A template definition includes:
| Field | Required | Purpose |
|---|---|---|
uriTemplate | Yes | The RFC 6570 pattern |
name | Yes | Programmatic name |
title | No | Display name for people |
description | No | What the template is for; a hint to the model |
mimeType | No | Type for all matching resources, only if they all share it |
icons | No | Images for the interface |
annotations | No | Audience, priority, last modified |
The mimeType rule is worth noting. The schema says to include it "only if all resources matching this template have the same type."
Why templates exist
A plain resources/list works for a handful of fixed items. It breaks down for large or open-ended data, like every file in a repository or every order in a store.
Templates let a server say "you can read any order by ID" in one entry. The host app can then build a form, a search box or an auto-complete field around the variables. That fits the application-driven model for resources.
How it works
Listing templates
The client sends resources/templates/list. Here is a response adapted from the spec example (icons removed):
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"resultType": "complete",
"resourceTemplates": [
{
"uriTemplate": "file:///{path}",
"name": "Project Files",
"title": "Project Files",
"description": "Access files in the project directory",
"mimeType": "application/octet-stream"
}
],
"nextCursor": "next-page-cursor",
"ttlMs": 300000,
"cacheScope": "public"
}
}
The 2026-07-28 page says this operation supports pagination and caching. The ttlMs and cacheScope fields are required on resources/templates/list results, per the 2026-07-28 changelog.
Filling in the variables
The client, often with the user's help, fills the variables. For file:///{path}, the path src/main.rs gives file:///src/main.rs. The client then sends a normal resources/read with that URI.
Auto-completing arguments
The spec says template arguments "may be auto-completed through the completion API." The client sends completion/complete with a reference of type ref/resource and the template URI. The server returns up to 100 suggestions. Our guide to MCP argument completion covers the details.
An illustrative example, using the spec's reference format:
{
"method": "completion/complete",
"params": {
"ref": { "type": "ref/resource", "uri": "file:///{path}" },
"argument": { "name": "path", "value": "src/ma" }
}
}
What changed across spec versions
| Version | Change |
|---|---|
| 2024-11-05 | Templates defined with uriTemplate, name, description, mimeType; list supports pagination (2024-11-05 Resources) |
| 2025-06-18 | title added to templates and other named objects (changelog) |
| 2025-11-25 | Icons added for resource templates (changelog) |
| 2026-07-28 | resultType and required caching hints on the list result; completion reference described as "a resource URI or URI template" |
The core idea has not changed since 2024. Most changes added display metadata or followed protocol-wide updates like caching and the stateless design described in why MCP became stateless.
Common mistakes
- Trusting the expanded URI. A template is a hint, not a filter. Users or models can send any URI to
resources/read. The spec says servers MUST validate all resource URIs and sanitize file paths to prevent directory traversal. - Setting
mimeTypeon a mixed template. If a template can return both images and text, leavemimeTypeoff. - Expecting templates in
resources/list. Templates come from their own method,resources/templates/list. - No completion support for big value sets. If users must guess IDs, the template is hard to use. Declare the
completionscapability and suggest values. - Leaking data through completion. The completion spec says implementations must control access to sensitive suggestions. Do not suggest record IDs the caller cannot read.
Read the MCP security center for more on path traversal and access control. Our Learn MCP lesson on adding resources shows templates in code.
Next step
Once a client reads a resource, it may want to know when it changes. Read MCP resource subscriptions next, or return to the MCP specification reference.
Frequently asked questions
What is a URI template in MCP?
It is a pattern with variables in braces, such as file:///{path}, defined by RFC 6570. Clients substitute values for the variables to build a concrete resource URI.
How do clients find resource templates?
They send resources/templates/list. The result lists templates and may include a nextCursor for more pages. In 2026-07-28 it also includes caching hints.
Do resource templates appear in resources/list?
No. Templates have their own list method. resources/list returns concrete resources with fixed URIs.
Can users get suggestions while filling a template?
Yes, if the server declares the completions capability. The client sends completion/complete with a ref/resource reference and gets up to 100 suggestions per response.
Are resource templates new in the 2026-07-28 spec?
No. They were already in the 2024-11-05 spec. Later versions added titles, icons, result types and caching hints.











