repair_cost
Calculate repair cost estimates for home repairs by providing the repair type and zip code to get localized pricing information.
Instructions
Get repair cost estimate for home repairs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repair_type | Yes | ||
| zip_code | Yes |
Implementation Reference
- server.py:31-49 (handler)The repair_cost tool handler: decorated with @mcp.tool(), takes repair_type and zip_code, queries the repair API, and returns formatted cost estimate.@mcp.tool() def repair_cost(repair_type: str, zip_code: str) -> str: """Get repair cost estimate for home repairs""" try: repair_type=repair_type.replace(' ', '_') url = f"{REPAIR_API_BASE_URL}/api/v1/repair-cost/{repair_type}" headers = {"x-api-key": REPAIR_API_KEY} params = {"zip_code": zip_code, "scope": "comprehensive"} response = requests.get(url, headers=headers, params=params) response.raise_for_status() data = response.json() cost = data["cost_estimate"] return f"${cost['low']:,} - ${cost['high']:,} (avg: ${cost['average']:,}) for {repair_type.replace('_', ' ')} in {zip_code}" except Exception as e: return f"Error: {str(e)}"
- server.py:31-31 (registration)Registers the repair_cost tool in the MCP server using the @mcp.tool() decorator.@mcp.tool()
- server.py:33-33 (schema)Tool description/docstring serving as schema documentation."""Get repair cost estimate for home repairs"""