safari_list_sessions
Retrieve all active Safari browser sessions to monitor and manage open tabs and windows for browser automation tasks.
Instructions
List all active Safari 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": "safari_list_sessions"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/safari-mcp-server.ts:198-205 (registration)Registration of the 'safari_list_sessions' tool, including its name, description, and input schema (no required parameters).
{ name: 'safari_list_sessions', description: 'List all active Safari sessions', inputSchema: { type: 'object', properties: {} } }, - src/safari-mcp-server.ts:403-412 (handler)The main handler function for 'safari_list_sessions'. Calls driverManager.getAllSessions() and formats the list of active session IDs as a text response.
private async listSessions(): Promise<Array<{ type: string; text: string }>> { const sessions = this.driverManager.getAllSessions(); return [ { type: 'text', text: `Active Safari Sessions (${sessions.length}):\n${sessions.join('\n')}` } ]; } - src/safari-driver.ts:442-444 (helper)Supporting helper method in SafariDriverManager that returns all active session IDs from the internal Map.
getAllSessions(): string[] { return Array.from(this.sessions.keys()); }