Get Tools • AI Agent SDK

get_tools: Get the list of tool functions from this MCP instance.

get_tools

Method

</div>

This is a method of the MCP class in the mcp module.

Get the list of tool functions from this MCP instance.

This method provides explicit access to the tools list, which is useful when you need to inspect or manipulate the tools programmatically.

Diagram

uses

returns

Agent

Tool: get_tools

Result

Signature

python
def get_tools() -> List[Callable]

Returns

ResponseField List[Callable]

List of tool functions that can be called

Usage

python
# Point the filesystem server at any directory the agent may access.
    # Use a platform-appropriate path (e.g. "." for the current dir);
    # on Windows npx may need to be invoked as "npx.cmd".
    mcp = MCP("npx -y @modelcontextprotocol/server-filesystem .")
    tools = mcp.get_tools()
    for tool in tools:
        print(f"Tool: {tool.__name__}")

Source

View on GitHub

praisonaiagents/mcp/mcp.py at line 1311


Related Documentation