Skip to main content
Glama

get_console_logs

Retrieve browser console logs for debugging web applications. Filter logs by type (log, error, warning, info) and optionally clear logs after retrieval to maintain clean debugging sessions.

Instructions

Recupera todos os logs do console capturados desde a última navegação

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
clearNoLimpar logs após recuperação
filterTypeNoFiltrar por tipo de logall

Implementation Reference

  • The main handler function that implements the get_console_logs tool logic. It retrieves console logs from browserState, applies optional filtering by type, optionally clears the logs, and returns a JSON-formatted response.
    export async function handleGetConsoleLogs(args: unknown): Promise<ToolResponse> {
      const typedArgs = args as unknown as GetConsoleLogsArgs;
      const { filterType = 'all', clear = false } = typedArgs;
    
      let logs = browserState.consoleLogs;
      if (filterType !== 'all') {
        logs = logs.filter((log) => log.type === filterType);
      }
    
      const result = {
        count: logs.length,
        logs: logs,
      };
    
      if (clear) {
        clearConsoleLogs();
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2),
          },
        ],
      };
    }
  • TypeScript interface defining the input parameters for the get_console_logs tool.
    export interface GetConsoleLogsArgs {
      filterType?: 'all' | 'log' | 'error' | 'warning' | 'info';
      clear?: boolean;
    }
  • MCP tool definition including the name, description, and inputSchema used for tool listing and validation.
      name: 'get_console_logs',
      description: 'Recupera todos os logs do console capturados desde a última navegação',
      inputSchema: {
        type: 'object',
        properties: {
          filterType: {
            type: 'string',
            enum: ['all', 'log', 'error', 'warning', 'info'],
            description: 'Filtrar por tipo de log',
            default: 'all',
          },
          clear: {
            type: 'boolean',
            description: 'Limpar logs após recuperação',
            default: false,
          },
        },
      },
    },
  • src/index.ts:87-88 (registration)
    Dispatch case in the main tool execution handler that routes calls to the get_console_logs handler function.
    case 'get_console_logs':
      return await handleGetConsoleLogs(args);
  • Type definition for individual console log entries used by the handler.
    export interface ConsoleLog {
      type: string;
      text: string;
      stack?: string;
      timestamp: string;
    }
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 mentions retrieving logs 'captured since the last navigation' which adds useful temporal context, but doesn't describe what happens if no logs exist, whether this requires specific page states, what format/log levels are returned, or any rate limits. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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

Conciseness4/5

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

The description is a single, efficient sentence in Portuguese that states the core purpose. It's appropriately concise and front-loaded with the main action. There's no wasted text, though it could potentially benefit from slightly more detail given the lack of annotations.

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, no output schema, and a tool that retrieves potentially complex log data, the description is incomplete. It doesn't explain what the return format looks like (structured data? plain text?), what happens when clear=true (are logs permanently deleted?), or any error conditions. For a logging tool with zero structured metadata, more descriptive 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 documents both parameters thoroughly with descriptions and enum values. The description doesn't add any parameter-specific information beyond what's in the schema. The baseline of 3 is appropriate when the schema does the heavy lifting.

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 action ('recupera' - retrieves) and resource ('logs do console capturados desde a última navegação' - console logs captured since the last navigation). It's specific about what it retrieves, though it doesn't explicitly differentiate from potential sibling tools like get_network_activity or get_page_info that might also provide logging-related data.

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. It doesn't mention prerequisites (e.g., needing to be on a webpage), exclusions, or comparisons with sibling tools like get_network_activity that might provide different types of logs. Usage context is implied but not stated.

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/EmmanuelBarbosaMonteiro/mcp-server-browser'

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