Skip to main content
Glama

Ask the GDScript or C# language server

godot_code
Idempotent

Analyze 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

NameRequiredDescriptionDefault
opYesdiagnostics, hover, definition, references, symbols or completion
codeNounsaved GDScript or C# to analyse as `file` instead of the file on disk; nothing is written
fileNothe .gd or .cs file: res:// path or a path (diagnostics without it: every GDScript)
lineNo1-based line (hover, definition, references, completion)
pathNoproject folder, or a file or folder inside it (relative to the server's folder; default: the current project)
limitNocompletion: most items shown (default 40)
columnNo1-based column; a tab is one column (hover, definition, references, completion)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.9.0
    • changedInput schema / properties / code / description
      Previous value: -"unsaved GDScript to analyse as `file` instead of the file on disk; nothing is written"New value: +"unsaved GDScript or C# to analyse as `file` instead of the file on disk; nothing is written"
    • changedInput schema / properties / column / description
      Previous value: -"1-based column; a tab is one column (hover, definition, completion)"New value: +"1-based column; a tab is one column (hover, definition, references, completion)"
    • changedInput schema / properties / file / description
      Previous value: -"the .gd file: res:// path or a path (diagnostics without it: every script)"New value: +"the .gd or .cs file: res:// path or a path (diagnostics without it: every GDScript)"
    • changedInput schema / properties / line / description
      Previous value: -"1-based line (hover, definition, completion)"New value: +"1-based line (hover, definition, references, completion)"
    • changedInput schema / properties / op / description
      Previous value: -"diagnostics, hover, definition or completion"New value: +"diagnostics, hover, definition, references, symbols or completion"
    • changedInput schema / properties / op / enum
      Previous value: -[
      -  "diagnostics",
      -  "hover",
      -  "definition",
      -  "completion"
      -]New value: +[
      +  "diagnostics",
      +  "hover",
      +  "definition",
      +  "references",
      +  "symbols",
      +  "completion"
      +]
  2. Addedv0.6.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond the annotations, it discloses the warm-cache latency (first call takes seconds, kept warm 10 minutes), the import side effects on .godot/ plus added .import and .uid files, restart triggers for new class_name, changed project.godot or new assets, and the C# server's install/restart behavior. These are exactly the operational facts an agent needs and are not inferable from the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The first sentence is front-loaded with the core promise, and the op-by-op breakdown is ordered and information-dense. It is a long paragraph with heavy parentheticals, so readability suffers slightly, but nearly every sentence carries actionable detail rather than filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 7-parameter tool with no output schema, the description covers the important gaps: what each op returns, required prerequisites for the C# path, side effects on the project directory, server restart conditions, and when to use alternatives. Nothing an agent needs in order to call it correctly appears to be missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds op-specific meaning: diagnostics format, definition returning res://file:line or an engine symbol, references being code-only, completion covering members after a dot and node paths after $, and code analyzing unsaved text as the named file. It also clarifies that a tab counts as one column, which matters for line/column accuracy.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names the specific engine-backed resource ('Godot 4.7's own GDScript language server') and enumerates all six operations with what each returns. It also distinguishes the tool from siblings by naming godot_usages, godot_review and godot_check where their scopes differ.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit routing rules: 'Without Godot use godot_review; to load scenes too use godot_check' and 'godot_usages adds scenes and resources' for references. The C# path also states its own prerequisite (csharp-ls installed and the project built or restored once), so an agent knows when this tool is and is not the right choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.