get_catalogue_metadata
Retrieve dataset metadata from Malaysia's open data platform by ID, enabling developers to access and integrate government data seamlessly.
Instructions
Fetch metadata for a specific data catalogue by ID from GitHub.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the dataset (e.g., "air_pollution", "population") |
Implementation Reference
- src/index.ts:148-172 (handler)Handler logic for the 'get_catalogue_metadata' tool. Validates input using isCatalogueArgs, fetches the catalogue JSON file from the GitHub repository using githubAxios, decodes the base64-encoded content, parses it as JSON, and returns the metadata wrapped in a text content response.} else if (name === 'get_catalogue_metadata') { if (!isCatalogueArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: id'); } console.error(`[GitHub] Fetching catalogue metadata for: ${args.id}`); const response = await this.githubAxios.get(`/repos/data-gov-my/datagovmy-meta/contents/data-catalogue/${args.id}.json`); // Decode the base64 content const content = Buffer.from(response.data.content, 'base64').toString('utf-8'); const metadata = JSON.parse(content); return { content: [ { type: 'text', text: JSON.stringify({ id: args.id, metadata, message: 'Catalogue metadata fetched successfully.' }, null, 2), }, ], };
- src/index.ts:85-91 (schema)Input schema definition for the 'get_catalogue_metadata' tool, specifying an object with a required 'id' string property.inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the dataset (e.g., "air_pollution", "population")' } }, required: ['id'], },
- src/index.ts:82-92 (registration)Tool registration in the list_tools handler, defining name, description, and input schema for 'get_catalogue_metadata'.{ name: 'get_catalogue_metadata', description: 'Fetch metadata for a specific data catalogue by ID from GitHub. do this before getting the data, if "exclude_openapi": true, mean you cant get the catalogue data. update the user on this and recommend them to get from manual csv.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the dataset (e.g., "air_pollution", "population")' } }, required: ['id'], }, },
- src/index.ts:30-32 (helper)Type guard helper function used to validate arguments for 'get_catalogue_metadata' (and similar tools), checking for presence of 'id' string.function isCatalogueArgs(args: any): args is CatalogueArgs { return args && typeof args.id === 'string'; }
- src/index.ts:20-23 (helper)Type definition for catalogue arguments, used in type guards for tools like 'get_catalogue_metadata'.interface CatalogueArgs { id: string; limit?: number; }