Skip to main content
Glama
psalzman
by psalzman

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
NameRequiredDescriptionDefault
data_typeYesType of bulk data to download
election_yearNoOptional: Election year for the data

Implementation Reference

  • 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'] } }
  • 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);

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/psalzman/mcp-openfec'

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