Skip to main content
Glama
mcp-open-data-hk

Hong Kong Open Data MCP Server

Official

get_dataset_details

Retrieve comprehensive metadata and tracking information for specific datasets from Hong Kong's official open data portal using dataset ID and language preferences.

Instructions

Get detailed information about a specific dataset

Args: dataset_id: The ID or name of the dataset to retrieve language: Language code (en, tc, sc) include_tracking: Add tracking information to dataset and resources

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataset_idYes
languageNoen
include_trackingNo

Implementation Reference

  • The core handler function for the 'get_dataset_details' tool, registered via @mcp.tool decorator. Fetches dataset details from data.gov.hk using the package_show API endpoint, with optional language and tracking parameters.
    @mcp.tool async def get_dataset_details( dataset_id: str, language: str = "en", include_tracking: bool = False ) -> Dict[str, Any]: """ Get detailed information about a specific dataset Args: dataset_id: The ID or name of the dataset to retrieve language: Language code (en, tc, sc) include_tracking: Add tracking information to dataset and resources """ base_url = BASE_URLS.get(language, BASE_URLS["en"]) url = f"{base_url}/package_show" params = {"id": dataset_id} if include_tracking: params["include_tracking"] = "true" result = await make_api_request(url, params) if result.get("success"): return result["result"] else: raise Exception(f"API Error: {result.get('error', 'Unknown error')}")
  • Helper utility function used by get_dataset_details (and other tools) to make asynchronous HTTP GET requests to the data.gov.hk API, handling errors and returning JSON.
    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()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcp-open-data-hk/mcp-open-data-hk'

If you have feedback or need assistance with the MCP directory API, please join our Discord server