get_kod_yeshuv
Retrieve the official Israeli settlement code (Kod Yeshuv) for a Hebrew settlement name. Facilitates integration with government systems by mapping names to standardized codes.
Instructions
Get Kod Yeshuv (settlement code) from Hebrew settlement name
Returns the official settlement code used by Israeli authorities for the given settlement name. Useful for integration with other Israeli government systems.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | Yes |
Implementation Reference
- The handler function for the 'get_kod_yeshuv' tool. Performs exact matching first, then fuzzy partial matching on Hebrew settlement names using the KOD_YESHUV_SETTLEMENTS dataset, returning the settlement code or partial matches.@mcp.tool() def get_kod_yeshuv(args: KodYeshuvArgs) -> Dict[str, Any]: """ Get Kod Yeshuv (settlement code) from Hebrew settlement name Returns the official settlement code used by Israeli authorities for the given settlement name. Useful for integration with other Israeli government systems. """ try: # Search for exact match first settlement_name = args.settlement_name.strip() for settlement in KOD_YESHUV_SETTLEMENTS: if settlement.name_hebrew == settlement_name: return { "success": True, "settlement_name": settlement_name, "kod_yeshuv": settlement.kod_yeshuv, "match_type": "exact", } # Search for partial matches if no exact match found partial_matches = [] settlement_lower = settlement_name.lower() for settlement in KOD_YESHUV_SETTLEMENTS: name_lower = settlement.name_hebrew.lower() if settlement_lower in name_lower or name_lower in settlement_lower: partial_matches.append( { "settlement_name": settlement.name_hebrew, "kod_yeshuv": settlement.kod_yeshuv, "similarity": "partial", } ) if partial_matches: return { "success": True, "searched_name": settlement_name, "exact_match": False, "partial_matches": partial_matches[:10], # Limit to top 10 matches "match_type": "partial", } # No matches found return { "success": False, "error": f"No settlement found matching '{settlement_name}'", "searched_name": settlement_name, "suggestion": "Try using the exact Hebrew name or check the settlement name spelling", } except Exception as e: return { "success": False, "error": str(e), "searched_name": args.settlement_name, }
- Pydantic BaseModel defining the input schema for the get_kod_yeshuv tool, requiring a Hebrew settlement_name.class KodYeshuvArgs(BaseModel): """Arguments for settlement code lookup""" settlement_name: str = Field( ..., description="Settlement name in Hebrew to get the Kod Yeshuv for" )
- src/remy_mcp/tools/__init__.py:1-13 (registration)Registration entry point for all tools, including call to register_settlement_tools which registers the get_kod_yeshuv tool.""" MCP Tools for Israeli Land Authority server """ from .tender_tools import register_tender_tools from .settlement_tools import register_settlement_tools def register_tools(mcp, api_client): """Register all MCP tools""" register_tender_tools(mcp, api_client) register_settlement_tools(mcp, api_client)
- src/remy_mcp/server.py:19-21 (registration)Top-level server setup where register_tools is called, indirectly registering the get_kod_yeshuv tool.# Register tools and resources register_tools(mcp, api_client) register_resources(mcp)