MCP Prompts

MCP Prompts register reusable instruction templates in your server -- with parameters. Build a code review prompt that enforces a style guide and see how prompts differ from resources.

April 1, 20267 min read6 / 7

You've seen tools (LLM calls them) and resources (user attaches them). The third primitive is prompts -- canned instruction templates that users can invoke from within the client, optionally with parameters.


Tools vs Resources vs Prompts

Before diving in, let's anchor the distinction clearly:

Diagram

A prompt is like a fill-in-the-blank instruction card. You define the template in your MCP server. The user triggers it from the client with their own parameters.

ℹ️ Brian's take: "Prompts feel like we're splitting hairs with resources. I agree. The intention behind keeping them separate is: resources are more content, prompts are more commands. You'll find real use for them in team contexts -- shared prompt libraries everyone can access."

A Practical Use Case: Code Review

Imagine your team uses the Airbnb JavaScript style guide. Everyone on the team does code reviews differently. Some catch style issues, some don't.

An MCP prompt can standardize this:

  1. Register a review-code prompt in your server
  2. The prompt includes the entire Airbnb style guide as context
  3. Any team member connects to your server, invokes the prompt, pastes the code
  4. Every review is done against the same ruleset
Diagram

Building the Style Checker

First, create a style guide file. Brian uses the Airbnb JavaScript guide (4000+ lines of markdown), but Standard JS is a shorter option:

Bash
# Create the file: touch style-guide.md # Paste your style guide content into it

Then build the server:

JavaScript
// style-checker.js import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { z } from "zod"; import { readFileSync } from "fs"; // Load the style guide at server startup const styleGuidePath = "/full/path/to/your/style-guide.md"; const styleGuideMarkdown = readFileSync(styleGuidePath, "utf-8"); const server = new McpServer({ name: "code-review-server", version: "1.0.0", }); server.registerPrompt( "review-code", // prompt name { title: "Code Review", description: "Review code against our team style guide", argsSchema: { code: z.string().describe("The code to review"), } }, async ({ code }) => ({ messages: [ { role: "user", content: { type: "text", text: `Please review this code to see if it follows our best practices. Use this style guide as a reference for the rules: ================================================== ${styleGuideMarkdown} ================================================== Here is the code to review: ${code}`, } } ] }) ); const transport = new StdioServerTransport(); await server.connect(transport);

Anatomy of registerPrompt

Diagram

The Messages Return Shape

The handler returns an array of { role, content } objects -- exactly like a chat API message array:

JavaScript
return { messages: [ { role: "user", // or "assistant" content: { type: "text", text: "Your prompt content here" } } ] };

This looks like writing a ChatGPT API call -- because it is the same pattern. MCP reuses the chat message format.


Using Prompts in Claude Desktop

⚠️ Tome does not support prompts -- only Claude Desktop and other full-spec clients.
  1. Open a new chat
  2. Click the + icon
  3. You'll see "Use prompt from [server-name]"
  4. Select your prompt
  5. Fill in the parameters (the code you want reviewed)
  6. Submit -- the prompt is injected into the conversation

Lab -- Understand the Prompt Format

JavaScript · Live Editor
Loading editor...
✅ The LLM's response to this prompt will identify the violations: var should be const, the anonymous function should be an arrow function, and the explicit return is unnecessary when the body is a single expression.

Lab 2 -- Multi-Parameter Prompt

JavaScript · Live Editor
Loading editor...

Real-World Prompt Use Cases

Beyond code review, prompts shine for:

Team onboarding: Register a create-component prompt that follows your team's component structure. New team members use the same template as veterans.

Issue creation: Register create-bug-report with fields for steps to reproduce, expected vs actual behavior. Every bug report is structured the same way.

PR reviews: Like the lab above -- standardized review criteria for your team.

Devin / AI coding agents: If you use Devin (an AI that opens GitHub issues and PRs), you can provide prompts for how it should structure its work.

ℹ️ Shared team MCP servers: The most powerful use of prompts is when a team runs a shared MCP server on internal infrastructure. Every team member connects to it and gets the same prompt library. Prompts become institutional knowledge -- consistent, versioned, and accessible.

Key Takeaways

  • Prompts = user-triggered instruction templates with optional parameters
  • Different from resources -- resources are content, prompts are commands
  • Return format is { messages: [{ role, content }] } -- same as chat API
  • Best use cases: code review standards, team conventions, structured tasks, PR descriptions
  • Tome doesn't support prompts -- Claude Desktop required
  • Think team-scale: prompts become most valuable as shared, versioned team knowledge

What's Next

You've now covered all three MCP primitives. Before moving to a real-world project, let's look at three advanced MCP features that are still in progress: Roots, Sampling, and Elicitation.