Tool Router is an experimental feature that provides intelligent tool routing, automatic connection management, and MCP server integration.
Quick Start
Creating Sessions
create()
Create a new Tool Router session for a user:string
required
External user ID from your database
ToolRouterCreateSessionConfig
- Basic Session
- With Connection Management
- With Tool Restrictions
Session Object
The session object provides access to tools, connections, and MCP:Using Sessions
get tools()
Get tools wrapped for your provider:authorize()
Initiate toolkit authorization:toolkits()
List toolkit connection states:Using Existing Sessions
use()
Retrieve an existing session:MCP Server Integration
Each session provides an MCP server URL:MCP Client Configuration
For Claude Desktop or Cursor:Tool Access Control
Control which tools are available:Workbench Mode
Enable workbench mode for testing:Complete Example
Best Practices
- Session Reuse: Store session IDs and reuse them
- Connection Management: Enable
manageConnectionsfor user-driven auth - Tool Restrictions: Disable dangerous tools in production
- Error Handling: Handle connection failures gracefully
- Session Cleanup: Delete sessions when no longer needed
Limitations
- Sessions are experimental and API may change
- MCP integration requires MCP-compatible clients
- Some features may not work in all environments
Next Steps
MCP
Learn about MCP servers
Tools API
Learn about tools
Connected Accounts
Manage connections
Composio Class
Main SDK reference