Skip to main content
Glama
psalzman
by psalzman

get_electioneering

Retrieve electioneering communications data from the Federal Election Commission to analyze political advertising expenditures by date, amount, candidate, or committee.

Instructions

Get electioneering communications

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
committee_idNoOptional: FEC committee ID
candidate_idNoOptional: FEC candidate ID
min_dateNoOptional: Minimum disbursement date (YYYY-MM-DD)
max_dateNoOptional: Maximum disbursement date (YYYY-MM-DD)
min_amountNoOptional: Minimum disbursement amount
max_amountNoOptional: Maximum disbursement amount
sortNoOptional: Sort by disbursement amount

Implementation Reference

  • Executes the 'get_electioneering' tool: validates input with Zod schema matching the registered inputSchema, applies rate limiting, queries the OpenFEC '/electioneering' API endpoint with provided filters, and returns the paginated JSON results as MCP tool content.
    private async handleGetElectioneering(args: any) { const schema = z.object({ committee_id: z.string().optional(), candidate_id: z.string().optional(), min_date: z.string().optional(), max_date: z.string().optional(), min_amount: z.number().optional(), max_amount: z.number().optional(), sort: z.enum(['asc', 'desc']).optional() }); const params = schema.parse(args); this.rateLimiter.consumeToken(); const response = await this.axiosInstance.get('/electioneering', { params: { ...params, sort_hide_null: true, sort: params.sort === 'desc' ? '-disbursement_amount' : 'disbursement_amount', per_page: 20 } }); return { content: [ { type: 'text', text: JSON.stringify(response.data, null, 2), }, ], }; }
  • Defines the input schema for the 'get_electioneering' tool, specifying optional parameters for filtering electioneering communications data from the OpenFEC API.
    inputSchema: { type: 'object', properties: { committee_id: { type: 'string', description: 'Optional: FEC committee ID' }, candidate_id: { type: 'string', description: 'Optional: FEC candidate ID' }, min_date: { type: 'string', description: 'Optional: Minimum disbursement date (YYYY-MM-DD)' }, max_date: { type: 'string', description: 'Optional: Maximum disbursement date (YYYY-MM-DD)' }, min_amount: { type: 'number', description: 'Optional: Minimum disbursement amount' }, max_amount: { type: 'number', description: 'Optional: Maximum disbursement amount' }, sort: { type: 'string', enum: ['asc', 'desc'], description: 'Optional: Sort by disbursement amount' } } }
  • src/server.ts:275-312 (registration)
    Registers the 'get_electioneering' tool in the MCP server's ListTools response, providing name, description, and input schema.
    { name: 'get_electioneering', description: 'Get electioneering communications', inputSchema: { type: 'object', properties: { committee_id: { type: 'string', description: 'Optional: FEC committee ID' }, candidate_id: { type: 'string', description: 'Optional: FEC candidate ID' }, min_date: { type: 'string', description: 'Optional: Minimum disbursement date (YYYY-MM-DD)' }, max_date: { type: 'string', description: 'Optional: Maximum disbursement date (YYYY-MM-DD)' }, min_amount: { type: 'number', description: 'Optional: Minimum disbursement amount' }, max_amount: { type: 'number', description: 'Optional: Maximum disbursement amount' }, sort: { type: 'string', enum: ['asc', 'desc'], description: 'Optional: Sort by disbursement amount' } } } },
  • src/server.ts:461-462 (registration)
    Registers the handler dispatch for 'get_electioneering' in the CallToolRequestHandler switch statement.
    case 'get_electioneering': return await this.handleGetElectioneering(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