MCP tool responses return empty results for some tools while others work
Summary
The VectorCode MCP server's query tool returns empty results ({"result":[]}) when called through Claude Code, while other tools from the same server (like ls) work correctly. The server itself returns valid data when tested directly via stdio.
Reproduction Steps
- Configure an MCP server in
~/.mcp.json:
{
"mcpServers": {
"vectorcode": {
"command": "vectorcode-mcp-server",
"args": []
}
}
}
- Start Claude Code and call the
lstool:
mcp__vectorcode__ls()
Result: Returns valid data:
{"result":["/home/michel/Sites/unicstay/vacation"]}
- Call the
querytool:
mcp__vectorcode__query(query_messages=["booking"], n_query=2, project_root="/home/michel/Sites/unicstay/vacation")
Result: Returns empty:
{"result":[]}
- Test the same query directly via stdio to the server:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"capabilities":{}}}
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"query","arguments":{"query_messages":["booking"],"n_query":2,"project_root":"/home/michel/Sites/unicstay/vacation"}}}' | vectorcode-mcp-server
Result: Returns valid results:
{"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"{'path': './tests/Unit/BookingPreviewTest.php', ...}"}]}}
Expected Behavior
The query tool should return the same results through Claude Code that it returns when called directly via stdio.
Actual Behavior
lstool: Works correctlyquerytool: Returns empty{"result":[]}
Both tools use the same MCP server and connection. The server returns valid JSON-RPC responses for both, but Claude Code only parses the ls response correctly.
Environment
- Claude Code version: 2.1.31
- OS: Fedora Linux 43 (Linux 6.18.7)
- MCP server: VectorCode MCP server (FastMCP-based, Python)
Additional Context
The VectorCode MCP server is built with FastMCP (official MCP Python SDK). Both tools are exposed via the same @mcp.tool() decorator pattern. The ls tool returns a simple list of paths, while query returns a list of dictionaries with file paths and content.
This suggests the issue may be related to how Claude Code's MCP client parses certain response formats - specifically responses containing nested structures or larger text content.
Workaround
Using the CLI directly works:
cd /project/path && vectorcode query "keywords" -n 5This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗