Tools

Executable functions that MCP servers expose to clients, enabling LLMs to perform actions, interact with external systems, and modify state in the real world.

Tools

Tools are executable functions that MCP servers expose to clients, enabling LLMs to perform actions and interact with external systems. Tools are model-controlled, designed for AI models to automatically invoke with human approval.

Tool Structure

Component Purpose
Name Unique identifier for the tool
Description Human-readable explanation of functionality
Input Schema JSON Schema defining required parameters
Annotations Metadata about tool behavior and side effects

Tool Categories

  1. System Operations - Execute shell commands, manage files
  2. API Integrations - Create GitHub issues, send emails
  3. Data Processing - Analyze CSV files, transform data
  4. Database Operations - Query records, update tables

Tool Annotations

Tools include helpful metadata hints:

{
  "annotations": {
    "title": "Human-friendly display name",
    "readOnlyHint": true,      // Doesn't modify environment
    "destructiveHint": false,   // May perform destructive updates  
    "idempotentHint": true,     // Repeated calls have no additional effect
    "openWorldHint": false      // Interacts with external entities
  }
}

Discovery and Execution

// List available tools
{
  "method": "tools/list"
}

// Execute a tool
{
  "method": "tools/call", 
  "params": {
    "name": "create_file",
    "arguments": {
      "path": "/tmp/example.txt",
      "content": "Hello world"
    }
  }
}

Error Handling

Tools report errors within result objects (not protocol-level errors):

  • Set isError: true in response
  • Include error details in content array
  • Allows LLM to see and handle errors

Related Terms

  • MCP Server
  • Resources
  • MCP Client
© 2025 👨‍💻 with ❤️ by Full Stack Craft
"Any sufficiently advanced technology is indistinguishable from magic."