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 ticketsend_message-- Sends a Slack messagerun_query-- Executes a database querycreate_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:
- The LLM recognizes that a tool would be helpful
- It sends a
tools/callrequest with the tool name and arguments - The server executes the function
- The server sends the result back
- 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 projectconfluence://page/12345-- Content of a wiki pagegit://repo/main/README.md-- File content from a repositorymetrics://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 reviewbug-report-- Template for bug reports with all necessary informationmeeting-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
| Aspect | Tools | Resources |
|---|---|---|
| Purpose | Execute actions | Provide data |
| Side effects | Yes (modify state) | No (read only) |
| Triggered by | LLM decides | LLM or user |
| Analogy | POST/PUT/DELETE | GET |
The Three Primitives Working Together
A single MCP server often combines all three primitives. Here's an example for a GitHub MCP server:
| Primitive | Examples |
|---|---|
| Tools | create_issue, merge_pr, create_branch |
| Resources | repo://owner/name/README.md, pr://123/diff |
| Prompts | code-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:
Match the examples to the correct MCP primitive:
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.