multi_browserbase_stagehand_session_list
List and monitor all active parallel browser sessions to manage automation workflows, verify session status, and retrieve session IDs for debugging.
Instructions
ONLY WORKS WITH MULTI-SESSION TOOLS! Track all parallel sessions: Critical tool for multi-session management! Shows all active browser sessions with their IDs, names, ages, and Browserbase session IDs. Use this frequently to monitor your parallel automation workflows, verify sessions are running, and get session IDs for session-specific tools. Essential for debugging and resource management in complex multi-browser scenarios.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/multiSession.ts:150-200 (handler)Full tool definition including the handler function that lists active sessions from stagehandStore.list(), formats session info (ID, name, Browserbase ID, age), and returns formatted text output.
export const listSessionsTool = defineTool({ capability: "list_sessions", schema: { name: "multi_browserbase_stagehand_session_list", description: "ONLY WORKS WITH MULTI-SESSION TOOLS! Track all parallel sessions: Critical tool for multi-session management! Shows all active browser sessions with their IDs, names, ages, and Browserbase session IDs. Use this frequently to monitor your parallel automation workflows, verify sessions are running, and get session IDs for session-specific tools. Essential for debugging and resource management in complex multi-browser scenarios.", inputSchema: z.object({}), }, handle: async (): Promise<ToolResult> => { const sessions = stagehandStore.list(); if (sessions.length === 0) { return { action: async () => ({ content: [ { type: "text", text: "No active sessions", }, ], }), waitForNetwork: false, }; } const sessionInfo = sessions.map((s) => ({ id: s.id, name: s.metadata?.name, browserbaseSessionId: s.metadata?.bbSessionId, created: new Date(s.created).toISOString(), age: Math.floor((Date.now() - s.created) / 1000), })); return { action: async () => ({ content: [ { type: "text", text: `Active sessions (${sessions.length}):\n${sessionInfo .map( (s) => `- ${s.id}${s.name ? ` (${s.name})` : ""} - BB: ${s.browserbaseSessionId} - Age: ${s.age}s`, ) .join("\n")}`, }, ], }), waitForNetwork: false, }; }, }); - src/tools/multiSession.ts:152-156 (schema)Tool schema with name 'multi_browserbase_stagehand_session_list', description for multi-session tracking, and empty input schema (no parameters required).
schema: { name: "multi_browserbase_stagehand_session_list", description: "ONLY WORKS WITH MULTI-SESSION TOOLS! Track all parallel sessions: Critical tool for multi-session management! Shows all active browser sessions with their IDs, names, ages, and Browserbase session IDs. Use this frequently to monitor your parallel automation workflows, verify sessions are running, and get session IDs for session-specific tools. Essential for debugging and resource management in complex multi-browser scenarios.", inputSchema: z.object({}), - src/tools/index.ts:30-40 (registration)Tool (listSessionsTool) imported from multiSession.ts and registered in the multiSessionTools array, which is included in the main TOOLS export used for MCP tool registration.
export const multiSessionTools = [ createSessionTool, listSessionsTool, closeSessionTool, navigateWithSessionTool, actWithSessionTool, extractWithSessionTool, observeWithSessionTool, getUrlWithSessionTool, getAllUrlsWithSessionTool, ];