Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • 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); } }
  • 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,
  • 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(); }

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/freema/firefox-devtools-mcp'

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