get_supported_formats
Discover which file formats are available for downloading datasets from Hong Kong's official open data portal, helping you identify compatible data formats before accessing government data resources.
Instructions
Get a list of file formats supported by data.gov.hk
Returns: A list of supported file formats
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp_open_data_hk/server.py:221-229 (handler)The core handler function for the 'get_supported_formats' tool. It makes an API request to retrieve the list of supported file formats from data.gov.hk and returns them as a list of strings.async def get_supported_formats() -> List[str]: """ Get a list of file formats supported by data.gov.hk Returns: A list of supported file formats """ result = await make_api_request(FILE_FORMATS_URL) return result.get("formats", [])
- src/mcp_open_data_hk/server.py:220-220 (registration)The @mcp.tool decorator registers the get_supported_formats function as an MCP tool.@mcp.tool
- src/mcp_open_data_hk/server.py:19-30 (helper)Helper function used by get_supported_formats to make HTTP requests to the data.gov.hk API.async def make_api_request( url: str, params: Optional[Dict[str, Any]] = None ) -> Dict[str, Any]: """Make an API request to data.gov.hk""" async with httpx.AsyncClient() as client: # Print the request for debugging print(f"Making request to {url} with params {params}") response = await client.get(url, params=params) print(f"Response status: {response.status_code}") response.raise_for_status() return response.json()