Skip to main content
Glama

clear_console_logs

Idempotent

Clears captured console logs and returns the number of entries cleared, resetting log state for debugging.

Instructions

Clears captured console logs and returns the number of entries cleared.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute() method of ClearConsoleLogsTool that clears console logs and returns count.
    async execute(args: any, context: ToolContext): Promise<ToolResponse> {
      const inst = GetConsoleLogsTool.latestInstance;
      if (!inst) {
        return createSuccessResponse('Cleared 0 console log(s)');
      }
      const count = inst.getConsoleLogs().length;
      inst.clearConsoleLogs();
      return createSuccessResponse(`Cleared ${count} console log(s)`);
    }
  • ClearConsoleLogsTool class metadata: name 'clear_console_logs', empty inputSchema, internalState annotation.
    export class ClearConsoleLogsTool extends BrowserToolBase {
      static getMetadata(sessionConfig?: SessionConfig): ToolMetadata {
        return {
          name: "clear_console_logs",
          description: "Clears captured console logs and returns the number of entries cleared.",
          annotations: ANNOTATIONS.internalState,
          inputSchema: {
            type: "object",
            properties: {},
            required: [],
          },
        };
      }
  • Import of ClearConsoleLogsTool from console/get_console_logs.ts.
    import { GetConsoleLogsTool, ClearConsoleLogsTool } from './console/get_console_logs.js';
  • ClearConsoleLogsTool registered in the BROWSER_TOOL_CLASSES array.
    ClearConsoleLogsTool,
  • The clearConsoleLogs() helper method on GetConsoleLogsTool that empties the consoleLogs array.
    clearConsoleLogs(): void {
      this.consoleLogs = [];
    }
Behavior4/5

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

Description discloses the mutation of state (clearing logs) and return value. IdempotentHint=true is consistent; the tool is idempotent. Adds value beyond annotations by specifying the return type.

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?

Single sentence that efficiently conveys the action and result. No wasted words.

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

Completeness4/5

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

For a simple parameterless tool, the description covers purpose and return. Could mention that cleared logs are permanently lost, but annotations imply safe idempotent operation. Satisfactory given context.

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?

No parameters exist, so the description does not need to add meaning. Baseline of 4 is appropriate.

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

Purpose5/5

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

The description clearly states the tool clears captured console logs and returns the count, using a specific verb and resource. It distinguishes itself from sibling 'get_console_logs' which likely reads without clearing.

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

Usage Guidelines3/5

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

No explicit guidance on when to use this tool versus alternatives like 'get_console_logs'. The description implies usage for clearing logs, but lacks context on prerequisites or consequences.

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/antonzherdev/mcp-web-inspector'

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