Skip to main content
Glama

get_diagnostics

Check GDScript files for syntax errors, type issues, and code quality problems by analyzing .gd files with the Godot Language Server. Identify and resolve coding issues in individual scripts.

Instructions

Retrieve errors, warnings, and diagnostic messages for a GDScript (.gd) file from the Godot Language Server. Returns syntax errors, type errors, and code quality issues. Fast operation (<1s). Use this to check individual .gd files for problems. For workspace-wide scanning, use scan_workspace_diagnostics instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesAbsolute path to the GDScript (.gd) file to analyze for errors, warnings, and issues.

Implementation Reference

  • Core handler function that executes the get_diagnostics tool logic: validates input file_path, checks LSP connection status, and fetches diagnostics for the specific GDScript file using DiagnosticsManager.
    export async function getDiagnostics( diagnosticsManager: DiagnosticsManager, isConnected: boolean, input: GetDiagnosticsInput ): Promise<GetDiagnosticsOutput> { const { file_path } = input; // Validate input if (!file_path) { throw new Error('file_path is required. Use scan_workspace_diagnostics for workspace-wide checks.'); } if (!file_path.endsWith('.gd')) { throw new Error('file_path must be a .gd file'); } // Check if LSP is connected if (!isConnected) { return { diagnostics: {}, error: `Godot LSP is not running. Please ask the user to start Godot with their project: CLI: godot --editor --path /path/to/project GUI: Open the project in Godot Editor The Language Server Protocol must be enabled (default: ON) in: Project → Project Settings → Network → Language Server Once Godot is running, diagnostics will be available automatically.`, }; } // Get diagnostics for specific file const fileDiagnostics = await diagnosticsManager.getFileDiagnostics(file_path); return { diagnostics: { [file_path]: fileDiagnostics } }; }
  • MCP tool schema definition for get_diagnostics, including name, description, and inputSchema for parameter validation.
    export const getDiagnosticsTool = { name: 'get_diagnostics', description: 'Retrieve errors, warnings, and diagnostic messages for a GDScript (.gd) file from the Godot Language Server. Returns syntax errors, type errors, and code quality issues. Fast operation (<1s). Use this to check individual .gd files for problems. For workspace-wide scanning, use scan_workspace_diagnostics instead.', inputSchema: { type: 'object', properties: { file_path: { type: 'string', description: 'Absolute path to the GDScript (.gd) file to analyze for errors, warnings, and issues.', }, }, required: ['file_path'], }, };
  • TypeScript type definitions for input and output of the get_diagnostics tool.
    export interface GetDiagnosticsInput { file_path?: string; } export interface GetDiagnosticsOutput { diagnostics: Record<string, Diagnostic[]>; error?: string; }
  • src/index.ts:62-64 (registration)
    Registers the get_diagnostics tool in the MCP server's ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [getDiagnosticsTool, scanWorkspaceDiagnosticsTool], }));
  • MCP server dispatch handler for get_diagnostics tool calls, invoking the core handler and formatting the response.
    if (name === 'get_diagnostics') { const input = args as unknown as GetDiagnosticsInput; const result = await getDiagnostics(diagnosticsManager, isConnected, input); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ryanmazzolini/minimal-godot-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server