clear_console_messages
Remove collected console messages from Firefox browser automation sessions to maintain clean debugging environments and reset console output for testing.
Instructions
Clear collected console messages.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/console.ts:230-242 (handler)The main MCP tool handler that gets the Firefox instance, counts current console messages, clears them using firefox.clearConsoleMessages(), and returns a success response with the cleared count.export async function handleClearConsoleMessages(_args: unknown): Promise<McpToolResponse> { try { const { getFirefox } = await import('../index.js'); const firefox = await getFirefox(); const count = (await firefox.getConsoleMessages()).length; firefox.clearConsoleMessages(); return successResponse(`✅ cleared ${count} messages`); } catch (error) { return errorResponse(error as Error); } }
- src/tools/console.ts:50-57 (schema)Tool definition object containing name, description, and input schema (empty object since no parameters required).export const clearConsoleMessagesTool = { name: 'clear_console_messages', description: 'Clear collected console messages.', inputSchema: { type: 'object', properties: {}, }, };
- src/index.ts:119-119 (registration)Registration of the handler function in the MCP server's toolHandlers map, mapping 'clear_console_messages' to handleClearConsoleMessages.['clear_console_messages', tools.handleClearConsoleMessages],
- src/index.ts:163-163 (registration)Inclusion of the tool definition in the allTools array returned by listTools MCP request.tools.clearConsoleMessagesTool,
- src/firefox/index.ts:185-190 (helper)FirefoxClient method that clears the console messages by delegating to the underlying consoleEvents.clearMessages(). Called by the tool handler.clearConsoleMessages(): void { if (!this.consoleEvents) { throw new Error('Not connected'); } this.consoleEvents.clearMessages(); }