Skip to main content
Glama

Get Compiler Diagnostics

get_diagnostics
Read-onlyIdempotent

Compiles every C# project in the session in memory to return compiler errors, warnings, and info without a build. Use it after editing .cs files to check diagnostics.

Instructions

Compiler errors and warnings without a build: every C# project of the session is compiled in memory, in seconds. list_insights reports design findings instead.

Use it after editing .cs files: refresh_session, THEN this - the diagnostics come from the session's snapshot, not from disk, and an answer known to be behind the disk leads with verdict:'stale'. After a build call refresh_session(force: true); a restore needs no force.

Returns verdict (only when stale or inconclusive), projectsScanned, errorCount, warningCount, infoCount and diagnostics: at most 200 items (id, severity, message, location, category, project), while the counts cover the full set; with errors, the default lists only them (warningsNotListed). A multi-targeted project reports a diagnostic once; #pragma-suppressed ones are excluded. No analyzer runs, the SDK's included; source generators that load do run.

Disclosures say what the counts leave out:

  • incompleteProjects, incompleteRatio, suppressedDiagnosticsTotal: projects whose core references did not resolve (e.g. no targeting pack). Their diagnostics are counted, not listed. Read that total as a MAGNITUDE, not as one half of a ratio with errorCount. verdict:'inconclusive' + reliable:false fire only when a strict majority of projects is incomplete.

  • cascadeFromIncomplete:true on an item: inherited from an incomplete project.

  • generatedCodeGaps: code a source generator or the WPF markup compiler writes is missing.

  • designTimeBuildFailures: MSBuild reported a failure loading a project (a warning reads alike); its compiler options may be incomplete.

  • suppressors: references whose DiagnosticSuppressors a real build runs (see runSuppressors).

Needs a live session (a recalled one is rejected); writes nothing. scope: 'solution' or a case-insensitive substring of an item's location - for a file under the solution folder its relative path, with the OS separator (backslash on Windows). It filters the ANSWER, not the work: every project is compiled either way.

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": {
      "sessionId": "<sessionId>"
    },
    "name": "get_diagnostics"
  }
}

Input Schema

NameRequiredDescriptionDefault
scopeNo'solution' (default) or a file-path substring (e.g. 'MyApp.Core' or 'Settings.cs') that filters the RESULT. It is matched against a diagnostic's location as the answer prints it, so a directory separator is a backslash on Windows. It does not reduce the work: all projects are compiled either way (see the tool description) - it saves response tokens, not latency.solution
sessionIdYesThe session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use.
severityFloorNoMinimum severity to include: 'auto' (default), 'error', 'warning', 'info', or 'hidden'. 'auto' counts warnings as 'warning' does, but when the compile has errors it lists only the errors (warningsNotListed says how many warnings it left out of the list); 'warning' lists both.auto
runSuppressorsNoRun the DiagnosticSuppressors the projects' analyzer references declare, as a real build does, so a diagnostic they suppress is not counted. Off by default: a suppressor is code of the analyzed solution and runs inside this server (see SECURITY.md); the answer's suppressors member says where it would matter.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.5.46516
    • addedInput schema / properties / runSuppressors
      Added value: +{
      +  "default": false,
      +  "description": "Run the DiagnosticSuppressors the projects' analyzer references declare, as a real build does, so a diagnostic they suppress is not counted. Off by default: a suppressor is code of the analyzed solution and runs inside this server (see SECURITY.md); the answer's suppressors member says where it would matter.",
      +  "type": "boolean"
      +}
    • changedInput schema / properties / severityFloor / default
      Previous value: -"warning"New value: +"auto"
    • changedInput schema / properties / severityFloor / description
      Previous value: -"Minimum severity to include: 'error', 'warning' (default), 'info', or 'hidden'."New value: +"Minimum severity to include: 'auto' (default), 'error', 'warning', 'info', or 'hidden'. 'auto' counts warnings as 'warning' does, but when the compile has errors it lists only the errors (warningsNotListed says how many warnings it left out of the list); 'warning' lists both."
  2. Changed2 schema fields changedv0.5.46513
    • changedInput schema / properties / scope / description
      Previous value: -"'solution' (default) or a file-path substring (e.g. 'MyApp.Core' or 'Services/') that filters the RESULT. It does not reduce the work: all projects are compiled either way (see the tool description) - it saves response tokens, not latency."New value: +"'solution' (default) or a file-path substring (e.g. 'MyApp.Core' or 'Settings.cs') that filters the RESULT. It is matched against a diagnostic's location as the answer prints it, so a directory separator is a backslash on Windows. It does not reduce the work: all projects are compiled either way (see the tool description) - it saves response tokens, not latency."
    • changedInput schema / properties / sessionId / description
      Previous value: -"The session_id returned by analyze_solution."New value: +"The session_id returned by analyze_solution. Also takes an absolute .sln/.slnx/.slnf path, analyzed on first use."
  3. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Goes far past the annotations: no analyzer runs (SDK's included), loadable source generators do run, 200-item list cap while counts cover the full set, multi-target dedup, #pragma exclusions, live-session requirement with recalled sessions rejected, and a bulleted disclosure list (incompleteProjects, cascadeFromIncomplete, generatedCodeGaps, designTimeBuildFailures, suppressors) explaining how to read each field, including the warning to treat suppressedDiagnosticsTotal as a magnitude not a ratio half.

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?

Front-loaded with the core purpose and call ordering, then structured into return shape and a bulleted caveat list. It is long, and portions (scope substring matching, severityFloor 'auto' behavior) restate the schema almost verbatim, but nearly every sentence carries distinct information.

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?

There is no output schema, so the description carries the full burden of explaining return values — and it does: verdict, projectsScanned, errorCount/warningCount/infoCount, the diagnostics item shape, the listing-vs-counting asymmetry, and the meaning of each disclosure field. Nothing needed to interpret the result is 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 genuine meaning beyond it: 'It filters the ANSWER, not the work: every project is compiled either way,' and the note that suppressors are solution code executed inside the server (pointing at SECURITY.md). Some of the scope/severityFloor text duplicates the schema descriptions, which keeps this below 5.

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?

States a specific verb+resource+mechanism: 'Compiler errors and warnings without a build: every C# project of the session is compiled in memory, in seconds.' It also explicitly distinguishes itself from the nearest sibling, list_insights, which 'reports design findings instead.'

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?

Gives an explicit ordering ('refresh_session, THEN this'), the reason (diagnostics come from the session snapshot, not disk), the behavior when stale, and the exception for builds vs restores (refresh_session(force: true)). It also names the alternative tool for a different class of question.

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