clear_console_messages
Remove collected console messages to maintain clean output and focus on new measurements during browser automation and testing.
Instructions
Clear the collected console messages. TIP: Clear before a new measurement to keep output focused.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/console.ts:230-242 (handler)The main execution handler for the clear_console_messages tool. It retrieves the Firefox instance, counts existing console messages, clears them using firefox.clearConsoleMessages(), and returns a success response indicating the number of messages cleared.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)The MCP tool schema definition for clear_console_messages, including name, description, and an empty input schema since no arguments are required.export const clearConsoleMessagesTool = { name: 'clear_console_messages', description: 'Clear collected console messages.', inputSchema: { type: 'object', properties: {}, }, };
- src/index.ts:117-119 (registration)Registration of the tool handler in the central toolHandlers Map used by the MCP server to dispatch tool calls.// Console ['list_console_messages', tools.handleListConsoleMessages], ['clear_console_messages', tools.handleClearConsoleMessages],
- src/index.ts:161-163 (registration)Inclusion of the tool schema in the allTools array provided to MCP clients via listTools request.// Console tools.listConsoleMessagesTool, tools.clearConsoleMessagesTool,
- src/firefox/index.ts:185-190 (helper)Underlying FirefoxClient method that clears the console messages by delegating to the ConsoleEvents module. Called by the tool handler.clearConsoleMessages(): void { if (!this.consoleEvents) { throw new Error('Not connected'); } this.consoleEvents.clearMessages(); }