[BUG] Azure MCP error responses are hard for agents to act on (KQL errors, command names, auth mislabelled as connectivity)

Abierto
#4,191 2 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
azure, csharp

Línea de trabajo

Start by tracing the implementations for monitor_resource_log_query, namespace command resolution, and azure-extension_cli_generate error handling; the issue names these entry points but not their source files. Compare their responses with the successful unknown-argument error, then run the three reproduction steps. Done means actionable structured errors, unique suffix matches handled in one call, and 400/401/403 responses no longer described as connectivity failures.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug needs-team-triage server-Azure.Mcp tools-AppLens tools-AppService tools-Authentication tools-AzCLI tools-Core tools-Monitor tools-ToolSelection
Describe the bug

Several Azure MCP error responses are hard for agents to act on, so agents retry blindly, abandon the tool, or fall back to az CLI. Each failed attempt keeps its error text in context, which adds turns and tokens.

Data from 140 Azure MCP-enabled trials (MCP-only and Skill+MCP arms) of the azure-diagnostics Azure Functions VNet evaluations in microsoft/GitHub-Copilot-for-Azure. Agent: GitHub Copilot CLI, gpt-5.6-sol, Azure MCP in namespace mode. Runs: 42935543800, 42942207249, 42945073201, 43118444840, 43289275378, 43345242602.

Out of 2,350 Azure MCP calls, 222 failed. "Recovered" means the agent's next call to the same tool succeeded.

Category Failures Recovered Main commands
KQL semantic/argument errors (400 BadArgumentError) 88 31 (35%) monitor_resource_log_query (79)
Command name not exposed by namespace 84 47 (56%) get (32), diagnose (28), get_best_practices (15)
Sensitive-data elicitation not supported / other 24 18 (75%) execute_resource_action, appservice_webapp_settings_get-appsettings
ARM NotFound 8 4 (50%) get_resource
Unknown arguments 7 7 (100%) applens_resource_diagnose (resourceId)
401/403 6 0 (0%) azure-extension_cli_generate (5)
400 reported as 503 5 (+15 later runs) appservice_webapp_diagnostic_diagnose, tracked in #4190

Specific problems:

  1. KQL errors bury the cause in a raw HTTP dump. monitor_resource_log_query returns about 2 KB per error, including the full Status/ErrorCode/Content/Headers dump. The actionable part is three levels down (innererror.innererror.message). Most were 'where' operator: Failed to resolve table or column expression named 'AppTraces': the agent queried a table that doesn't exist for that resource scope and wasn't told which tables do exist. Others were Arithmetic expression cannot be carried-out between R64 and TimeSpan (10). Only 35% recovered.
  2. Command-not-available errors are recoverable but expensive. The message lists available commands, which helps (56% recovery vs 35%). But unambiguous suffix matches (diagnose → applens_resource_diagnose, the only command) are still rejected and need a second round trip.
  3. 401 from azure-extension_cli_generate is labelled "Service unavailable or network connectivity issues" (status: 401, Response status code does not indicate success: 401 (Unauthorized)). None of these recovered.
  4. Unknown-argument errors work well: Request rejected due to unknown arguments: resourceId recovered 7/7. This is the model to follow.
Expected behavior
  • Error responses lead with a short, structured cause: status, code, the innermost service message, and, where possible, a hint (e.g. "table 'AppTraces' not found for this resource; available tables: …", or "use a workspace query for Application Insights tables").
  • Raw HTTP headers and diagnostic dumps are omitted or moved to a separate, optional field.
  • When a requested command uniquely matches one exposed command by suffix, either run it or return did you mean 'applens_resource_diagnose'? with its parameter schema, so the agent recovers in one call.
  • "Service unavailable or network connectivity issues" is used only for real 503s or connection failures, never for 400/401/403.
Actual behavior

See the table above. The agent's next call to the same tool succeeded after only 35% of KQL errors, 56% of command-name errors, and 0% of auth errors mislabelled as connectivity issues.

Example KQL error (truncated):

{"status":400,"message":"The request had some invalid properties\nStatus: 400 (Bad Request)\nErrorCode: BadArgumentError\n\nContent:\n{\"error\":{\"message\":\"The request had some invalid properties\",\"code\":\"BadArgumentError\",...,\"innererror\":{\"code\":\"SemanticError\",\"message\":\"A semantic error occurred.\",\"innererror\":{\"code\":\"SEM0100\",\"message\":\"'where' operator: Failed to resolve table or column expression named 'AppTraces'\"}}}}\n\nHeaders:\nDate: ...\nConnection: keep-alive\nVia: REDACTED\n...
Reproduction Steps
  1. Call monitor_resource_log_query against a Function App resource ID with AppTraces | where TimeGenerated > ago(1h).
  2. Call the applens namespace tool with command: "diagnose".
  3. Call azure-extension_cli_generate with a credential that receives a 401.
Environment
  • Azure MCP Server version: the eval runner starts npx -y @azure/mcp server start without a pinned version, so each run used the npm latest version at the time (fresh GitHub Actions runner, no npx cache). Based on run start times vs. npm publish times: 4.0.0-beta.6 for runs 42935543800, 42942207249, 42945073201 (2026-11-11 00:59–02:53Z); 4.0.0-beta.7 (published 2026-11-11 17:18Z) for runs 43118444840, 43289275378, 43345242602. The version is inferred because the runner doesn't log it.
  • Azure MCP Server (namespace mode) via GitHub Copilot CLI on Linux GitHub Actions runners; answer model gpt-5.6-sol
  • Related: #4190 (400 → 503 in App Service diagnose), #4068 (discovery/misselection), #3183 (namespace-mode token cost), #3200 (output-size telemetry)
Lenguaje dominante
C#
Estrellas
3.9k
Forks
689
Merge medio
2 d 11 h
PR fusionados (30 d)
143

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/mcp

Todos los issues de microsoft/mcp

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.