{"record":{"id":"b521544af2f934e2","repo":"microsoft/autogen","slug":"failed-to-get-mcp-capabilities","errorCode":null,"errorMessage":"Failed to get MCP capabilities","messagePattern":"Failed to get MCP capabilities","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts","lineNumber":194,"sourceCode":"    if (!response.ok) {\n      throw new Error(data.message || \"Failed to get MCP prompt\");\n    }\n\n    return data;\n  }\n\n  async getCapabilities(\n    serverParams: McpServerParams\n  ): Promise<GetCapabilitiesResponse> {\n    const response = await fetch(`${this.getBaseUrl()}/mcp/capabilities/get`, {\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 get MCP capabilities\");\n    }\n\n    return data;\n  }\n\n  async listTools(serverParams: McpServerParams): Promise<ListToolsResponse> {\n    const response = await fetch(`${this.getBaseUrl()}/mcp/tools/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 tools\");\n    }\n\n    return data;","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts#L176-L212","documentation":"Raised during vector search execution when vector_fields are configured and the resolved SearchQuery has empty/missing query text. Client-side embeddings need non-empty input text to vectorize; an empty string cannot produce a meaningful vector, so the tool refuses before calling the embedding provider.","triggerScenarios":"Invoking run() with SearchQuery(query=\"\") or a whitespace query while vector_fields is set on the config (including the server-side path, since the check happens before choosing client vs server vectorization).","commonSituations":"Constructing SearchQuery with query=None defaulting to empty; building the query from an empty extraction (e.g. empty document chunk); a dict {'query': ''} forwarded from an agent.","solutions":["Ensure the query string is non-empty before calling the tool when vector search is enabled.","If empty queries are legitimate in your flow, short-circuit them before the tool call and return empty results.","Debug where the empty query originates — usually upstream text processing returning ''."],"exampleFix":"# before\nawait tool.run(SearchQuery(query=user_text))  # user_text == \"\" with vector_fields set\n\n# after\nresults = (\n    await tool.run(SearchQuery(query=user_text))\n    if user_text and user_text.strip()\n    else SearchResults(results=[], metadata={})\n)","handlingStrategy":"validation","validationCode":"def vector_query_ok(query_text: str, vector_fields) -> bool:\n    return not vector_fields or bool(query_text and query_text.strip())","typeGuard":null,"tryCatchPattern":"try:\n    results = await tool.run(SearchQuery(query=q))\nexcept ValueError as e:\n    if \"cannot be empty for vector search\" in str(e):\n        return SearchResults(results=[], metadata={\"reason\": \"empty vector query\"})\n    raise","preventionTips":["When vector_fields is enabled, gate every tool call on a non-empty query string.","Log empty queries — they usually indicate an upstream extraction bug worth fixing."],"tags":["python","validation","vector-search","azure-ai-search"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}