docs/content/changelog/01-12-26-tool-router-improvements.mdx
@composio/core and provider packages0.3.4 to 0.4.0composio-core and provider packages0.10.4 to 0.10.5Added waitForConnections (TypeScript) / wait_for_connections (Python) property to manage connections configuration. This allows tool router sessions to wait for users to complete authentication before proceeding to the next step.
TypeScript:
// @noErrors
const session = await composio.toolRouter.create(userId, {
manageConnections: {
enable: true,
callbackUrl: 'https://example.com/callback',
waitForConnections: true // NEW
}
});
Python:
session = tool_router.create(
user_id="user_123",
manage_connections={
"enable": True,
"callback_url": "https://example.com/callback",
"wait_for_connections": True # NEW
}
)
Introduced new modifier types for better session-based tool execution: SessionExecuteMetaModifiers and SessionMetaToolOptions.
TypeScript:
// @noErrors
const tools = await session.tools({
modifySchema: ({ toolSlug, toolkitSlug, schema }) => schema,
beforeExecute: ({ toolSlug, toolkitSlug, sessionId, params }) => params,
afterExecute: ({ toolSlug, toolkitSlug, sessionId, result }) => result
});
Python:
from composio.core.models import before_execute_meta, after_execute_meta
@before_execute_meta
def before_modifier(tool, toolkit, session_id, params):
return params
@after_execute_meta
def after_modifier(tool, toolkit, session_id, response):
return response
tools = session.tools(modifiers=[before_modifier, after_modifier])
Added getRawToolRouterMetaTools (TypeScript) / get_raw_tool_router_meta_tools (Python) method in the Tools class for fetching meta tools directly from a tool router session.
TypeScript:
// @noErrors
const metaTools = await composio.tools.getRawToolRouterMetaTools('session_123', {
modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
// Customize schema
return schema;
}
});
Python:
meta_tools = tools_model.get_raw_tool_router_meta_tools(
session_id="session_123",
modifiers=[schema_modifier]
)
Eliminated unnecessary tool fetching during tool router execution, resulting in faster tool execution with fewer API calls.
Tool router sessions now fetch tools directly from the session API endpoint instead of using tool slugs, providing better consistency and reliability.
Removed redundant tool schema fetching in execution paths, using a hardcoded 'composio' toolkit slug for meta tools.
This release is fully backward compatible:
| Change | Runtime Breaking | TypeScript Breaking | Migration Required |
|---|---|---|---|
wait_for_connections property | No | No | No |
| Session-specific modifiers | No | No | No |
getRawToolRouterMetaTools method | No | No | No |
| Tool router uses session API | No | No | No |
| Optimized tool execution | No | No | No |
All changes follow semantic versioning principles and maintain full backward compatibility.