Skip to main content
Glama

safari_clear_network_logs

Remove stored network logs for a specific session in Safari MCP Server, ensuring cleaner session management and improved performance during browser automation.

Instructions

Clear captured network logs for a session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession identifier

Implementation Reference

  • MCP tool handler for 'safari_clear_network_logs'. Extracts sessionId from args, calls driverManager.clearNetworkLogs, and returns a text confirmation message.
    private async clearNetworkLogs(args: Record<string, any>): Promise<Array<{ type: string; text: string }>> { const { sessionId } = args; await this.driverManager.clearNetworkLogs(sessionId); return [ { type: 'text', text: `Network logs cleared for session '${sessionId}'` } ]; }
  • Input schema definition for the tool, specifying required 'sessionId' parameter.
    { name: 'safari_clear_network_logs', description: 'Clear captured network logs for a session', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'Session identifier' } }, required: ['sessionId'] } },
  • Registration in the tool dispatch switch statement within handleToolCall method.
    case 'safari_clear_network_logs': return await this.clearNetworkLogs(args);
  • Supporting method in SafariDriverManager that clears the network logs by resetting the browser's __safariMCPNetworkLogs array via executeScript.
    async clearNetworkLogs(sessionId: string): Promise<void> { const session = this.getSession(sessionId); if (!session) { throw new Error(`Session ${sessionId} not found`); } try { await session.driver.executeScript(` if (window.__safariMCPNetworkLogs) { window.__safariMCPNetworkLogs = []; } `); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); throw new Error(`Failed to clear network logs: ${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