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
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_electioneering"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| committee_id | No | Optional: FEC committee ID | |
| candidate_id | No | Optional: FEC candidate ID | |
| min_date | No | Optional: Minimum disbursement date (YYYY-MM-DD) | |
| max_date | No | Optional: Maximum disbursement date (YYYY-MM-DD) | |
| min_amount | No | Optional: Minimum disbursement amount | |
| max_amount | No | Optional: Maximum disbursement amount | |
| sort | No | Optional: Sort by disbursement amount |
Implementation Reference
- src/server.ts:697-728 (handler)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), }, ], }; } - src/server.ts:278-311 (schema)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);