tag_list
Search and list tags on Data.gov to organize and manage dataset metadata effectively. Use the tool to filter tags by query or retrieve all fields for comprehensive results.
Instructions
List tags on Data.gov
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| all_fields | No | Return all fields | |
| query | No | Search query for tags |
Implementation Reference
- src/index.ts:367-378 (handler)The handler function that implements the core logic of the 'tag_list' tool by querying the Data.gov API at '/action/tag_list' endpoint and formatting the response as MCP content.private async tagList(args: TagListArgs) { try { const response = await this.axiosInstance.get('/action/tag_list', { params: args, }); return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }], }; } catch (error) { return this.handleAxiosError(error); } }
- src/index.ts:81-84 (schema)TypeScript interface defining the input arguments for the tag_list tool.interface TagListArgs { query?: string; all_fields?: boolean; }
- src/index.ts:91-95 (schema)Type guard function to validate input arguments for the tag_list tool.const isValidTagListArgs = (args: any): args is TagListArgs => typeof args === 'object' && args !== null && (args.query === undefined || typeof args.query === 'string') && (args.all_fields === undefined || typeof args.all_fields === 'boolean');
- src/index.ts:244-257 (registration)Registration of the 'tag_list' tool in the ListTools response, including name, description, and input schema.{ name: 'tag_list', description: 'List tags on Data.gov', inputSchema: { type: 'object', properties: { query: { type: 'string', description: 'Search query for tags' }, all_fields: { type: 'boolean', description: 'Return all fields', }, }, }, },
- src/index.ts:287-294 (registration)Dispatch logic in the CallTool handler that validates arguments and invokes the tagList method.case 'tag_list': if (!isValidTagListArgs(request.params.arguments)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid tag_list arguments' ); } return this.tagList(request.params.arguments);