Skip to main content
Tools in MCP are server-implemented functions that enable AI models to perform specific actions. They represent capabilities that a server exposes to clients, allowing AI applications to interact with external systems, execute commands, or manipulate data.

What are Tools?

Tools are well-defined functions with:
  • JSON Schema definitions that specify their inputs and outputs
  • Single, focused operations that perform one specific task
  • User approval requirement before execution for security
Common examples include:
  • File operations (read, write, delete)
  • Web browsing and data fetching
  • Database queries
  • API calls to external services
  • System commands

Listing Available Tools

To see what tools are available from a connected MCP server:

Automatic Tool List Update

When servers send ToolListChangedNotification, it signals that the tool list has changed. The list_tools() method always fetches fresh data from the server, ensuring you get up-to-date information. Important: Always use await session.list_tools() instead of the deprecated session.tools property to ensure you get fresh data:

Calling Tools

Tools are executed using the call_tool method:

Tool Results

Tool calls return a CallToolResult object with:
  • content: The result data or error message
  • isError: Boolean indicating success or failure
  • Additional metadata about the execution

Error Handling

Always handle potential errors when calling tools: