Skip to main content
Glama
melaodoidao

Data.gov MCP Server

by melaodoidao

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
NameRequiredDescriptionDefault
all_fieldsNoReturn all fields
limitNoMaximum number of results
offsetNoOffset for results
order_byNoField to order by

Implementation Reference

  • 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); } }
  • 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' }, }, },
  • 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);
Install Server

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/melaodoidao/datagov-mcp-server'

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