Skip to main content
Glama
melaodoidao

Data.gov MCP Server

by melaodoidao

package_show

Retrieve detailed information about a specific dataset by entering its ID or name on the Data.gov MCP Server.

Instructions

Get details for a specific package (dataset)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesPackage ID or name

Implementation Reference

  • The main handler function for the package_show tool. It performs an HTTP GET request to the Data.gov API endpoint '/action/package_show' using the provided package ID and returns the response as formatted JSON text content.
    private async packageShow(args: PackageShowArgs) {
      try {
        const response = await this.axiosInstance.get('/action/package_show', {
          params: { id: args.id },
        });
        return {
          content: [
            { type: 'text', text: JSON.stringify(response.data, null, 2) },
          ],
        };
      } catch (error) {
        return this.handleAxiosError(error);
      }
    }
  • TypeScript interface defining the input arguments for package_show (requiring 'id' string) and the corresponding validation function isValidPackageShowArgs.
     * Arguments for the package_show tool.
     */
    interface PackageShowArgs {
      id: string;
    }
    
    /**
     * Checks if the given arguments are valid for the package_show tool.
     * @param args The arguments to validate.
     * @returns True if the arguments are valid, false otherwise.
     */
    const isValidPackageShowArgs = (args: any): args is PackageShowArgs =>
      typeof args === 'object' && args !== null && typeof args.id === 'string';
  • src/index.ts:221-230 (registration)
    Tool registration in the ListToolsRequestSchema response, defining the name, description, and input schema (object with required 'id' string).
      name: 'package_show',
      description: 'Get details for a specific package (dataset)',
      inputSchema: {
        type: 'object',
        properties: {
          id: { type: 'string', description: 'Package ID or name' },
        },
        required: ['id'],
      },
    },
  • src/index.ts:271-278 (registration)
    Dispatch handler in the CallToolRequestSchema switch statement that validates the arguments using isValidPackageShowArgs and invokes the packageShow method.
    case 'package_show':
      if (!isValidPackageShowArgs(request.params.arguments)) {
        throw new McpError(
          ErrorCode.InvalidParams,
          'Invalid package_show arguments'
        );
      }
      return this.packageShow(request.params.arguments);

Tool Definition Quality

Score is being calculated. Check back soon.

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