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

オープン
#4,191 コメント 2 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
azure, csharp

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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)
主要言語
C#
スター
3.9k
フォーク
689
平均マージ
2日 11時間
マージ済み PR(30日)
143

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/mcp のほかの issue

microsoft/mcp の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。