get_catalogue_data
Fetch specific dataset information from Malaysia's open government data platform using a unique ID, with optional record limits, via Data.gov.my MCP Server.
Instructions
Fetch actual data from the data.gov.my API for a specific catalogue.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the dataset | |
| limit | No | Number of records to fetch (optional, default 100) |
Implementation Reference
- src/index.ts:173-195 (handler)Executes the get_catalogue_data tool: validates args with isCatalogueArgs, logs the request, constructs params with id and optional limit, fetches data from 'https://api.data.gov.my/data-catalogue', and returns JSON response with data.} else if (name === 'get_catalogue_data') { if (!isCatalogueArgs(args)) { throw new McpError(ErrorCode.InvalidParams, 'Missing required parameter: id'); } console.error(`[API] Fetching catalogue data for: ${args.id}`); const params: any = { id: args.id }; if (args.limit) params.limit = args.limit; const response = await this.axiosInstance.get('/data-catalogue', { params }); return { content: [ { type: 'text', text: JSON.stringify({ id: args.id, data: response.data, message: 'Catalogue data fetched successfully.' }, null, 2), }, ], };
- src/index.ts:96-103 (schema)Input schema for get_catalogue_data: requires 'id' string, optional 'limit' number.inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the dataset' }, limit: { type: 'number', description: 'Number of records to fetch (optional, default 100)' } }, required: ['id'], },
- src/index.ts:93-104 (registration)Registers the get_catalogue_data tool in the tools list returned by list_tools, including name, description, and input schema.{ name: 'get_catalogue_data', description: 'Fetch actual data from the data.gov.my API for a specific catalogue.', inputSchema: { type: 'object', properties: { id: { type: 'string', description: 'ID of the dataset' }, limit: { type: 'number', description: 'Number of records to fetch (optional, default 100)' } }, required: ['id'], }, },
- src/index.ts:30-32 (helper)Type guard helper to validate if arguments match CatalogueArgs interface (has 'id' string), used in get_catalogue_data handler.function isCatalogueArgs(args: any): args is CatalogueArgs { return args && typeof args.id === 'string'; }
- src/index.ts:20-22 (helper)Type definition for CatalogueArgs used in get_catalogue_data input validation.interface CatalogueArgs { id: string; limit?: number;