Skip to main content
Glama
Wladastic

AutoProbeMCP

by Wladastic

get_console_logs

Retrieve browser console logs with filtering by level and optional clearing. Designed for AI-assisted web automation on the AutoProbeMCP server using Playwright.

Instructions

Get console logs from the browser

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clearNoClear console logs after retrieving
levelNoFilter logs by level

Implementation Reference

  • The handler for the get_console_logs tool. Parses parameters, filters console logs by optional level, optionally clears the log array, formats the logs with timestamps and levels, and returns them as text content.
    case 'get_console_logs': {
      if (!currentPage) {
        throw new Error('No browser page available. Launch a browser first.');
      }
    
      const params = GetConsoleLogsSchema.parse(args);
      
      // Filter logs by level if specified
      const filteredLogs = params.level 
        ? consoleLogs.filter(log => log.level === params.level)
        : consoleLogs;
    
      // Clear logs if requested
      if (params.clear) {
        consoleLogs = [];
      }
    
      const logText = filteredLogs.length > 0 
        ? filteredLogs.map(log => `[${log.timestamp.toISOString()}] ${log.level.toUpperCase()}: ${log.message}`).join('\n')
        : '(no console logs)';
    
      return {
        content: [
          {
            type: 'text',
            text: `Console Logs:\n${logText}`
          }
        ]
      };
    }
  • Zod schema defining input parameters for get_console_logs tool: optional 'level' to filter logs, and 'clear' boolean to clear logs after retrieval.
    const GetConsoleLogsSchema = z.object({
      level: z.enum(['log', 'info', 'warn', 'error', 'debug']).optional(),
      clear: z.boolean().default(false)
    });
  • src/index.ts:295-313 (registration)
    Registration of the get_console_logs tool in the listTools handler, including name, description, and input schema definition.
    {
      name: 'get_console_logs',
      description: 'Get console logs from the browser',
      inputSchema: {
        type: 'object',
        properties: {
          level: {
            type: 'string',
            enum: ['log', 'info', 'warn', 'error', 'debug'],
            description: 'Filter logs by level'
          },
          clear: {
            type: 'boolean',
            default: false,
            description: 'Clear console logs after retrieving'
          }
        }
      }
    },
  • Global array storing captured console logs with level, message, and timestamp.
    let consoleLogs: Array<{level: string, message: string, timestamp: Date}> = [];
  • Playwright page event listener that captures console messages and stores them in the global consoleLogs array. Set up during browser launch.
    currentPage.on('console', (msg) => {
      consoleLogs.push({
        level: msg.type(),
        message: msg.text(),
        timestamp: new Date()
      });
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but doesn't cover critical aspects like whether this is a read-only operation, if it requires browser state, potential side effects (e.g., clearing logs), or response format. For a tool with zero annotation coverage, this is a significant gap.

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, efficient sentence with zero waste. It's front-loaded with the core purpose and appropriately sized for the tool's complexity, making it easy for an agent to parse quickly.

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 no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., log format, structure), behavioral constraints, or how it fits with sibling tools. For a browser interaction tool with potential side effects, more context is needed.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already fully documents both parameters ('clear' and 'level'). The description adds no additional meaning beyond what's in the schema, such as explaining parameter interactions or use cases. Baseline 3 is appropriate when the schema does all the work.

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 clearly states the verb ('Get') and resource ('console logs from the browser'), making the tool's purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_page_info' or 'evaluate_javascript' that might also retrieve browser data, which prevents 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?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'get_page_info' that might overlap in browser data retrieval, there's no explicit or implied context for choosing this specific tool, leaving the agent without usage direction.

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

Related 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/Wladastic/AutoProbeMCP'

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