Tools
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
- 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 sendToolListChangedNotification
, 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 thecall_tool
method:
Tool Results
Tool calls return aCallToolResult
object with:
content
: The result data or error messageisError
: Boolean indicating success or failure- Additional metadata about the execution