Skip to main content
Glama

safari_close_session

Terminate a specific Safari browser automation session using its session identifier, ensuring clean closure and resource management for efficient browser automation workflows.

Instructions

Close a Safari automation session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession identifier

Implementation Reference

  • The primary handler for the 'safari_close_session' tool. Extracts sessionId from input arguments, delegates to SafariDriverManager.closeSession(), and returns a textual 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` } ]; }
  • Registration of the 'safari_close_session' tool in the ListTools response, including name, description, and input schema definition.
    { name: 'safari_close_session', description: 'Close a Safari automation session', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'Session identifier' } }, required: ['sessionId'] } }
  • Dispatch case in the main handleToolCall switch statement that routes 'safari_close_session' calls to the closeSession handler.
    case 'safari_close_session': return await this.closeSession(args);
  • Helper method in SafariDriverManager that performs the actual session closure by quitting the Selenium WebDriver instance and removing the session from the internal 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}`); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lxman/safari-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server