Skip to main content
Glama

get_console_logs

Retrieve captured browser console logs from Firefox MCP Server, filtered by type, timestamp, and quantity, for efficient debugging and automation tasks.

Instructions

Get captured console logs from browser

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMax number of logs to return
sinceNoTimestamp to filter logs since
tabIdNo
typesNoFilter by log types

Implementation Reference

  • The core handler function for the 'get_console_logs' tool. Retrieves console logs from the tab's buffer, applies filters (tabId, since timestamp, log types, limit), and returns formatted JSON output.
    async getConsoleLogs(args = {}) {
      const { tabId, since, types, limit = 50 } = args;
      const effectiveTabId = tabId || this.activeTabId;
      
      if (!effectiveTabId || !this.consoleLogs.has(effectiveTabId)) {
        return { content: [{ type: 'text', text: 'No console logs available for this tab' }] };
      }
    
      let logs = this.consoleLogs.get(effectiveTabId);
      
      // Filter by timestamp
      if (since) {
        logs = logs.filter(log => log.timestamp >= since);
      }
      
      // Filter by types
      if (types && types.length > 0) {
        logs = logs.filter(log => types.includes(log.type));
      }
      
      // Limit results
      logs = logs.slice(-limit);
    
      return {
        content: [{
          type: 'text',
          text: `Console Logs (${logs.length}):\n` + JSON.stringify(logs, null, 2)
        }]
      };
    }
  • Tool registration in the ListTools response, defining the name, description, and input schema for validation.
      name: 'get_console_logs',
      description: 'Get captured console logs from browser',
      inputSchema: {
        type: 'object',
        properties: {
          tabId: { type: 'string' },
          since: { type: 'number', description: 'Timestamp to filter logs since' },
          types: {
            type: 'array',
            items: { type: 'string', enum: ['log', 'error', 'warn', 'info', 'debug'] },
            description: 'Filter by log types'
          },
          limit: { type: 'number', default: 50, description: 'Max number of logs to return' }
        }
      }
    },
  • Dispatch case in the CallToolRequest handler that routes calls to the getConsoleLogs method.
    case 'get_console_logs':
      return await this.getConsoleLogs(args);
  • Event listener setup in setupPageMonitoring that captures Playwright 'console' events and populates the consoleLogs Map for each tab.
    page.on('console', (msg) => {
      const logs = this.consoleLogs.get(tabId) || [];
      logs.push({
        type: msg.type(),
        text: msg.text(),
        location: msg.location(),
        timestamp: Date.now()
      });
      this.consoleLogs.set(tabId, logs);
    });
  • Declaration of the consoleLogs Map that stores log events per tabId, used by getConsoleLogs.
    this.consoleLogs = new Map(); // tabId -> array of log events
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behavioral aspects: whether this requires prior setup (like start_monitoring), what format the logs return, if there are rate limits, whether logs are cleared after retrieval, or authentication needs. 'Captured' implies some collection mechanism but isn't explained.

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 wasted words. It's front-loaded with the core purpose and uses precise terminology. Every word earns its place, 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 4 parameters, no annotations, no output schema, and a browser debugging context with many sibling tools, the description is inadequate. It doesn't explain return format, error conditions, dependencies on other tools, or how this fits into the broader debugging workflow. For a tool that retrieves potentially complex log data, 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 75% (3 of 4 parameters have descriptions), so the baseline is 3. The description adds no parameter information beyond what's in the schema - it doesn't explain relationships between parameters (e.g., how since interacts with limit), default behaviors, or parameter constraints. The description doesn't compensate for the 25% gap (tabId lacks schema description).

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 'Get captured console logs from browser' clearly states the action (get) and resource (console logs from browser). It distinguishes from some siblings like get_javascript_errors (specific error type) and get_network_activity (different resource), but doesn't explicitly differentiate from get_all_debug_activity which might overlap. The purpose is clear but sibling differentiation could be more explicit.

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 like get_javascript_errors or get_all_debug_activity. It doesn't mention prerequisites (e.g., whether monitoring must be active), typical use cases, or limitations. The agent must infer usage from the tool name alone.

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/JediLuke/firefox-mcp-server'

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