get_sessions
Retrieve active browser sessions for monitoring or managing automation tasks on the Browserless MCP Server platform.
Instructions
Get active sessions
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:552-570 (handler)MCP server handler for the 'get_sessions' tool. Calls the client's getSessions method and formats the response as MCP content blocks.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/client.ts:291-302 (handler)Core implementation of getSessions in BrowserlessClient class. Performs an HTTP GET request to the Browserless '/sessions' endpoint to retrieve active sessions.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/index.ts:252-258 (registration)Tool registration in the listTools handler, defining name, description, and empty input schema for 'get_sessions'.name: 'get_sessions', description: 'Get active sessions', inputSchema: { type: 'object', properties: {}, }, },