|
| 1 | +# Adding New Tools |
1 | 2 |
|
2 | | -# - Coming Soon - |
| 3 | +## What This Does |
| 4 | +Extend the agent’s functionality by introducing a new tool. Each tool is implemented as an MCP server and registered via configuration. |
3 | 5 |
|
| 6 | +## Implementation Steps |
| 7 | + |
| 8 | +### 1. Create MCP Server |
| 9 | +Create a new file `src/tool/mcp_servers/new-mcp-server.py` that implements the tool’s core logic. |
| 10 | + |
| 11 | +```python |
| 12 | +from fastmcp import FastMCP |
| 13 | + |
| 14 | +# Initialize FastMCP server |
| 15 | +mcp = FastMCP("new-mcp-server") |
| 16 | + |
| 17 | +@mcp.tool() |
| 18 | +async def tool_name(param: str) -> str: |
| 19 | + """ |
| 20 | + Explanation of the tool, its parameters, and return value. |
| 21 | + """ |
| 22 | + tool_result = ... # Your logic here |
| 23 | + return tool_result |
| 24 | + |
| 25 | +if __name__ == "__main__": |
| 26 | + mcp.run(transport="stdio") |
| 27 | +``` |
| 28 | + |
| 29 | +> Tool schemas are automatically generated from `docstrings` and `hints` via the FastMCP protocol. |
| 30 | +
|
| 31 | + |
| 32 | +### 2. Create Tool Config |
| 33 | +Add a new config file at `config/tools/new-tool-name.yaml`: |
| 34 | + |
| 35 | +```yaml |
| 36 | +name: "new-tool-name" |
| 37 | +tool_command: "python" |
| 38 | +args: |
| 39 | + - "-m" |
| 40 | + - "src.tool.mcp_servers.new-mcp-server" # Match the server file created above |
| 41 | +``` |
| 42 | +
|
| 43 | +
|
| 44 | +### 3. Register Tool in Agent Config |
| 45 | +Enable the new tool inside your agent config (e.g., `config/agent-with-new-tool.yaml`): |
| 46 | + |
| 47 | +```yaml |
| 48 | +main_agent: |
| 49 | + ... |
| 50 | + tool_config: |
| 51 | + - tool-reasoning |
| 52 | + - new-tool-name # 👈 Add your new tool here |
| 53 | + ... |
| 54 | +sub_agents: |
| 55 | + agent-worker: |
| 56 | + ... |
| 57 | + tool_config: |
| 58 | + - tool-searching |
| 59 | + - tool-image-video |
| 60 | + - tool-reading |
| 61 | + - tool-code |
| 62 | + - tool-audio |
| 63 | + - new-tool-name # 👈 Add your new tool here |
| 64 | + ... |
| 65 | +``` |
| 66 | + |
| 67 | + |
| 68 | +## Examples |
| 69 | +- `tool-reasoning` – reasoning utilities |
| 70 | +- `tool-image-video` – visual understanding |
| 71 | +- `new-tool-name` – your custom tool |
4 | 72 |
|
5 | 73 | --- |
| 74 | + |
6 | 75 | **Last Updated:** Sep 2025 |
7 | | -**Doc Contributor:** Team @ MiroMind AI |
| 76 | +**Doc Contributor:** Team @ MiroMind AI |
0 commit comments