Skip to main content
Glama
melaodoidao

Data.gov MCP Server

by melaodoidao

package_search

Search for government datasets on Data.gov using customizable queries, filters, and sorting options to find relevant packages efficiently.

Instructions

Search for packages (datasets) on Data.gov

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
qNoSearch query
rowsNoNumber of results per page
sortNoSort order (e.g., "score desc, name asc")
startNoStarting offset for results

Implementation Reference

  • The core handler function that executes the package_search tool. It makes an HTTP GET request to the Data.gov API endpoint '/action/package_search' with the provided arguments and returns the response as formatted JSON text.
    private async packageSearch(args: PackageSearchArgs) {
      try {
        const response = await this.axiosInstance.get('/action/package_search', {
          params: args,
        });
        return {
          content: [
            { type: 'text', text: JSON.stringify(response.data, null, 2) },
          ],
        };
      } catch (error) {
        return this.handleAxiosError(error);
      }
    }
  • The JSON schema defining the input parameters for the package_search tool, used in tool listing and validation.
    inputSchema: {
      type: 'object',
      properties: {
        q: { type: 'string', description: 'Search query' },
        sort: {
          type: 'string',
          description: 'Sort order (e.g., "score desc, name asc")',
        },
        rows: {
          type: 'number',
          description: 'Number of results per page',
        },
        start: {
          type: 'number',
          description: 'Starting offset for results',
        },
      },
  • src/index.ts:198-219 (registration)
    The tool registration metadata in the ListToolsRequestSchema handler, including name, description, and input schema.
    {
      name: 'package_search',
      description: 'Search for packages (datasets) on Data.gov',
      inputSchema: {
        type: 'object',
        properties: {
          q: { type: 'string', description: 'Search query' },
          sort: {
            type: 'string',
            description: 'Sort order (e.g., "score desc, name asc")',
          },
          rows: {
            type: 'number',
            description: 'Number of results per page',
          },
          start: {
            type: 'number',
            description: 'Starting offset for results',
          },
        },
      },
    },
  • src/index.ts:263-270 (registration)
    The dispatch case in the CallToolRequestSchema handler that validates arguments and invokes the packageSearch handler.
    case 'package_search':
      if (!isValidPackageSearchArgs(request.params.arguments)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid package_search arguments'
        );
      }
      return this.packageSearch(request.params.arguments);
  • TypeScript interface defining the expected arguments for the package_search tool.
    interface PackageSearchArgs {
      q?: string;
      sort?: string;
      rows?: number;
      start?: number;
    }
  • Helper function to validate if arguments match the PackageSearchArgs type before calling the handler.
    const isValidPackageSearchArgs = (args: any): args is PackageSearchArgs =>
      typeof args === 'object' &&
      args !== null &&
      (args.q === undefined || typeof args.q === 'string') &&
      (args.sort === undefined || typeof args.sort === 'string') &&
      (args.rows === undefined || typeof args.rows === 'number') &&
      (args.start === undefined || typeof args.start === 'number');
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Search for packages') but lacks details on permissions, rate limits, pagination behavior (implied by 'rows' and 'start' parameters but not explained), or response format, which is insufficient for a search tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any wasted words. It is appropriately sized and front-loaded, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a search tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It lacks information on behavioral traits, usage context, and output details, making it inadequate for the agent to fully understand how to invoke and interpret results from this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions for all 4 parameters (e.g., 'q' as 'Search query', 'rows' as 'Number of results per page'). The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Search for') and resource ('packages (datasets) on Data.gov'), making the purpose immediately understandable. However, it doesn't differentiate this search tool from potential siblings like 'package_show' (which might retrieve a specific package) or 'tag_list' (which might list tags rather than search packages), missing full sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description doesn't mention scenarios like searching for packages by query versus retrieving a specific package with 'package_show' or listing groups with 'group_list', leaving the agent without usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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