pilot_console
Retrieve console messages from browser automation sessions to monitor errors, warnings, and information logs for debugging and analysis.
Instructions
Get console messages from the circular buffer.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| level | No | Filter by log level | |
| clear | No | Clear the buffer after reading |
Implementation Reference
- src/tools/inspection.ts:36-52 (handler)The handler logic for the pilot_console tool, which reads console messages from a buffer and filters by level.
async ({ level, clear }) => { await bm.ensureBrowser(); let entries = consoleBuffer.toArray(); if (level && level !== 'all') { if (level === 'error') { entries = entries.filter(e => e.level === 'error' || e.level === 'warning'); } else { entries = entries.filter(e => e.level === level); } } if (clear) consoleBuffer.clear(); if (entries.length === 0) return { content: [{ type: 'text' as const, text: '(no console messages)' }] }; const text = entries.map(e => `[${new Date(e.timestamp).toISOString()}] [${e.level}] ${e.text}` ).join('\n'); return { content: [{ type: 'text' as const, text }] }; } - src/tools/inspection.ts:29-35 (registration)Registration of the pilot_console tool including its schema definition.
server.tool( 'pilot_console', 'Get console messages from the circular buffer.', { level: z.enum(['error', 'warning', 'info', 'all']).optional().describe('Filter by log level'), clear: z.boolean().optional().describe('Clear the buffer after reading'), },