Fix autocomplete_address bug and add test coverage report

Bug Fix:
- Fixed autocomplete_address tool to use correct API response fields
- Changed from non-existent fields (addressLabel, settlementNameHeb, coordinates)
  to actual API fields (text, id, type, score, shape)
- Added coordinate parsing from WKT POINT format
- Impact: HIGH - tool was returning empty data for all fields

Test Coverage Report:
- Added comprehensive test coverage analysis
- Documented 34 passing tests
- Identified e2e test results for MCP tools
- Listed missing test cases and recommendations
- Overall assessment: Good coverage, one bug found and fixed

E2E Test Results:
-  find_recent_deals_for_address - WORKING
-  analyze_market_trends - WORKING
-  get_valuation_comparables - WORKING
-  autocomplete_address - FIXED (needs MCP server restart to take effect)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Nitzan Pomerantz
2025-10-25 13:45:52 +03:00
parent 5ad5994dfc
commit 4d9febf527
2 changed files with 271 additions and 5 deletions
+21 -5
View File
@@ -63,13 +63,29 @@ def autocomplete_address(search_text: str) -> str:
# Format results for better readability
formatted_results = []
for result in response['results']:
# Parse coordinates from WKT POINT format: "POINT(longitude latitude)"
shape_str = result.get("shape", "")
coordinates = {}
if shape_str and shape_str.startswith("POINT("):
try:
coords_str = shape_str[6:-1] # Remove "POINT(" and ")"
coords = coords_str.split()
if len(coords) == 2:
coordinates = {
"longitude": float(coords[0]),
"latitude": float(coords[1])
}
except (ValueError, IndexError) as e:
logger.warning(f"Failed to parse coordinates from shape: {shape_str}, error: {e}")
formatted_results.append({
"address": result.get("addressLabel", ""),
"settlement": result.get("settlementNameHeb", ""),
"coordinates": result.get("coordinates", {}),
"polygon_id": result.get("polygon_id")
"text": result.get("text", ""),
"id": result.get("id", ""),
"type": result.get("type", ""),
"score": result.get("score", 0),
"coordinates": coordinates
})
return json.dumps(formatted_results, ensure_ascii=False, indent=2)
except Exception as e: