Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | """ |
| 2 | Tool Router - Toolkits Example |
| 3 | |
| 4 | This example demonstrates how to retrieve available toolkits |
| 5 | and their connection status in a Tool Router session. |
| 6 | """ |
| 7 | |
| 8 | import os |
| 9 | |
| 10 | from composio import Composio |
| 11 | |
| 12 | composio = Composio() |
| 13 | |
| 14 | # Create a tool router session |
| 15 | # When manage_connections is enabled, tools for managing connections are included |
| 16 | session = composio.create( |
| 17 | # The provisioned examples user (raises KeyError when unset) |
| 18 | user_id=os.environ["COMPOSIO_EXAMPLES_USER_ID"], |
| 19 | manage_connections=True, |
| 20 | # mcp=True surfaces session.mcp on the returned type |
| 21 | mcp=True, |
| 22 | ) |
| 23 | |
| 24 | print(f"Session created: {session.session_id}") |
| 25 | print(f"MCP Server: {session.mcp.url}") |
| 26 | |
| 27 | # Get available toolkits for the session |
| 28 | # This returns information about all toolkits available to the user |
| 29 | toolkits = session.toolkits() |
| 30 | |
| 31 | print("\nAvailable toolkits:") |
| 32 | print(toolkits) |