Skip to main content

Tools: Building AI Capabilities

Tool Basics

0:00
LearnStep 1/4

The @mcp.tool Decorator

Creating Tools with @mcp.tool

Tools are functions that AI can call. The @mcp.tool decorator registers your function with the MCP server.

Basic Syntax

python

Anatomy of a Tool

  • @mcp.tool: Registers the function
  • Function name: Becomes the tool name
  • Parameters: Become tool inputs (with types!)
  • Docstring: Becomes the tool description
  • Return type: Defines what the tool returns

Decorator Options

python