getGameDebugInfoWithLogsAndVisualization
Retrieve debug data, logs, and visualizations to analyze browser-based game performance and behavior for troubleshooting and optimization.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeSvg | No |
Implementation Reference
- mcp.js:214-289 (handler)Handler function that increments request counters, checks for latestCapture, formats console logs and errors into text, optionally appends SVG visualization, and returns structured MCP content.}, async ({ includeSvg }) => { mcpRequestCount++; if (!includeSvg) { mcpRequestWithoutSvgCount++; } // Simply use the latest capture if (!latestCapture) { // Return basic response when no data is available return { success: false, content: [{ type: "text", text: "No game data available yet." }] }; } // Use the capture directly const capture = latestCapture; // Remove SVG if not explicitly requested if (!includeSvg && capture.vectorized) { delete capture.vectorized.svg; } // Extract console logs for easier viewing const consoleLogs = capture.console_logs.map(log => ({ time: new Date(log.timestamp).toISOString(), message: log.data.join(' ') })); // Extract errors if any const errors = capture.console_errors.map(err => ({ time: new Date(err.timestamp).toISOString(), message: err.data.join(' ') })); // Format the data for better MCP display // Create a text representation of the game state const textContent = ` Game State: ${capture.id} (${new Date(capture.timestamp).toISOString()}) Console Logs: ${consoleLogs.map(log => `[${log.time}] ${log.message}`).join('\n')} ${errors.length ? 'Errors:\n' + errors.map(err => `[${err.time}] ${err.message}`).join('\n') : 'No errors.'} ${capture.unhandled_exception ? `\nUnhandled Exception:\n${JSON.stringify(capture.unhandled_exception, null, 2)}` : ''} `; // Return in MCP-compatible format // Prepare result object const result = { success: true, content: [ { type: "text", text: textContent } ] }; // Only add SVG if we have it and it was requested if (capture.vectorized?.svg && includeSvg) { try { // Add SVG as text directly in the response result.content[0].text += "\nSVG Approximation:\n```svg\n" + capture.vectorized.svg + "\n```"; } catch (error) { console.error("Error with SVG data:", error); // Add error note to text content result.content[0].text += "\n\nError processing SVG data"; } } return result; });
- mcp.js:213-213 (schema)Input schema using Zod: optional boolean 'includeSvg' parameter defaulting to true, controlling whether SVG visualization is included in the response.includeSvg: z.boolean().optional().default(true)
- mcp.js:212-214 (registration)Registration of the tool 'getGameDebugInfoWithLogsAndVisualization' on the McpServer instance, specifying input schema and providing inline async handler function.mcpServer.tool("getGameDebugInfoWithLogsAndVisualization", { includeSvg: z.boolean().optional().default(true) }, async ({ includeSvg }) => {