get_console_logs
Retrieve browser console logs captured during automated web testing sessions to identify JavaScript errors and debug issues.
Instructions
Get all console logs captured during the session
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/browser.ts:44-48 (handler)The handler function that returns the joined console logs if any, otherwise a message indicating no logs.async getConsoleLogs() { return this.consoleLogs.length > 0 ? this.consoleLogs.join('\n') : 'No console logs captured.'; }
- src/index.ts:95-102 (schema)Schema definition for the get_console_logs tool, including name, description, and empty input schema.{ name: "get_console_logs", description: "Get all console logs captured during the session", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:142-144 (registration)Registration in the tool dispatch switch case, calling the browserManager handler.case "get_console_logs": result = await browserManager.getConsoleLogs(); break;
- src/browser.ts:21-26 (helper)Helper code that sets up the console event listener to capture logs into the consoleLogs array.// Setup console log capturing this.page.on('console', msg => { const type = msg.type().toUpperCase(); const text = msg.text(); this.consoleLogs.push(`[${type}] ${text}`); });
- src/browser.ts:9-9 (helper)Private field storing the captured console logs.private consoleLogs: string[] = [];