get_bulk_downloads
Download bulk Federal Election Commission data files for campaign finance analysis, including contributions, expenditures, filings, committees, and candidates.
Instructions
Get links to bulk data downloads
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data_type | Yes | Type of bulk data to download | |
| election_year | No | Optional: Election year for the data |
Implementation Reference
- src/server.ts:825-849 (handler)The handler function that executes the get_bulk_downloads tool. It validates input using Zod, checks rate limit, queries the OpenFEC API /download endpoint, and returns the JSON response as text content.private async handleGetBulkDownloads(args: any) { const schema = z.object({ data_type: z.enum(['contributions', 'expenditures', 'filings', 'committees', 'candidates']), election_year: z.number().optional() }); const { data_type, election_year } = schema.parse(args); this.rateLimiter.consumeToken(); const response = await this.axiosInstance.get('/download', { params: { data_type, election_year } }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; }
- src/server.ts:415-433 (registration)Registration of the get_bulk_downloads tool in the ListToolsRequestSchema handler response, defining the tool name, description, and input schema.{ name: 'get_bulk_downloads', description: 'Get links to bulk data downloads', inputSchema: { type: 'object', properties: { data_type: { type: 'string', enum: ['contributions', 'expenditures', 'filings', 'committees', 'candidates'], description: 'Type of bulk data to download' }, election_year: { type: 'number', description: 'Optional: Election year for the data' } }, required: ['data_type'] } }
- src/server.ts:826-829 (schema)Zod schema for input validation within the handler, matching the registered inputSchema.const schema = z.object({ data_type: z.enum(['contributions', 'expenditures', 'filings', 'committees', 'candidates']), election_year: z.number().optional() });
- src/server.ts:469-470 (registration)Dispatch case in the CallToolRequestSchema handler that routes get_bulk_downloads calls to the specific handler method.case 'get_bulk_downloads': return await this.handleGetBulkDownloads(request.params.arguments);