get_sessions
Retrieve active browser automation sessions to monitor ongoing tasks and manage web scraping, content extraction, or performance audits.
Instructions
Get active sessions
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_sessions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:552-570 (handler)MCP tool handler for 'get_sessions': calls client.getSessions() and returns formatted response with session count and JSON details.
case 'get_sessions': { const result = await this.client!.getSessions(); if (result.success && result.data) { return { content: [ { type: 'text', text: `Found ${result.data.length} active sessions.`, }, { type: 'text', text: JSON.stringify(result.data, null, 2), }, ], }; } else { throw new Error(result.error || 'Failed to get sessions'); } } - src/index.ts:252-258 (schema)Tool schema definition: empty input schema, description 'Get active sessions'.
name: 'get_sessions', description: 'Get active sessions', inputSchema: { type: 'object', properties: {}, }, }, - src/client.ts:291-302 (helper)Core implementation: HTTP GET request to Browserless /sessions endpoint, wraps response in BrowserlessResponse.
async getSessions(): Promise<BrowserlessResponse<Session[]>> { try { const response: AxiosResponse<Session[]> = await this.httpClient.get('/sessions'); return { success: true, data: response.data, }; } catch (error) { return this.handleError(error); } } - src/types.ts:316-322 (schema)Type definition for Session objects returned by get_sessions.
export interface Session { id: string; browserWSEndpoint: string; createdAt: Date; lastActivity: Date; status: 'active' | 'idle' | 'closed'; }