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

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

Input Schema (JSON Schema)

{ "properties": { "clear": { "default": false, "description": "Limpar logs após recuperação", "type": "boolean" }, "filterType": { "default": "all", "description": "Filtrar por tipo de log", "enum": [ "all", "log", "error", "warning", "info" ], "type": "string" } }, "type": "object" }

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; }

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