scan_workspace_diagnostics
Scans all .gd files in the project directory for GDScript errors and warnings, excluding addons and .godot folders. Returns a complete list of diagnostics across the workspace.
Instructions
Scan entire workspace for GDScript errors across all .gd files (~1-2s for 100+ files). Returns errors from all .gd files excluding addons/ and .godot/. Use to find all errors/warnings in the project. For single-file checks, use get_diagnostics instead (<1s).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function that scans the entire workspace for GDScript diagnostics. Calls diagnosticsManager.scanWorkspace() and returns results with file counts and scan timing.
export async function scanWorkspaceDiagnostics( diagnosticsManager: DiagnosticsManager, isConnected: boolean ): Promise<ScanWorkspaceOutput> { // Check if LSP is connected if (!isConnected) { return { files_scanned: 0, files_with_issues: 0, scan_time_seconds: 0, diagnostics: {}, error: LSP_NOT_RUNNING_ERROR, }; } const startTime = Date.now(); const diagnostics = await diagnosticsManager.scanWorkspace(); const scanTime = ((Date.now() - startTime) / 1000).toFixed(2); const filesScanned = Object.keys(diagnostics).length; const filesWithIssues = Object.values(diagnostics).filter((d) => d.length > 0).length; return { files_scanned: filesScanned, files_with_issues: filesWithIssues, scan_time_seconds: parseFloat(scanTime), diagnostics, }; } - Output type definition for the scan_workspace_diagnostics tool: files_scanned, files_with_issues, scan_time_seconds, diagnostics map, and optional error.
export interface ScanWorkspaceOutput { files_scanned: number; files_with_issues: number; scan_time_seconds: number; diagnostics: Record<string, Diagnostic[]>; error?: string; } - src/tools/scan-workspace-diagnostics.ts:49-61 (registration)Tool definition/schema object for MCP registration with name 'scan_workspace_diagnostics', description, and input schema (no inputs required).
export const scanWorkspaceDiagnosticsTool = { name: 'scan_workspace_diagnostics', description: 'Scan entire workspace for GDScript errors across all .gd files (~1-2s for 100+ files). ' + 'Returns errors from all .gd files excluding addons/ and .godot/. ' + 'Use to find all errors/warnings in the project. ' + 'For single-file checks, use get_diagnostics instead (<1s).', inputSchema: { type: 'object', properties: {}, required: [], }, }; - src/index.ts:108-115 (registration)Registration of the tool in the MCP server's list of available tools via ListToolsRequestSchema handler.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ getDiagnosticsTool, scanWorkspaceDiagnosticsTool, getConsoleOutputTool, clearConsoleOutputTool, ], })); - src/index.ts:135-146 (registration)Tool call handler that dispatches to scanWorkspaceDiagnostics when name === 'scan_workspace_diagnostics'.
if (name === 'scan_workspace_diagnostics') { const result = await scanWorkspaceDiagnostics(diagnosticsManager, isConnected); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }