get_console_output
Retrieve print statements, errors, and warnings captured during Godot scene execution. Use to debug runtime behavior without leaving your coding environment.
Instructions
Get console output from Godot debug session. Returns print() statements, errors, and warnings captured during scene execution. Requires an active debug session (run a scene with F5 in Godot). Use to debug runtime behavior, check print output, or monitor warnings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of entries to return (most recent). Default: all buffered. | |
| category | No | Filter by output category. console=print(), stdout=standard out, stderr=errors. | |
| since | No | Unix timestamp (ms). Only return entries after this time. |
Implementation Reference
- src/tools/get-console-output.ts:20-62 (handler)Main handler function for get_console_output tool. Checks DAP connection, validates inputs (category, limit, since), filters console output via ConsoleManager, and returns entries with total buffered count.
export function getConsoleOutput( consoleManager: ConsoleManager, isDAPConnected: boolean, input: GetConsoleOutputInput ): GetConsoleOutputOutput { if (!isDAPConnected) { return { entries: [], total_buffered: 0, error: NO_DEBUG_SESSION_ERROR, }; } // Validate category if provided const validCategories: DAPOutputCategory[] = ['console', 'stdout', 'stderr']; if (input.category && !validCategories.includes(input.category)) { throw new Error(`Invalid category: ${input.category}. Must be one of: ${validCategories.join(', ')}`); } // Validate limit if provided if (input.limit !== undefined && (typeof input.limit !== 'number' || input.limit < 0)) { throw new Error('limit must be a non-negative number'); } // Validate since if provided if (input.since !== undefined && (typeof input.since !== 'number' || input.since < 0)) { throw new Error('since must be a non-negative timestamp'); } const filter: ConsoleOutputFilter = { limit: input.limit, category: input.category, since: input.since, }; const entries = consoleManager.getOutput(filter); const totalBuffered = consoleManager.size(); return { entries, total_buffered: totalBuffered, }; } - src/tools/get-console-output.ts:5-15 (schema)Input schema: GetConsoleOutputInput with optional limit, category (console/stdout/stderr), and since timestamp fields.
export interface GetConsoleOutputInput { limit?: number; category?: DAPOutputCategory; since?: number; } export interface GetConsoleOutputOutput { entries: ConsoleOutput[]; total_buffered: number; error?: string; } - Output schema: GetConsoleOutputOutput with entries array, total_buffered count, and optional error string.
export interface GetConsoleOutputOutput { entries: ConsoleOutput[]; total_buffered: number; error?: string; } - src/tools/get-console-output.ts:67-93 (registration)Tool schema registration object (getConsoleOutputTool) defining name 'get_console_output', description, and inputSchema for MCP.
export const getConsoleOutputTool = { name: 'get_console_output', description: 'Get console output from Godot debug session. ' + 'Returns print() statements, errors, and warnings captured during scene execution. ' + 'Requires an active debug session (run a scene with F5 in Godot). ' + 'Use to debug runtime behavior, check print output, or monitor warnings.', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: 'Maximum number of entries to return (most recent). Default: all buffered.', }, category: { type: 'string', enum: ['console', 'stdout', 'stderr'], description: 'Filter by output category. console=print(), stdout=standard out, stderr=errors.', }, since: { type: 'number', description: 'Unix timestamp (ms). Only return entries after this time.', }, }, required: [], }, }; - src/index.ts:148-163 (registration)CallToolRequestSchema handler in main server that dispatches 'get_console_output' by calling getConsoleOutput() with lazy DAP connection.
if (name === 'get_console_output') { // Lazy connect: try to connect to DAP if not already connected await tryConnectDAP(); const input = args as unknown as GetConsoleOutputInput; const result = getConsoleOutput(consoleManager, isDAPConnected, input); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }