Skip to main content
Glama

Get Compiler Diagnostics

get_diagnostics
Read-onlyIdempotent

Compile all C# projects in the session in memory to get compiler errors and warnings without a build. Call refresh_session after editing .cs files, then run this to check the updated snapshot.

Instructions

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

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

Returns verdict (when stale or inconclusive), projectsScanned, errorCount, warningCount, infoCount and diagnostics: at most 200 items (counts cover all; see severityFloor). A multi-targeted project reports a diagnostic once; #pragma-suppressed ones are excluded. No analyzer runs, not even the SDK's; source generators that load do run.

Disclosures:

  • incompleteProjects, incompleteRatio, suppressedDiagnosticsTotal: projects whose core references did not resolve (an entry's cause names the remedy). Their diagnostics are counted, not listed; that total is a MAGNITUDE, not a ratio with errorCount. verdict:'inconclusive' + reliable:false: most projects are incomplete.

  • projectsWithoutCode: unresolved, no code, not counted.

  • unrestoredProjects (missingTarget, restoreCommand): restore output does not serve them.

  • referencedProjectsWithoutCode: resolved, compiled empty; dependents' diagnostics counted.

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

  • generatedCodeGaps: source-generator or WPF markup-compiler output is missing.

  • unloadedProjectReferences (an unbuilt F#/VB or a C++ reference), resourcesWithoutGeneratedClass, languageVersionGap (a compiler older than the code).

  • designTimeBuildFailures: MSBuild failed or warned loading a project (options may be incomplete).

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

  • projectsNotBuiltBySolution: counted errors a solution build never reports (item: notBuiltBySolution).

Needs a live session; writes nothing.

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 - 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. The answer's severityFloor names the floor the counts used, so 'auto' answers 'warning'; warningsNotListed stands wherever 'auto' listed less.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. Changed2 schema fields changedv0.5.46521
    • changedInput schema / properties / scope / description
      Previous 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."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 - it saves response tokens, not latency."
    • changedInput schema / properties / severityFloor / description
      Previous 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."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. The answer's severityFloor names the floor the counts used, so 'auto' answers 'warning'; warningsNotListed stands wherever 'auto' listed less."
  2. 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."
  3. 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."
  4. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Goes well beyond the annotations: it discloses that it compiles the session snapshot rather than disk (verdict:'stale'), that no analyzer runs but loaded source generators do, that the list is capped at 200 while counts cover all, and that suppressors can execute solution code. The Disclosures block enumerates many failure modes (incompleteProjects, unrestoredProjects, cascadeFromIncomplete, designTimeBuildFailures) with their remedies. Minor gap: it never says how long a compile typically takes for a large solution or whether concurrent calls are safe, despite the 'in seconds' claim.

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 the when-to-use ordering before any return-value detail, which is the right structure. The Disclosures section is dense and long, but each bullet names a distinct failure mode an agent must interpret, so the length is largely earned rather than padded.

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, and the description compensates fully by enumerating the returned members (verdict, projectsScanned, errorCount, warningCount, infoCount, diagnostics) and explaining how to read the ambiguous ones. Combined with the caveat disclosures, an agent has enough to call it and interpret the response correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already carries the parameter meaning and a baseline of 3 applies. The description adds one useful cross-cutting fact — the 200-item list cap with counts covering everything, and that 'auto' degrades to errors-only when the compile fails — but it defers to the schema ('see severityFloor') rather than extending scope or runSuppressors semantics.

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 and resource ('compiler errors and warnings without a build'), plus the mechanism ('every C# project of the session is compiled in memory, in seconds'). It explicitly separates itself from the sibling list_insights ('For design findings: list_insights'), so an agent can route without opening a schema.

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 prerequisite chain ('after editing .cs files: refresh_session, THEN this') and an explicit post-build variant ('call refresh_session(force: true)'), including the nuance that a restore needs no force. It also names the alternative tool and the condition that selects it.

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