tool_name_prefix.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your OpenAI API key
4
Run the example
Save the code above as
tool_name_prefix.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Add a prefix to the name of your MCP tools.
"""This example demonstrates how to add a prefix to the name of your MCP tools.
This is useful to avoid name collisions with other tools, especially when using multiple MCP servers."""
import asyncio
from agno.agent.agent import Agent
from agno.tools.mcp import MCPTools
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
async def run_agent():
# Development environment tools
dev_tools = MCPTools(
transport="streamable-http",
url="https://docs.agno.com/mcp",
# By providing this tool_name_prefix, all the tool names will be prefixed with "dev_"
tool_name_prefix="dev",
)
await dev_tools.connect()
agent = Agent(tools=[dev_tools])
await agent.aprint_response("Which tools do you have access to? List them all.")
await dev_tools.close()
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
asyncio.run(run_agent())
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U "agno[mcp]" openai
Export your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
Run the example
tool_name_prefix.py, then run:python tool_name_prefix.py
Was this page helpful?