{"record":{"id":"c2096b1596cd9420","repo":"microsoft/autogen","slug":"failed-to-get-mcp-resource","errorCode":null,"errorMessage":"Failed to get MCP resource","messagePattern":"Failed to get MCP resource","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts","lineNumber":139,"sourceCode":"      throw new Error(data.message || \"Failed to list MCP resources\");\n    }\n\n    return data;\n  }\n\n  async getResource(serverParams: McpServerParams, uri: string) {\n    const response = await fetch(`${this.getBaseUrl()}/mcp/resources/get`, {\n      method: \"POST\",\n      headers: this.getHeaders(),\n      body: JSON.stringify({\n        server_params: serverParams,\n        uri: uri,\n      }),\n    });\n\n    const data = await response.json();\n    if (!response.ok) {\n      throw new Error(data.message || \"Failed to get MCP resource\");\n    }\n\n    return data;\n  }\n\n  async listPrompts(serverParams: McpServerParams) {\n    const response = await fetch(`${this.getBaseUrl()}/mcp/prompts/list`, {\n      method: \"POST\",\n      headers: this.getHeaders(),\n      body: JSON.stringify({ server_params: serverParams }),\n    });\n\n    const data = await response.json();\n    if (!response.ok) {\n      throw new Error(data.message || \"Failed to list MCP prompts\");\n    }\n\n    return data;","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts#L121-L157","documentation":"Last-resort wrapper raised when SearchClient initialization throws anything that is not ResourceNotFoundError or HttpResponseError — for example DNS resolution failure, SSL certificate error, missing required constructor argument, or a TypeError from a wrong credential type reaching the SDK. The original exception is chained as __cause__.","triggerScenarios":"Calling _get_client/run() with a malformed endpoint (e.g. missing https:// scheme, plain hostname that fails DNS), or passing config values whose types the SDK rejects, producing an unexpected exception type inside the constructor.","commonSituations":"Endpoint configured without scheme ('mysvc.search.windows.net' instead of 'https://mysvc.search.windows.net'); corporate proxies/SSL interception breaking TLS; offline environments where DNS fails; None values slipping into config fields.","solutions":["Inspect e.__cause__ — the true constructor error determines the fix.","Normalize the endpoint to a full URL: \"https://<service>.search.windows.net\".","Validate all required config fields (endpoint, index_name, credential) are non-None and correctly typed before constructing the tool.","For TLS/proxy issues, configure the corporate CA bundle or exclude the search endpoint from interception."],"exampleFix":"# before\nconfig = AzureAISearchConfig(endpoint=\"mysvc.search.windows.net\", ...)  # no scheme\n\n# after\nconfig = AzureAISearchConfig(endpoint=\"https://mysvc.search.windows.net\", ...)","handlingStrategy":"try-catch","validationCode":"from urllib.parse import urlparse\n\ndef endpoint_well_formed(endpoint: str) -> bool:\n    p = urlparse(endpoint)\n    return p.scheme == \"https\" and bool(p.netloc)","typeGuard":null,"tryCatchPattern":"try:\n    results = await tool.run(query)\nexcept ValueError as e:\n    cause = e.__cause__\n    if \"Unexpected error initializing\" in str(e) and cause is not None:\n        raise RuntimeError(f\"Search client init failed: {cause!r}\") from e\n    raise","preventionTips":["Validate the endpoint URL (scheme + host) in your settings model.","Always inspect e.__cause__ for this wrapper — the real error is never in the wrapper text."],"tags":["python","azure-ai-search","wrapper-exception","network"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}