Ask the GDScript or C# language server
godot_codeAnalyze GDScript or C# code with Godot's language servers to return diagnostics, hovers, definitions, references, symbols, and completions, even for unsaved code.
Instructions
Engine-exact answers from Godot 4.7's own GDScript language server (kept warm for 10 minutes; the first call takes a few seconds). op diagnostics: errors and warnings at the project's warning levels, as res://x.gd:12:5: warning [UNUSED_VARIABLE] ..., for file or every script. op hover: the type or signature at line/column (1-based; a tab is one column). op definition: where the name there is declared, as res://file:line, or that it is an engine symbol. op references: every place the symbol there is used (code only; godot_usages adds scenes and resources). op symbols: what file declares. op completion: what can follow there (members after a dot, node paths after $), up to limit. Pass code to analyse unsaved text as file without writing it. A .cs file is answered by the C# language server csharp-ls instead (the same ops; diagnostics carry the compiler's code, as res://Player.cs:12:9: error [CS0103] ...); it needs no Godot, but the user must have installed csharp-ls and the project must have been built or restored once: when it is missing the answer names the install command and nothing else is affected. A changed .csproj or .sln restarts it; changed .cs files are told to it. For .gd files: needs Godot. Like opening the editor, Godot imports the project: it updates .godot/ and adds a missing .import file next to each asset and a missing .uid file next to each script. A new class_name, a changed project.godot or a new asset restarts the server. Without Godot use godot_review; to load scenes too use godot_check.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"op": "<op>"
},
"name": "godot_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | Yes | diagnostics, hover, definition, references, symbols or completion | |
| code | No | unsaved GDScript or C# to analyse as `file` instead of the file on disk; nothing is written | |
| file | No | the .gd or .cs file: res:// path or a path (diagnostics without it: every GDScript) | |
| line | No | 1-based line (hover, definition, references, completion) | |
| path | No | project folder, or a file or folder inside it (relative to the server's folder; default: the current project) | |
| limit | No | completion: most items shown (default 40) | |
| column | No | 1-based column; a tab is one column (hover, definition, references, completion) |