Intermediate12 min
MCP Resources & Prompts
Resources, Prompts, and Elicitation are the three MCP primitives engineers most often skip. Here's what they're actually for, when to reach for each, and what breaks in production when you ignore them.
Quick Reference
- →Resources = read-only data (schemas, configs, docs) — discover with session.list_resources(), read with session.read_resource(uri)
- →LangChain adapter: client.get_resources(server_name) fetches all resources as Blobs — it reads content, not lists metadata
- →Prompts = reusable templates — discover with session.list_prompts(), load with client.get_prompt(server, name, args)
- →Elicitation = server pauses a tool call to request user input — two modes: form (structured data) and URL (OAuth/credentials)
- →Form mode MUST NOT request passwords, API keys, or secrets — use URL mode for any credentials
- →Elicitation returns three actions: accept (with data), decline (explicit no), cancel (dismissed) — handle all three
- →Resource subscriptions let you receive change notifications instead of polling
- →Structured tool responses carry a structuredContent field (JSON) alongside the text fallback
When to Use Resources, Prompts, or Elicitation
Most agents only use MCP tools. That's fine until you have an agent that needs context it shouldn't be able to modify, or prompts that need to change without a redeploy, or a tool call that requires a human decision before proceeding. That's when resources, prompts, and elicitation become load-bearing.
Resources and Prompts deliver data — Tools and Elicitation are interactive
| You need… | Use | Why not the other |
|---|---|---|
| Context the agent shouldn't modify (schema, config, doc) | Resource | Tool: adds write risk and execution overhead. Prompt: templates, not data. |
| A prompt template that should change without redeploying | Prompt | Resource: carries raw data, not message structure. Local: breaks centralized management. |
| User approval or input before a tool executes | Elicitation | interrupt(): agent-initiated, not server-initiated. Tool: executes without stopping. |
| Dynamic per-request data (current DB rows, live API) | Tool | Resource: read-only and cached. Resource is for stable, reference data. |
| Credentials or OAuth flows | Elicitation (URL mode) | Form mode: MUST NOT handle credentials per spec. Tool: credentials would transit MCP client. |