Tools vs resources vs prompts in MCP: what is the difference, and who controls each one?
Advertisement
🧩 Scenario
Concept Walkthrough
The one question that separates them: who decides?
All three primitives are exposed by a server and discovered by the client. The spec separates them by who is in control:
| Primitive | Controlled by | Typical UI |
|---|---|---|
| Tools | The model | Model decides to call, host may ask for approval |
| Resources | The application (host) | File picker, attachments, auto-included context |
| Prompts | The user | Slash commands, menu items |
A React way to think about it: tools are like event handlers the model can trigger, resources are like props the parent component passes down, and prompts are like preset buttons the user clicks.
Tools: actions the model can request
Tools have a name, description, input schema and optional output schema. The client lists them with tools/list and runs them with tools/call. Results carry a content array, optional structuredContent, and isError for execution failures. Because the model chooses when to call them, tools are where side effects live, and where you need validation, permissions and human approval for risky actions. The spec says there should always be a human able to deny a tool invocation.
Resources: context the app attaches
Resources are identified by URIs, such as file:///repo/.eslintrc.json or config://app. The client lists them with resources/list, discovers parameterised ones through resources/templates/list, and fetches content with resources/read. The host decides how to use them: show them in a picker, attach them because the user selected them, or include them automatically. They should be read-only. A read that changes state breaks the mental model and surprises both the host and the user.
Prompts: templates the user picks
Prompts are named templates with optional arguments. The client lists them with prompts/list and fetches one with prompts/get, which returns ready-made messages. The host inserts them when the user picks them, for example /review-pr 1234. They are a way for a server author to ship good, tested instructions instead of hoping each user writes them well.
Applying it to the scenario
- Create a GitHub issue: a tool, because it is an action and the model should decide when it is needed.
- Current ESLint config: a resource, because it is read-only context the app or user attaches.
- "Review this PR" shortcut: a prompt, because the user explicitly starts it.
Key Code Explained (TypeScript)
import { McpServer } from '@modelcontextprotocol/server';
import * as z from 'zod/v4';
import { readFile } from 'node:fs/promises';
const server = new McpServer({ name: 'monorepo', version: '1.0.0' });
// Resource: read-only, addressed by URI, chosen by the host or user
server.registerResource(
'eslint-config',
'config://eslint',
{
title: 'ESLint config',
description: 'The shared ESLint config for the monorepo',
mimeType: 'application/json',
},
async (uri) => ({
contents: [{ uri: uri.href, text: await readFile('eslint.config.json', 'utf8') }],
}),
);
// Prompt: user-selected template with arguments, returns messages
server.registerPrompt(
'review-pr',
{
description: 'Review a pull request for React and accessibility issues',
argsSchema: z.object({ prNumber: z.string() }),
},
({ prNumber }) => ({
messages: [
{
role: 'user' as const,
content: {
type: 'text' as const,
text: `Review PR #${prNumber}. Focus on hooks rules, re-renders and a11y.`,
},
},
],
}),
);
// Tool: model-controlled action with side effects (registration not shown)
// server.registerTool('create-issue', { description, inputSchema }, handler)
On the host side, an MCP client reads the resource with client.readResource({ uri: 'config://eslint' }) and fetches the prompt with client.getPrompt({ name: 'review-pr', arguments: { prNumber: '1234' } }). Neither call involves the model deciding anything. Only tools go through the model's choice.
Tradeoffs
| Decision | Benefit | Cost |
|---|---|---|
| Expose data as a tool | Model fetches it only when needed | Model may forget to look, or call it too often |
| Expose data as a resource | Predictable, user or host controlled context | Host must build UI or logic to attach it |
| Expose both | Works in hosts with and without resource support | Two code paths to keep in sync |
| Ship a prompt | Consistent, tested instructions for users | Only useful if the host shows prompts |
What Interviewers Actually Check
- Whether you explain the difference by control, not just by data shape
- Whether you keep side effects in tools and keep resources read-only
- Whether you know prompts are user-selected templates, not hidden system prompts
- Whether you can map real features to the right primitive with a reason
- Whether you are aware that host support for resources and prompts varies
Follow-Up Questions
- How would a host decide which resources to include automatically without blowing the context window?
- What is a resource template, and when would you use one instead of listing every resource?
- How should a host handle a tool and a resource that return the same data?
- Why might you return structuredContent from a tool instead of plain text?
- How would you show MCP prompts as slash commands in a React chat input?
Common Candidate Mistakes
- Saying "they are all basically tools". The control model is the difference.
- Designing a resource whose read triggers a write or an expensive job.
- Treating prompts as something the model reads on its own.
- Building a resource-heavy server for a host that only supports tools.
- Forgetting that a tool result is untrusted text that goes back into the model.
Interview Readiness Checklist
Before you leave this question, make sure you can answer:
- Can you say who controls tools, resources and prompts?
- Can you classify five features of your current app into the three primitives?
- Can you name the list and use methods for each primitive?
- Can you register a resource and a prompt with the SDK?
- Can you explain why the choice affects safety and UX?
Summary
Tools, resources and prompts are the three things an MCP server can expose, and the key difference is control. Tools are model-controlled actions, discovered with tools/list and run with tools/call, and they are where side effects, validation and approval belong. Resources are read-only, URI-addressed context that the host application decides to include, fetched with resources/read. Prompts are user-controlled templates, fetched with prompts/get and usually shown as slash commands. Choose the primitive by asking who should decide when it is used: the model, the app, or the user.
Can a tool return the same data a resource would?
Yes, and many servers do both. The difference is control. A tool lets the model fetch data whenever it decides it needs it. A resource lets the host or the user attach that data deliberately, for example from a file picker, so it does not depend on the model choosing to look.
Are MCP prompts the same as a system prompt?
No. An MCP prompt is a named template on the server that returns one or more messages, usually with arguments. The user selects it, the client fetches it with prompts/get, and the host inserts the messages into the conversation.
Do all hosts support resources and prompts?
Not always. Tools are the most widely supported primitive. Resource and prompt support depends on the host, so check what your target hosts actually render before designing around them.
Advertisement
Stay Updated
Get the latest frontend challenges, interview questions and tutorials delivered to your inbox.
Advertisement