Skip to main content
Glama

safari_clear_console_logs

Remove captured console logs for a specific session in Safari MCP Server, ensuring clean browser debugging and automation workflows.

Instructions

Clear captured console logs for a session

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession identifier

Implementation Reference

  • Registration of the 'safari_clear_console_logs' tool in the ListTools response, including its name, description, and input schema requiring 'sessionId'.
    { name: 'safari_clear_console_logs', description: 'Clear captured console logs for a session', inputSchema: { type: 'object', properties: { sessionId: { type: 'string', description: 'Session identifier' } }, required: ['sessionId'] } },
  • MCP tool handler for 'safari_clear_console_logs'. Extracts sessionId from arguments, calls SafariDriverManager.clearConsoleLogs(sessionId), and returns a success text message.
    private async clearConsoleLogs(args: Record<string, any>): Promise<Array<{ type: string; text: string }>> { const { sessionId } = args; await this.driverManager.clearConsoleLogs(sessionId); return [ { type: 'text', text: `Console logs cleared for session '${sessionId}'` } ];
  • Core implementation in SafariDriverManager that clears the console logs by injecting JavaScript to reset the window.__safariMCPConsoleLogs array in the browser session.
    async clearConsoleLogs(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.__safariMCPConsoleLogs) { window.__safariMCPConsoleLogs = []; } `); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : String(error); throw new Error(`Failed to clear console logs: ${errorMessage}`); } }
  • Dispatch case in handleToolCall switch statement that routes 'safari_clear_console_logs' calls to the dedicated handler method.
    case 'safari_clear_console_logs': return await this.clearConsoleLogs(args);

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