MCP Resources and Prompts: Beyond Tools

A
Author
15 Aug, 2026 1 min read 907 views

Most MCP tutorials stop at tools, but the protocol has three server primitives, each controlled by a different party:

  • Tools - the model decides when to call them.
  • Resources - the application (or user) decides what data to attach.
  • Prompts - the user explicitly picks them, like a slash command.

Static resources

server.registerResource(
  'db-schema',
  'schema://main',
  { title: 'Database schema', description: 'Tables and columns of the main database', mimeType: 'text/plain' },
  async (uri) => ({
    contents: [{ uri: uri.href, text: await describeSchema() }],
  })
);

Resource templates

Templates expose a whole family of resources through a URI pattern:

import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';

server.registerResource(
  'customer',
  new ResourceTemplate('customers://{id}', { list: undefined }),
  { title: 'Customer record', mimeType: 'application/json' },
  async (uri, { id }) => ({
    contents: [{ uri: uri.href, text: JSON.stringify(await db.customers.find(id)) }],
  })
);

Prompts

Prompts package a workflow the user triggers by name, with arguments:

server.registerPrompt(
  'review-migration',
  {
    title: 'Review a SQL migration',
    description: 'Check a migration for locking, data loss and missing indexes',
    argsSchema: { sql: z.string() },
  },
  ({ sql }) => ({
    messages: [
      {
        role: 'user',
        content: { type: 'text', text: `Review this PostgreSQL migration for long locks, data loss and missing indexes:\n\n${sql}` },
      },
    ],
  })
);

Choosing the right primitive

  • "The model should decide to do this" -> tool.
  • "The user should be able to attach this as context" -> resource.
  • "Users run this same task often" -> prompt.

Support for resources and prompts varies between host applications, so check what your target hosts display. Tools are the most widely supported.

Was this article helpful?

Comments

No comments yet. Have a question or a tip? Be the first to share it.

Leave a comment

Comments are reviewed before they appear.