Skip to main content
Glama

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
NameRequiredDescriptionDefault

No arguments

Implementation Reference

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

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states 'Clear collected console messages,' which implies a destructive mutation (deletion/removal), but doesn't specify if this is irreversible, requires permissions, affects other data, or has side effects. For a mutation tool with zero annotation coverage, this is a significant gap in behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence with zero waste: 'Clear collected console messages.' It's front-loaded with the core action and resource, making it highly efficient and easy to parse. Every word earns its place without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a destructive operation with no annotations and no output schema), the description is incomplete. It lacks details on what 'clear' entails (e.g., permanent deletion, reset), return values, or error conditions. For a mutation tool, this minimal description fails to provide sufficient context for safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate. A baseline of 4 is applied as it efficiently handles the lack of parameters without unnecessary elaboration.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Clear collected console messages' clearly states the action (clear) and resource (console messages), with 'collected' adding specificity about scope. It distinguishes from sibling 'list_console_messages' by implying a destructive operation versus read-only listing. However, it doesn't explicitly contrast with other potential console-related tools, keeping it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. While it implicitly contrasts with 'list_console_messages' (clear vs. list), there's no explicit mention of when clearing is appropriate, prerequisites, or warnings about data loss. The description lacks usage context beyond the basic action.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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

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