microsoft/autogen · warning · Error
Failed to get MCP capabilities
Error message
Failed to get MCP capabilities
What it means
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.
Source
Thrown at python/packages/autogen-studio/frontend/src/components/views/mcp/api.ts:194
if (!response.ok) {
throw new Error(data.message || "Failed to get MCP prompt");
}
return data;
}
async getCapabilities(
serverParams: McpServerParams
): Promise<GetCapabilitiesResponse> {
const response = await fetch(`${this.getBaseUrl()}/mcp/capabilities/get`, {
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 get MCP capabilities");
}
return data;
}
async listTools(serverParams: McpServerParams): Promise<ListToolsResponse> {
const response = await fetch(`${this.getBaseUrl()}/mcp/tools/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 tools");
}
return data;View on GitHub (pinned to 027ecf0a37)
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 ''.
Example fix
# before
await tool.run(SearchQuery(query=user_text)) # user_text == "" with vector_fields set
# after
results = (
await tool.run(SearchQuery(query=user_text))
if user_text and user_text.strip()
else SearchResults(results=[], metadata={})
) Defensive patterns
Strategy: validation
Validate before calling
def vector_query_ok(query_text: str, vector_fields) -> bool:
return not vector_fields or bool(query_text and query_text.strip()) Try / catch
try:
results = await tool.run(SearchQuery(query=q))
except ValueError as e:
if "cannot be empty for vector search" in str(e):
return SearchResults(results=[], metadata={"reason": "empty vector query"})
raise Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- Failed to list MCP prompts
- vector_fields must contain at least one field name for vecto
- vector_fields must contain at least one field name for hybri
- vector_fields must be provided for vector search
- Failed to get login URL
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/b521544af2f934e2.
Report an issue: GitHub.