Users and sessions
A user ID is an identifier from your system (database ID, UUID, or any unique string) that scopes connected accounts and tool access to a specific user. User IDs can represent individuals, teams, or organizations. See User Management for patterns.
A session is an ephemeral configuration that combines:
- Which user’s connected accounts to use
- Which toolkits are available
- Which auth configs to use
Tool Router’s meta-tools are the same for everyone. The session determines the context they operate within.
Creating a session
Enabling toolkits
Restrict the session to specific toolkits:
Disabling toolkits
Keep all toolkits enabled except specific ones:
Custom auth configs
Use your own OAuth credentials instead of Composio’s defaults:
See White-labeling authentication for branding, or Using custom auth configs for toolkits that require your own credentials.
Connected accounts
Connected accounts are stored in Composio and persist across sessions. When a user connects their GitHub account in one session, it remains available in future sessions. Sessions configure which connections to use, but don’t own the connections themselves.
Account selection
If a user has multiple connected accounts for the same toolkit, you can specify which one to use:
Precedence
When executing a tool, Tool Router selects the connected account in this order:
connectedAccountsoverride if provided in session configauthConfigsoverride - finds or creates connection on that config- Auth config previously created by Tool Router for this toolkit
- Creates new auth config using Composio managed auth (tagged as Tool Router created)
- Error if no Composio managed auth scheme exists for the toolkit
If a user has multiple connected accounts for a toolkit, the most recently connected one is used.
Session methods
mcp
Get the MCP server URL to use with any MCP-compatible client.
For framework examples, see Using with MCP clients or Using as a native tool.
tools()
Get native tools from the session for use with AI frameworks.
authorize()
Manually authenticate a user to a toolkit outside of the chat flow.
For more details, see Manually authenticating users.
toolkits()
List available toolkits and their connection status. You can use this to build a UI showing which apps are connected.
Returns the first 20 toolkits by default.