1+ """Italian postal code and municipality tools."""
2+
3+ # MCP tool names and parameter names intentionally mirror the public API.
4+ # pylint: disable=invalid-name
5+
16import logging
2- logging .getLogger (__name__ ).debug ("module loaded" )
3- from fastmcp import Context
47from typing import Any
8+
9+ from fastmcp import Context # pylint: disable=import-error
10+
511from ..mcp_core import make_api_call , mcp
612from ..memory_store import OPENAPI_HOST_PREFIX
713
814logger = logging .getLogger (__name__ )
15+ logger .debug ("module loaded" )
16+
917
1018@mcp .tool
1119async def get_IT_regions_list (ctx : Context ) -> Any :
@@ -15,6 +23,7 @@ async def get_IT_regions_list(ctx: Context) -> Any:
1523 url = f"https://{ OPENAPI_HOST_PREFIX } cap.openapi.it/regioni"
1624 return make_api_call (ctx , "GET" , url )
1725
26+
1827@mcp .tool
1928async def get_IT_provinces_list (ctx : Context ) -> Any :
2029 """
@@ -23,6 +32,7 @@ async def get_IT_provinces_list(ctx: Context) -> Any:
2332 url = f"https://{ OPENAPI_HOST_PREFIX } cap.openapi.it/province"
2433 return make_api_call (ctx , "GET" , url )
2534
35+
2636@mcp .tool
2737async def get_IT_metropolitan_cities_list (ctx : Context ) -> Any :
2838 """
@@ -31,6 +41,7 @@ async def get_IT_metropolitan_cities_list(ctx: Context) -> Any:
3141 url = f"https://{ OPENAPI_HOST_PREFIX } cap.openapi.it/citta_metropolitane"
3242 return make_api_call (ctx , "GET" , url )
3343
44+
3445@mcp .tool
3546async def get_suppressed_italian_municipalities (ctx : Context ) -> Any :
3647 """
@@ -39,6 +50,7 @@ async def get_suppressed_italian_municipalities(ctx: Context) -> Any:
3950 url = f"https://{ OPENAPI_HOST_PREFIX } cap.openapi.it/comuni_soppressi"
4051 return make_api_call (ctx , "GET" , url )
4152
53+
4254@mcp .tool
4355async def find_IT_istat_by_comune_name (comune : str , ctx : Context ) -> Any :
4456 """
@@ -48,6 +60,7 @@ async def find_IT_istat_by_comune_name(comune: str, ctx: Context) -> Any:
4860 params = {"comune" : comune }
4961 return make_api_call (ctx , "GET" , url , params = params )
5062
63+
5164@mcp .tool
5265async def find_IT_municipality_by_istat (istatCode : str , ctx : Context ) -> Any :
5366 """
@@ -76,6 +89,7 @@ async def find_IT_municipality_by_istat(istatCode: str, ctx: Context) -> Any:
7689 url = f"https://{ OPENAPI_HOST_PREFIX } cap.openapi.it/comuni_advance/{ istatCode } "
7790 return make_api_call (ctx , "GET" , url )
7891
92+
7993@mcp .tool
8094async def find_IT_municipalities_by_zip (zip_code : str , ctx : Context ) -> Any :
8195 """
0 commit comments