Smolagents Adapter
This module implements the SmolAgents adapter.
SmolAgents do not support async tools, so this adapter will only work with the sync context manager.
Example Usage:
with MCPAdapt(StdioServerParameters(command="uv", args=["run", "src/echo.py"]), SmolAgentAdapter()) as tools: print(tools)
SmolAgentsAdapter
Bases: ToolAdapter
Adapter for the smolagents
framework.
Note that the smolagents
framework do not support async tools at this time so we
write only the adapt method.
Source code in src/mcpadapt/smolagents_adapter.py
adapt
Adapt a MCP tool to a SmolAgents tool.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
Callable[[dict | None], CallToolResult]
|
The function to adapt. |
required |
mcp_tool
|
Tool
|
The MCP tool to adapt. |
required |
Returns:
Type | Description |
---|---|
Tool
|
A SmolAgents tool. |