Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
docs: add some docs around how to use tool router and its context management (#2034)
Rahul Tarak committed
Oct 7, 2025 at 15:12 UTC
c69d6c8e7ef1049f83432a8ed55de53829298885
1 file changed
+54
-6
fern/pages/src/tool-router/quick-start.mdx
+54
-6
@@ -32,20 +32,60 @@ Create a presigned URL for each user session. This URL exposes Tool Router capab
32
/>
33
</CodeGroup>
34
35
-Now you can use the MCP URL in any MCP client, you can see how it lists tools inside the inspector here
35
+<Tip icon="info">
36
+**What are sessions?**
37
+
38
+A session encapsulates a single conversation between a user and the language model.
39
+
40
+Sessions are designed for security. Each presigned URL contains user authentication credentials and should never be stored long-term or exposed to the client. Generate a new URL for each conversation.
41
+</Tip>
42
+
43
+The URL you get here is an MCP [StreamableHTTP URL](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http). You can use this URL in any MCP client, you can see how it lists tools inside the inspector here.
44
45
<Frame>
46
<img src="../../../assets/images/tool-router/inspector.jpeg" alt="Tool Router Inspector" />
47
</Frame>
48
49
+### Building on top of this URL with providers
50
+
51
+_The necessary scaffolding will be integrated into existing providers abstraction before `toolRouter` is generally available._
52
+
53
+Use the presigned URL with any frameworks that support MCP directly, few examples below:
54
+
55
+<CardGroup cols={2}>
56
+ <Card
57
+ title="OpenAI"
58
+ icon={<img src="../../../assets/images/openai-logo.svg" width="24" height="24" />}
59
+ href="https://platform.openai.com/docs/guides/tools-connectors-mcp"
60
+ >
61
+ Connect via OpenAI's MCP connector to use Tool Router with GPT models
62
+ </Card>
63
+ <Card
64
+ title="Vercel AI SDK"
65
+ icon={<img src="../../../assets/images/vercel-logo.svg" width="24" height="24" />}
66
+ href="https://ai-sdk.dev/cookbook/next/mcp-tools#mcp-tools"
67
+ >
68
+ Use experimental_createMCPClient with StreamableHTTPClientTransport to integrate with Next.js apps
69
+ </Card>
70
+ <Card
71
+ title="Claude"
72
+ icon={<img src="../../../assets/images/anthropic-logo.svg" width="24" height="24" />}
73
+ href="https://docs.claude.com/en/docs/agents-and-tools/remote-mcp-servers"
74
+ >
75
+ Connect remote MCP servers through Anthropic's MCP connector API
76
+ </Card>
77
+ <Card
78
+ title="LangChain"
79
+ icon={<img src="../../../assets/images/langgraph-logo.svg" width="24" height="24" />}
80
+ href="https://docs.langchain.com/oss/python/langchain/mcp"
81
+ >
82
+ Load Tool Router tools using langchain_mcp_adapters for Python workflows
83
+ </Card>
84
+</CardGroup>
85
+
86
42
-<Tip icon="info">
43
-**What are sessions?**
87
45
-A session encapsulates a single conversation between a user and the language model.
88
47
-Sessions are designed for security. Each presigned URL contains user authentication credentials and should never be stored long-term or exposed to the client. Generate a new URL for each conversation.
48
-</Tip>
89
90
## How Tool Router Works
91
@@ -60,6 +100,14 @@ Checks if the user has an active connection to the required toolkit. If not, cre
100
**3. Execution**
101
Loads authenticated tools into context and executes them. Supports parallel execution across multiple tools for efficiency.
102
103
+### Context Management
104
+
105
+The Tool Router intelligently manages context to avoid overwhelming the LLM with unnecessary information. Tools are only loaded into context when needed—search discovers relevant tools, and multi execute loads them just-in-time for execution. When working with large outputs, the remote workbench stores them as files in persistent storage, allowing iteration without consuming context windows. The system also segments tools within each MCP server, exposing only the subset required for the current task.
106
+
107
+<Info>
108
+The tool router currently consumes about ~20k tokens of context on modern models like `gpt-5` and `claude-4.5-sonnet`. This number can vary based on the model's tokenizer, we will work towards reducing this number in the future.
109
+</Info>
110
+
111
### Available Tools
112
113
The router exposes six meta tools through MCP. These tools orchestrate the complete workflow from discovery to execution: