Skip to content

Build action should include compiler error messages in the response #425

@jongalloway

Description

@jongalloway

Summary

When the dotnet_project tool's Build action fails, the response includes a structured summary with error/warning counts but does not include the actual compiler error messages. This forces the caller to fall back to running dotnet build via the terminal to extract the error text.

Reproduction

  1. Introduce a compile error (e.g., use an unresolved type like IRenderable without the required using directive)
  2. Call the MCP dotnet_project Build action
  3. Observe the response:
{
  "action": "build",
  "buildResult": {
    "success": false,
    "project": "...",
    "configuration": "Debug",
    "warningCount": 0,
    "errorCount": 1,
    "summary": "Build FAILED (1 errors, 0 warnings)"
  }
}

Expected behavior

The response should include the actual error messages, e.g.:

{
  "action": "build",
  "buildResult": {
    "success": false,
    "project": "...",
    "configuration": "Debug",
    "warningCount": 0,
    "errorCount": 1,
    "summary": "Build FAILED (1 errors, 0 warnings)",
    "errors": [
      {
        "file": "NewsletterApp.Rendering.cs",
        "line": 9,
        "column": 51,
        "code": "CS0246",
        "message": "The type or namespace name 'IRenderable' could not be found (are you missing a using directive or an assembly reference?)"
      }
    ]
  }
}

Impact

Without errors in the response, the AI agent cannot diagnose and fix build failures using only the MCP tool - it must fall back to parsing raw CLI output, which defeats the purpose of the structured MCP interface.

This also applies to warnings when warningCount > 0.

Context

Encountered while upgrading Spectre.Console from 0.54.0 to 0.55.0 in another project. The new version moved IRenderable to the Spectre.Console.Rendering namespace, causing a CS0246. The MCP Build response told me the build failed but not why.

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions