Zum Inhalt springen

Tools, Resources & Prompts

Knowledge

Every MCP server can provide three types of capabilities. These are called primitives and form the foundation of every MCP integration. Each primitive has a clear purpose and a defined interaction pattern.

Primitive 1: Tools

Tools are functions that the LLM can actively execute. They modify state or perform computations.

Tool Examples:

  • create_issue -- Creates a Jira ticket
  • send_message -- Sends a Slack message
  • run_query -- Executes a database query
  • create_branch -- Creates a Git branch

Tool Definition

A tool is defined on the server using a JSON schema:

server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [
    {
      name: "create_issue",
      description: "Creates a new issue in the project management tool",
      inputSchema: {
        type: "object",
        properties: {
          title: {
            type: "string",
            description: "Title of the issue"
          },
          priority: {
            type: "string",
            enum: ["low", "medium", "high", "critical"],
            description: "Priority of the issue"
          }
        },
        required: ["title"]
      }
    }
  ]
}));

How Tools Are Called

The flow of a tool call:

  1. The LLM recognizes that a tool would be helpful
  2. It sends a tools/call request with the tool name and arguments
  3. The server executes the function
  4. The server sends the result back
  5. The LLM processes the result and responds to the user

iHuman-in-the-Loop

For sensitive tools (e.g., deleting data, sending messages), the Host can ask the user for confirmation before the tool call is executed. This is an important safety feature.

Primitive 2: Resources

Resources are data that the LLM can read -- without changing anything. They extend the LLM's context.

Resource Examples:

  • project://PROJ-123/status -- Current status of a project
  • confluence://page/12345 -- Content of a wiki page
  • git://repo/main/README.md -- File content from a repository
  • metrics://dashboard/sales -- Current sales figures

Resource Definition

server.setRequestHandler(ListResourcesRequestSchema, async () => ({
  resources: [
    {
      uri: "project://current/sprint",
      name: "Current Sprint",
      description: "Status and tasks of the current sprint",
      mimeType: "application/json"
    }
  ]
}));

Primitive 3: Prompts

Prompts are predefined prompt templates that the server provides. They help users formulate recurring tasks efficiently.

Prompt Examples:

  • code-review -- Template for structured code review
  • bug-report -- Template for bug reports with all necessary information
  • meeting-summary -- Template for summarizing meeting notes

Prompt Definition

server.setRequestHandler(ListPromptsRequestSchema, async () => ({
  prompts: [
    {
      name: "code-review",
      description: "Structured code review for a pull request",
      arguments: [
        {
          name: "pr_number",
          description: "Number of the pull request",
          required: true
        },
        {
          name: "focus",
          description: "What should the review focus on?",
          required: false
        }
      ]
    }
  ]
}));

How Prompts Are Used

Unlike Tools, Prompts are selected by the user, not by the LLM. In Claude Desktop, for example, you can find them via the / menu:

User: /code-review pr_number=42 focus=security

-> The server delivers a prepared prompt template:

"Perform a code review for PR #42.
Focus: Security
Check for:
- SQL Injection
- XSS vulnerabilities
- Insecure dependencies
- Missing input validation"

Understand

Difference between Tools and Resources

AspectToolsResources
PurposeExecute actionsProvide data
Side effectsYes (modify state)No (read only)
Triggered byLLM decidesLLM or user
AnalogyPOST/PUT/DELETEGET

The Three Primitives Working Together

A single MCP server often combines all three primitives. Here's an example for a GitHub MCP server:

PrimitiveExamples
Toolscreate_issue, merge_pr, create_branch
Resourcesrepo://owner/name/README.md, pr://123/diff
Promptscode-review, release-notes, bug-triage

An MCP server provides access to the current sprint status in Jira. Is this a Tool or a Resource?

Apply

Complete the MCP tool definition:

{ name: "send_message", description: "Sends a message to a Slack channel", inputSchema: { type: "", properties: { channel: { type: "string" }, text: { type: "string" } } } }

Match the examples to the correct MCP primitive:

Code review template
Read sprint status
Create a Jira ticket
Send a Slack message
Tool
 
Resource
 
Prompt
 
Tool
 

Reflect

Tools, Resources, and Prompts form the three primitives of MCP: executing actions, reading data, and providing templates. Together, they cover all interaction patterns an AI agent needs with external systems. In the next section, you will build your own MCP server.