Prompts: Reusable Templates

Intermediate 🕐 20 min Lesson 6 of 11
What you'll learn
  • Describe what user-controlled means in the context of MCP prompts
  • Explain how prompts/get arguments differ from tool call arguments
  • Identify how MCP prompts surface in Claude Desktop and why description quality matters

The Third Primitive

Having covered tools (model-controlled actions) and resources (application-controlled data), we arrive at the third MCP primitive: prompts. Prompts are reusable templates that encode structured instructions or workflows. They accept named arguments, produce a set of messages ready to inject into a conversation, and are user-controlled — the user explicitly selects which prompt to apply.

The term "prompt" in MCP is specific. It does not mean the system prompt the host uses to configure the model, nor does it mean any arbitrary text. An MCP prompt is a named, versioned, server-defined template with a declared argument schema and a retrieval API. It is discoverable, parameterizable, and standardized.

A practical example: a code review server might expose a prompt named review_pr that takes arguments like language and focus_area. When a user invokes it with /review_pr language=typescript focus_area=security, the server returns a carefully crafted set of messages that set up the model to perform a thorough security-focused TypeScript code review. The user gets expert-level instructions without having to write them, and the server author can update the template without the user changing anything.

Who Controls Prompts

The MCP specification says prompts are user-controlled. This means the user explicitly chooses when to apply a prompt, typically by selecting it from a list or typing a slash command. This distinguishes prompts from tools (which the model activates) and resources (which the application activates).

It is worth noting what "user-controlled" refers to: it is about who decides to use the prompt at a given moment, not who wrote it. The server author writes the prompt template. The user decides to invoke it. The model then acts within the instructions the template sets up.

This control model has practical implications. Because the user explicitly chose the prompt, they have implicitly consented to whatever instructions it injects. This is different from a tool that the model calls autonomously — the user may not have anticipated that call. Prompts are therefore lower risk from a trust perspective, though the server author is still responsible for writing templates that do not manipulate the model in ways the user would not expect.

Listing Prompts

Clients discover a server's prompts by calling prompts/list. Like tool and resource listings, the response is paginated. Each prompt in the list includes:

  • name (required) — the identifier used in prompts/get
  • title (optional) — a human-readable display name
  • description (optional) — explains what the prompt does and when to use it
  • icons (optional) — icons for the host UI
  • arguments (optional) — an array of argument definitions, each with name, description, and required

A prompt with no arguments is always returned identically. A prompt with arguments is a template: different argument values produce different message sets. The argument definitions in the listing tell the host what fields to show in its UI and which are required before the prompt can be fetched.

Retrieving a Prompt

To retrieve a prompt's messages, the client sends a prompts/get request with the prompt name and any argument values:

{
  "jsonrpc": "2.0",
  "id": "9",
  "method": "prompts/get",
  "params": {
    "name": "review_pr",
    "arguments": {
      "language": "typescript",
      "focus_area": "security"
    }
  }
}

The server responds with an optional description and a messages array. Each message has a role ("user" or "assistant") and a content block. The host injects these messages into the conversation at the point where the user invoked the prompt.

{
  "description": "Security-focused TypeScript code review",
  "messages": [
    {
      "role": "user",
      "content": {
        "type": "text",
        "text": "Please review the following TypeScript code with a focus on security vulnerabilities..."
      }
    }
  ]
}

Prompts can produce multi-message sequences, including alternating user and assistant messages that set up a specific conversational context. This is useful for few-shot prompting patterns where examples of ideal outputs need to be established before the actual task.

Content Types in Prompt Messages

Prompt message content supports the same types as tool results: text, image (base64), audio (base64), resource_link, and embedded resource. This means a prompt can inject structured context — for example, a code review prompt might embed the actual diff as a resource block rather than requiring the user to paste it manually. The model receives the diff as structured content rather than as plain text, which improves its ability to reason about the code.

If a prompt needs additional input before it can produce messages — for example, if it needs to ask the user for a file path that was not provided as an argument — it can return an input_required result with an inputRequests field. The client then prompts the user for the additional information and retries the prompts/get call with inputResponses. This multi-round-trip flow keeps the prompt's argument schema simple while allowing for dynamic disambiguation.

Slash Commands in Claude Desktop

In Claude Desktop, MCP prompts surface as slash commands. When a user types / in the message input, Claude Desktop shows a list of available prompts from all connected servers. Selecting one opens an argument input form (for prompts with arguments) or immediately injects the prompt's messages into the conversation.

This UX pattern is why the description field matters for prompts. The description is what the user sees when scanning the slash command list. A good description — concise, specific, action-oriented — helps users find the right prompt quickly. A vague description makes the prompt invisible in practice, even if its implementation is excellent.

As a server author, designing prompts with slash commands in mind improves adoption: short names (review, explain, refactor) are easier to type, and descriptions that start with a verb (Review code for..., Explain the purpose of...) are easier to scan.

Change Notifications

If a server declares "prompts": {"listChanged": true}, it may send notifications/prompts/list_changed when the prompt list changes. Clients that have subscribed to this notification type should re-fetch the prompt list to keep their slash command list current. This matters for servers that add or remove prompts dynamically — for example, a server that generates prompts from a user's note library.

When to Use Prompts vs Tools vs Resources

Choosing the right primitive is an important design decision. The control model is the clearest guide:

Use a tool when...
The model should decide autonomously when to invoke it. The action involves the external world (APIs, files, databases). The model needs to call it as part of reasoning.
Use a resource when...
The host application should decide when to include it. The content is read-only data. The user or application selects it through a UI or heuristic.
Use a prompt when...
The user should explicitly choose when to apply it. The value is reusable structured expertise. The user benefits from parameterizing a known workflow.

A code review server is a good example of all three working together: the prompt sets up the review context, the resource embeds the diff being reviewed, and the tools let the model fetch related files or look up documentation as it works through the review.

Key takeaways
  • Prompts are user-controlled templates — the user explicitly invokes them, unlike tools (model-controlled) or resources (app-controlled)
  • Prompt messages can include any content type, including embedded resources, enabling rich structured context injection
  • In Claude Desktop, prompts appear as slash commands — a short name and a clear verb-first description drive discoverability
Learn more every week Get 5 hand-picked prompts + new AI tools every Monday. Free.