Week 14 • Day 2Week 14
Day 2:Week 14, Day 2: The Three `MCP` Primitives — `Resources` (URIs), `Tools` (Schemas) & `Prompts` (Templates)
Battle-tested daily lesson note • 100% runnable code, interview Q&A, test suite & interactive quiz
Week 14, Day 2: The Three MCP Primitives — Resources (URIs), Tools (Schemas) & Prompts (Templates)
1. Understanding the Three Core Primitives of an MCP Server
Many developers only use MCP for Tools, missing two-thirds of the protocol's power! Each MCP primitive has a distinct Control Model:
| Primitive | Controlled By | Purpose & Analogy | MCP JSON-RPC Methods |
|---|---|---|---|
1. Resources | Application-Controlled (Host / User attaches context) | Read-only data addressed by URI (e.g., runbook://payments/502, postgres://schema/orders). Like HTTP GET — zero side effects! | resources/list, resources/read |
2. Tools | Model-Controlled (LLM decides when to invoke) | Executable functions with JSON Schema inputs that compute or mutate state (e.g., restart_pod, query_metrics). Like HTTP POST! | tools/list, tools/call |
3. Prompts | User-Controlled (Slash commands / UI templates) | Pre-built, parameterized prompt workflows exposed by the server (e.g., /triage_incident(service="payments-api")). | prompts/list, prompts/get |
In Simple English: The 3 Buttons Inside Every MCP Server (Resources, Tools, Prompts)
Every MCP Server exposes up to 3 clean building blocks:
- Resources (Read-Only Files / Knowledge — like HTTP
GET): Safe, zero-side-effect data identified by URIs likerunbook://payments/cacheorlogs://pod-7f9. - Tools (Executable Actions — like HTTP
POST): Actions the LLM can invoke with typed parameters (restart_worker(service="billing"),run_sql_readonly(query=...)). - Prompts (Saved Workflow Templates): Reusable playbooks owned by the server (
"Postmortem Incident Summary") that users trigger via slash commands (/postmortem).