Skip to content
mentoor

Topic 3 of 5 · 5 min read

Tools, resources and prompts as server primitives

Goal: Classify a list of server capabilities into tools, resources or prompts and fix one that was exposed as the wrong primitive.

An MCP server offers three kinds of capability, and each has a different controller: the model calls tools, the application reads resources, and the user picks prompts.

Check yourself · 1 of 3

Which MCP primitive is controlled by the model, which decides when to call it?

Choose one answer

Why it matters

Exposing a capability as the wrong primitive makes it awkward or unsafe. A report that the user wants to attach to a chat does not belong in a tool the model may call at any moment. A write operation does not belong in a resource that the host might fetch silently. The official server-concepts page defines the split.

The three primitives

Primitive What it is Who controls it Protocol methods
Tool A function with a typed input schema that can act: search, write, send The model decides when to call it tools/list, tools/call
Resource Read-only data identified by a URI: a file, a schema, a document The application decides what to load resources/list, resources/read
Prompt A reusable instruction template with arguments The user chooses it, often as a slash command prompts/list, prompts/get

How to classify a capability

  1. Does it change something or compute on demand? Then it is a tool. Creating a ticket, running a query with parameters and sending a message are tools.
  2. Is it content that gives context and can be named by a URI? Then it is a resource. A database schema at postgres://db/schema or a file at file:///repo/README.md fits.
  3. Is it a starting point the user should trigger, with fixed instructions around some arguments? Then it is a prompt. "Review this pull request" with a pr_number argument is a prompt.

If two answers fit, ask who should start it. The model, the application or the person?

Before and after

A server author exposed the team style guide as a tool called get_style_guide. The model calls it on every request, even for unrelated questions, and each call adds the full text to the context.

Better: publish it as a resource at docs://style-guide so the host or user can attach it when relevant. Add a prompt review_with_style_guide that the user invokes explicitly.

{
  "name": "review_with_style_guide",
  "description": "Review a diff against the team style guide",
  "arguments": [{ "name": "diff", "required": true }]
}

What goes wrong

  • Everything becomes a tool. The model sees dozens of tools, picks wrongly and spends context on descriptions.
  • A write hidden in a resource. Reads should have no side effects, because hosts may fetch resources without asking.
  • Prompts treated as system prompts. A prompt is a template the user selects; the server cannot force it into the conversation.
  • Assuming all three are supported. Hosts differ. Many clients support tools first, so check the host before relying on prompts or resources.

Examples

Classifying a ticketing server

create_ticket(title, body)     -> tool: changes state
tickets://open                -> resource: read-only list of open tickets
triage_checklist(ticket_id)   -> prompt: user-started template
run_report(from, to)          -> tool: computes from parameters

The two functions with side effects or parameters are tools, the list is a resource and the checklist is a prompt.

Wrong primitive, fixed

A server exposes a read_resource_and_archive tool described as read-only, and a resource logs://today that deletes old log files when read. Both break the contract. Move archiving to a tool with an honest destructive annotation, and make logs://today a pure read.

Key points

  • Tools are model-controlled functions, resources are application-controlled read-only data, and prompts are user-controlled templates.
  • If a capability changes state or computes from parameters, make it a tool; if it is nameable context, make it a resource.
  • Reading a resource must have no side effects, because a host may fetch it without asking the user.
  • Prompts are chosen by the user, for example as slash commands, and are not injected by the server.
  • Hosts support the primitives unevenly, so confirm support before relying on resources or prompts.

Common mistakes

  • Turning every capability into a tool because tools are the best-supported primitive.
  • Giving a resource read a side effect such as deleting, locking or logging a user action.
  • Treating prompts as server-controlled system instructions instead of user-selected templates.
  • Writing tool descriptions that overlap, so the model cannot tell which one to call.

Check yourself · 2 of 3

A server exposes the database schema through a tool called get_schema that the model calls on every turn. What is the better design?

Choose one answer

Check yourself · 3 of 3

A server author writes a resource whose read also marks the document as seen and sends a read receipt. Why is that a design bug?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic