group_list
Retrieve and organize groups of government datasets on Data.gov. Customize results by ordering, limiting, offsetting, or retrieving all fields for efficient data access.
Instructions
List groups on Data.gov
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all_fields | No | Return all fields | |
| limit | No | Maximum number of results | |
| offset | No | Offset for results | |
| order_by | No | Field to order by |
Implementation Reference
- src/index.ts:349-360 (handler)The main handler function that executes the 'group_list' tool logic by making an HTTP GET request to the Data.gov API endpoint '/action/group_list' with the provided arguments and returning the JSON response.private async groupList(args: GroupListArgs) { try { const response = await this.axiosInstance.get('/action/group_list', { params: args, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return this.handleAxiosError(error); } }
- src/index.ts:58-63 (schema)TypeScript interface defining the input arguments for the 'group_list' tool.interface GroupListArgs { order_by?: string; limit?: number; offset?: number; all_fields?: boolean; }
- src/index.ts:231-242 (registration)Registration of the 'group_list' tool in the MCP server's list of tools, including name, description, and input schema.{ name: 'group_list', description: 'List groups on Data.gov', inputSchema: { type: 'object', properties: { order_by: { type: 'string', description: 'Field to order by' }, limit: { type: 'number', description: 'Maximum number of results' }, offset: { type: 'number', description: 'Offset for results' }, all_fields: { type: 'boolean', description: 'Return all fields' }, }, },
- src/index.ts:70-76 (helper)Validation function to check if arguments match the GroupListArgs schema before calling the handler.const isValidGroupListArgs = (args: any): args is GroupListArgs => typeof args === 'object' && args !== null && (args.order_by === undefined || typeof args.order_by === 'string') && (args.limit === undefined || typeof args.limit === 'number') && (args.offset === undefined || typeof args.offset === 'number') && (args.all_fields === undefined || typeof args.all_fields === 'boolean');
- src/index.ts:279-286 (registration)Dispatch case in the CallToolRequestSchema handler that routes 'group_list' calls to the groupList method after validation.case 'group_list': if (!isValidGroupListArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid group_list arguments' ); } return this.groupList(request.params.arguments);