safari_close_session
Close an active Safari browser automation session to free system resources and end browser control tasks.
Instructions
Close a Safari automation session
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | Session identifier |
Implementation Reference
- src/safari-mcp-server.ts:414-425 (handler)Main tool handler that delegates to driverManager.closeSession and returns success response.private async closeSession(args: Record<string, any>): Promise<Array<{ type: string; text: string }>> { const { sessionId } = args; await this.driverManager.closeSession(sessionId); return [ { type: 'text', text: `Safari session '${sessionId}' closed successfully` } ]; }
- src/safari-driver.ts:78-91 (helper)Core helper function that quits the Selenium driver for the session and removes it from the manager's session map.async closeSession(sessionId: string): Promise<void> { const session = this.sessions.get(sessionId); if (!session) { throw new Error(`Session ${sessionId} not found`); } try { await session.driver.quit(); this.sessions.delete(sessionId); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); throw new Error(`Failed to close session: ${errorMessage}`); } }
- src/safari-mcp-server.ts:206-216 (schema)JSON schema defining the tool's input parameters (requires sessionId).{ name: 'safari_close_session', description: 'Close a Safari automation session', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'Session identifier' } }, required: ['sessionId'] } }
- src/safari-mcp-server.ts:261-262 (registration)Switch case registration in handleToolCall that routes the tool call to the closeSession handler.case 'safari_close_session': return await this.closeSession(args);