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

Aperta
#4,191 2 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
azure, csharp

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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)
Lingua principale
C#
Stelle
3.9k
Fork
689
Merge medio
2g 11h
PR unite (30g)
143

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/mcp

Tutte le issue di microsoft/mcp

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.