composio icon indicating copy to clipboard operation
composio copied to clipboard

[WIP] Feat: Native + MCP Tool Router with helper methods

Open haxzie opened this issue 1 month ago • 1 comments

[!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.ToolRouter providing create() to open isolated MCP-backed sessions returning {session_id, mcp, tools(), authorize(), connections()}.
    • Experimental Kept: Move previous API to tool_router_experimental.py and expose under composio.experimental.tool_router.
    • SDK Wiring: Composio now exposes tool_router and experimental.create (proxy to stable ToolRouter.create).
    • Utils: Add utils.uuid with generate_uuid/generate_short_id and export via utils.__init__.
    • Examples: Add basic/advanced Tool Router examples and an agent demo using session tools.
  • TypeScript:
    • Stable Tool Router: Add models/ToolRouter with create() returning session {sessionId, mcp, tools(), authorize(), toolkits()}; new rich config/types in types/toolRouter.types.
    • Experimental API: Retain prior API under models/ToolRouter.experimental with types moved to toolRouter.experimental.types.
    • SDK Updates: Composio now exposes toolRouter and experimental.create() (delegates to stable). Export paths updated.
    • Tools Refactor: Tools constructed without direct provider arg and adds wrapToolsForProvider(); internal calls updated.
    • Examples: Add ts/examples/tool-router and 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.

haxzie avatar Nov 10 '25 11:11 haxzie

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.

macroscopeapp[bot] avatar Nov 10 '25 11:11 macroscopeapp[bot]