Parameterized Resource URIs
Capture variables straight from the URI path.
Parameterized Resource URIs is a free MCP Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the MCP Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
One Pattern, Many Resources
A static resource has one fixed address. A parameterized URI is a pattern that stands in for a whole family of resources at once. ✨
Placeholders in Curly Braces
You mark the variable part of a URI with a placeholder in curly braces, like users://{user_id}/profile. That brace is a slot to fill.
users://{user_id}/profileThe Template Is a Promise
A resource template tells the client: any URI matching this shape is valid. The model can plug in real values to ask for exactly what it needs.
Decorate to Register
In the Python SDK you register a template the same way as a tool: with the @mcp.resource decorator, passing the URI pattern as its argument.
@mcp.resource("users://{user_id}/profile")
def get_profile(user_id: str) -> str:
return f"Profile for {user_id}"Names Must Match
Every placeholder in the URI must appear as a function parameter with the same name. The SDK wires {user_id} straight into your user_id argument.
Capture More Than One
You can capture several variables in one URI. Multiple placeholders each map to their own parameter, so one pattern can pinpoint very specific data.
@mcp.resource("repos://{owner}/{name}/readme")
def readme(owner: str, name: str) -> str:
return load_readme(owner, name)Values Arrive as Strings
Captured pieces come in as text from the URI. If you need a number, convert it yourself inside the function before using it.
def get_page(page: str) -> str:
n = int(page)
return render_page(n)One Segment Per Placeholder
By default a placeholder captures a single path segment, the text between two slashes. It stops at the next slash, so it won't swallow the rest of the path.
Templates Don't List Themselves
A plain resource shows up in the resource list. A templated resource usually does not, since there are endless possible URIs. The client reads it by filling the pattern.
Keep URIs Meaningful
Design URIs that read like clear addresses, such as weather://{city}/today. A model picks the right resource far more reliably when the path explains itself.
weather://{city}/todayWhy This Matters
Parameterized URIs let one tidy function serve thousands of resources. You write the shape once, and the variable parts do the rest. 🎯
Quick Check
How does a captured URI placeholder reach your function?
Recap
You learned that parameterized URIs use curly-brace placeholders to serve a whole family of resources, each one mapped to a matching function parameter. Next: building their content. 🚀
Frequently asked questions
Is the “Parameterized Resource URIs” lesson free?
Yes — the full text of “Parameterized Resource URIs” is free to read here on the web, and the MCP Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the MCP Academy course, upgrade to CoddyKit PRO.
What will I learn in “Parameterized Resource URIs”?
Capture variables straight from the URI path. You practise MCP Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start MCP Academy?
No prior experience is required. MCP Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Parameterized Resource URIs” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this MCP Academy lesson?
Yes. Every MCP Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Parameterized Resource URIs
- Build Content at Read Time
- List vs Templated Resources
- Notify Clients of Updates