Skip to main content
Glama

Get Compiler Diagnostics

get_diagnostics
Read-onlyIdempotent

Fetch compiler errors and warnings from a C# session snapshot without a build. Filter results by scope or severity.

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 restore or build call refresh_session(force: true): an unforced refresh can answer 'unchanged'.

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. 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, because a judgement that triggers on every partly-restored solution is one a caller learns to ignore.

  • 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.

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. Use scope to save context tokens, never to save time.

Input Schema

TableJSON 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: 'error', 'warning' (default), 'info', or 'hidden'.warning

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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."
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations declare readOnlyHint=true, idempotentHint=true, destructiveHint=false, so safety is covered. The description builds on that with rich behavior no structured field captures: snapshot-based rather than disk-based results, verdict:'stale' semantics, the #pragma exclusion, the 200-item cap with full counts, incompleteProjects magnitude caveat, cascadeFromIncomplete propagation, generatedCodeGaps, and designTimeBuildFailures. This is well beyond the annotation bar.

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 primary purpose, then sequencing, then the verdict/return contract, then disclosures. Dense but the disclosures block is a long list of caveats that, while valuable, makes the description heavy. Structure is logical and every clause earns its place, but the volume is near the upper limit for one tool.

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 tool with 3 params, no output schema, and complex return semantics, the description supplies the return shape (verdict, projectsScanned, counts, up-to-200 diagnostics), the meaning of stale/inconclusive verdicts, and the caveats behind the counts. An agent has everything needed to call it and interpret the result correctly.

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 baseline is 3. The description adds real meaning for scope beyond the schema: it filters the answer not the work, every project compiles either way, and the token-saving intent is stated. severityFloor is left entirely to the schema, which is fine given full coverage, but the scope nuance is a genuine addition.

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 description opens with a specific verb+resource: compiler errors and warnings, compiled in memory without a build. It explicitly distinguishes itself from sibling list_insights, which reports design findings instead. An agent can tell what this tool does and how it differs from adjacent tools.

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?

Explicit when-to-use sequencing: 'after editing .cs files: refresh_session, THEN this'. Names the stale-answer failure mode, tells the agent to call refresh_session(force:true) after restore/build, and warns that an unforced refresh may answer 'unchanged'. Also states the tool needs a live session and rejects a recalled one. This is strong routing and prerequisite guidance.

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