We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/brockwebb/open-census-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
test_final_fix.pyβ’1.96 KiB
#!/usr/bin/env python3
"""Test the fixed search with geographic field filtering"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
def test_fixed_search():
"""Test search after filtering geographic fields"""
print("π§ Testing search with geographic field filtering...")
try:
from kb_search import ConceptBasedCensusSearchEngine
engine = ConceptBasedCensusSearchEngine()
# Test the specific case that was failing
print("\\nπ― Testing: 'median household income'")
results = engine.search('median household income', max_results=5)
print(f"π Found {len(results)} results:")
for i, result in enumerate(results):
print(f" {i+1}. {result.variable_id} (confidence: {result.confidence:.3f})")
print(f" Table: {result.table_id} - {result.title[:60]}...")
print(f" Label: {result.label[:60]}...")
print()
if results:
print("β SUCCESS: Search now returns results!")
# Verify we got the right kind of results
income_vars = [r for r in results if 'income' in r.label.lower()]
median_vars = [r for r in results if 'median' in r.label.lower()]
print(f"\\nπ Quality check:")
print(f" Results with 'income': {len(income_vars)}")
print(f" Results with 'median': {len(median_vars)}")
if income_vars and median_vars:
print("β Results are semantically relevant!")
else:
print("β οΈ Results may not be optimal - need embedding improvement")
else:
print("β Still no results - deeper issue exists")
except Exception as e:
print(f"β Test failed: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
test_fixed_search()