Resources
Expose read-only data sources as MCP resources to provide context to AI models.
What are Resources?
Resources are a standardized way for MCP servers to expose read-only data to clients. They provide contextual information that can help AI models understand your application, such as files, database schemas, configuration, or any data accessible via a URI.
Scaffold a new MCP resource
Key concept: Unlike tools which are invoked directly by the AI to perform actions, resources are application-driven. The host application (not the AI) decides when and how to fetch and include resource content in the conversation.
Each resource is uniquely identified by a URI (e.g., file:///project/README.md or api://users/123).
Resources vs Tools
Understanding the difference between resources and tools is essential:
| Aspect | Resources | Tools |
|---|---|---|
| Purpose | Provide context and data | Perform actions |
| Invocation | Application-driven (user or app selects) | AI-driven (model decides to call) |
| Nature | Read-only data access | Can read and modify state |
| Control | User/application controls what's included | AI decides when to use |
| Examples | Files, configs, DB schemas, logs | Send email, create file, query API |
When to use resources:
- Exposing project files or documentation
- Sharing database schemas or configurations
- Providing logs or system information as context
When to use tools:
- Performing actions that modify state
- Executing operations the AI should decide to trigger
- Interacting with external APIs or services
How Resources are Used
Resources follow an application-driven model. The typical flow:
- Discovery — the host application calls
resources/listto discover available resources. - Selection — the host displays resources in a UI (tree view, search, list) and the user (or application logic) picks which ones to include.
- Reading — the host fetches the selected URIs via
resources/read. - Context inclusion — the host injects the contents into the AI conversation as context.
The AI model never directly requests resources. It's always the application that decides which resources to include based on user selection, heuristics, or automatic context detection.
Guides
If you are new to MCP in Nuxt, start with Tools — resources complement tools but follow a different discovery model.