microsoft/autogen · error · Error

Failed to list MCP resources

Error message

Failed to list MCP resources

What it means

Generic wrapper for any other HttpResponseError from the Azure AI Search service during client init or search (status codes other than 401/403): typical examples are 400 bad request (bad api_version, malformed query), 404 endpoint/index path, or 5xx service errors. The raw service message is embedded via str(e).

Source

Thrown at python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts:121

      gallery.config.components.workbenches?.filter(
        (workbench): workbench is Component<McpWorkbenchConfig> =>
          workbench.provider.includes("McpWorkbench") ||
          (workbench.config as any)?.server_params !== undefined
      ) || []
    );
  }

  // MCP Server operations (new functionality)
  async listResources(serverParams: McpServerParams) {
    const response = await fetch(`${this.getBaseUrl()}/mcp/resources/list`, {
      method: "POST",
      headers: this.getHeaders(),
      body: JSON.stringify({ server_params: serverParams }),
    });

    const data = await response.json();
    if (!response.ok) {
      throw new Error(data.message || "Failed to list MCP resources");
    }

    return data;
  }

  async getResource(serverParams: McpServerParams, uri: string) {
    const response = await fetch(`${this.getBaseUrl()}/mcp/resources/get`, {
      method: "POST",
      headers: this.getHeaders(),
      body: JSON.stringify({
        server_params: serverParams,
        uri: uri,
      }),
    });

    const data = await response.json();
    if (!response.ok) {
      throw new Error(data.message || "Failed to get MCP resource");

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Read the embedded service message in str(e) — Azure's error text names the exact problem.
  2. If it's an api_version complaint, set `api_version` in AzureAISearchConfig to one the service supports (check the portal or try a current stable version).
  3. For 5xx/429 transient codes, retry with backoff; the tool does not retry on its own.
  4. For 400s about semantic/vector options, align query_type, semantic_config_name and vector_fields with what the index actually defines.

Example fix

# before
config = AzureAISearchConfig(..., api_version="2023-07-01-Preview")  # 400 on newer services

# after
config = AzureAISearchConfig(..., api_version="2024-07-01")
Defensive patterns

Strategy: retry

Try / catch

import asyncio

async def run_with_retry(tool, query, attempts=3):
    for i in range(attempts):
        try:
            return await tool.run(query)
        except ValueError as e:
            status = getattr(e.__cause__, "status_code", None)
            if status and 500 <= status < 600 and i < attempts - 1:
                await asyncio.sleep(2 ** i)
                continue
            raise

Prevention

When it happens

Trigger: SearchClient/search call returning an HTTP error other than 401/403 — most often a wrong `api_version` for the service (400 with 'The requested API version is invalid'), a semantically misconfigured query, or a transient 5xx.

Common situations: Default api_version drifting from what the service accepts as it evolves; semantic query_type without a semantic configuration on the index; preview-only features requested with a stable api_version.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/3c1a8d47d463783c. Report an issue: GitHub.