get_console_logs
Retrieve browser console logs for debugging and monitoring web applications during automated testing on ARM64 devices.
Instructions
Get browser console logs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:777-781 (handler)The main handler function for the 'get_console_logs' tool. It returns the global consoleLogs array as a JSON string in the MCP response format.async getConsoleLogs() { return { content: [{ type: 'text', text: JSON.stringify(consoleLogs, null, 2) }], }; }
- index.js:231-238 (schema)Tool schema definition including name, description, and empty input schema (no parameters required). This is part of the tools list returned by ListToolsRequest.{ name: 'get_console_logs', description: 'Get browser console logs', inputSchema: { type: 'object', properties: {}, }, },
- index.js:367-368 (registration)Registration in the CallToolRequestSchema switch statement, dispatching calls to the getConsoleLogs handler method.case 'get_console_logs': return await this.getConsoleLogs();
- index.js:20-20 (helper)Global array that stores console log entries captured via CDP Runtime.consoleAPICalled events.let consoleLogs = [];
- index.js:512-528 (helper)Event listener code that populates the consoleLogs array from browser console events received over CDP WebSocket.if (message.method === 'Runtime.consoleAPICalled') { const logEntry = { type: message.params.type, text: message.params.args.map(arg => arg.value || arg.description).join(' '), timestamp: new Date().toISOString() }; consoleLogs.push(logEntry); if (['error', 'warning'].includes(message.params.type)) { consoleErrors.push(logEntry); } // Keep only last 100 entries if (consoleLogs.length > 100) consoleLogs.shift(); if (consoleErrors.length > 100) consoleErrors.shift(); }