Problem
Current large query results are sent entirely to LLMs, causing:
- Token waste
- Performance issues
- No reusable outputs for downstream workflows
Solution
Add export_to_json tool that:
- Streams results directly to filesystem
- Returns only minimal metadata to LLM:
{
"success": true,
"file_path": "/exports/query_12345.json",
"count": 15000,
"sample": [first_3_docs]
}
- Preserves data for:
- Visualization tools
- Subsequent MCP processing
- Human verification