Skip to main content
Glama
manfye

Data.gov.my MCP Server

by manfye

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
NameRequiredDescriptionDefault
idYesID of the dataset (e.g., "air_pollution", "population")

Implementation Reference

  • 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), }, ], };
  • 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'], }, },
  • 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'; }
  • Type definition for catalogue arguments, used in type guards for tools like 'get_catalogue_metadata'.
    interface CatalogueArgs { id: string; limit?: number; }

Other Tools

Related Tools

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/manfye/data-dosm-mcp-nodejs'

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