[WIP] Feat: Native + MCP Tool Router with helper methods
[!NOTE] Introduce a first-class Tool Router that creates isolated sessions, wraps tools per provider, exposes authorize/connection helpers, and adds SDK APIs and examples in both Python and TypeScript.
- Python:
- New Tool Router: Implement
composio.core.models.tool_router.ToolRouterprovidingcreate()to open isolated MCP-backed sessions returning{session_id, mcp, tools(), authorize(), connections()}.- Experimental Kept: Move previous API to
tool_router_experimental.pyand expose undercomposio.experimental.tool_router.- SDK Wiring:
Composionow exposestool_routerandexperimental.create(proxy to stableToolRouter.create).- Utils: Add
utils.uuidwithgenerate_uuid/generate_short_idand export viautils.__init__.- Examples: Add basic/advanced Tool Router examples and an agent demo using session tools.
- TypeScript:
- Stable Tool Router: Add
models/ToolRouterwithcreate()returning session{sessionId, mcp, tools(), authorize(), toolkits()}; new rich config/types intypes/toolRouter.types.- Experimental API: Retain prior API under
models/ToolRouter.experimentalwith types moved totoolRouter.experimental.types.- SDK Updates:
Composionow exposestoolRouterandexperimental.create()(delegates to stable). Export paths updated.- Tools Refactor:
Toolsconstructed without direct provider arg and addswrapToolsForProvider(); internal calls updated.- Examples: Add
ts/examples/tool-routerand simplify Vercel example stream setup.- Misc: Lockfile and deps updated (e.g.,
@ai-sdk/[email protected],ora, etc.).Written by Cursor Bugbot for commit decd89f3bb7a99d6a876aca24d3293589b901d66. This will update automatically on new commits. Configure here.
Add provider-aware ToolRouter.create returning ToolRouterSession with MCP config in Python and TypeScript SDKs to introduce native + MCP tool routing with helper methods
Introduce a new provider-aware tool router that exposes Composio.tool_router.create (Python) and composio.toolRouter.create (TypeScript) returning a ToolRouterSession with mcp, tools(), authorize(), and connection state helpers, and update Tools to wrap execution for the configured provider while preserving the legacy experimental router under experimental.tool_router.
📍Where to Start
Start with the TypeScript implementation in ToolRouter.ts, then review the Python counterpart in tool_router.py and how it is wired in sdk.py.
Macroscope summarized decd89f.