Skip to main content
Glama
psalzman

MCP OpenFEC Server

by psalzman

get_independent_expenditures

Retrieve independent expenditures supporting or opposing political candidates from Federal Election Commission data. Filter by candidate, committee, support/oppose status, date range, and amount.

Instructions

Get independent expenditures supporting or opposing candidates

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
candidate_idNoOptional: FEC candidate ID
committee_idNoOptional: FEC committee ID
support_oppose_indicatorNoOptional: S for supporting or O for opposing
min_dateNoOptional: Minimum expenditure date (YYYY-MM-DD)
max_dateNoOptional: Maximum expenditure date (YYYY-MM-DD)
min_amountNoOptional: Minimum expenditure amount
max_amountNoOptional: Maximum expenditure amount
sortNoOptional: Sort by expenditure amount

Implementation Reference

  • The handler function that executes the tool logic: validates input parameters using Zod, queries the OpenFEC API at /schedules/schedule_e for independent expenditures data, and returns the JSON response as text content.
    private async handleGetIndependentExpenditures(args: any) {
      const schema = z.object({
        candidate_id: z.string().optional(),
        committee_id: z.string().optional(),
        support_oppose_indicator: z.enum(['S', 'O']).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('/schedules/schedule_e', {
        params: {
          ...params,
          sort_hide_null: true,
          sort: params.sort === 'desc' ? '-expenditure_amount' : 'expenditure_amount',
          per_page: 20
        }
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • src/server.ts:233-274 (registration)
    Tool registration in the MCP server's tools list, defining the tool name, description, and input schema for validation.
      name: 'get_independent_expenditures',
      description: 'Get independent expenditures supporting or opposing candidates',
      inputSchema: {
        type: 'object',
        properties: {
          candidate_id: {
            type: 'string',
            description: 'Optional: FEC candidate ID'
          },
          committee_id: {
            type: 'string',
            description: 'Optional: FEC committee ID'
          },
          support_oppose_indicator: {
            type: 'string',
            enum: ['S', 'O'],
            description: 'Optional: S for supporting or O for opposing'
          },
          min_date: {
            type: 'string',
            description: 'Optional: Minimum expenditure date (YYYY-MM-DD)'
          },
          max_date: {
            type: 'string',
            description: 'Optional: Maximum expenditure date (YYYY-MM-DD)'
          },
          min_amount: {
            type: 'number',
            description: 'Optional: Minimum expenditure amount'
          },
          max_amount: {
            type: 'number',
            description: 'Optional: Maximum expenditure amount'
          },
          sort: {
            type: 'string',
            enum: ['asc', 'desc'],
            description: 'Optional: Sort by expenditure amount'
          }
        }
      }
    },
  • src/server.ts:459-460 (registration)
    Dispatcher case in the request handler that routes calls to the specific handler function.
    case 'get_independent_expenditures':
      return await this.handleGetIndependentExpenditures(request.params.arguments);
  • Runtime input validation schema inside the handler, matching the registered inputSchema.
    const schema = z.object({
      candidate_id: z.string().optional(),
      committee_id: z.string().optional(),
      support_oppose_indicator: z.enum(['S', 'O']).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()
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'gets' data, implying a read-only operation, but doesn't specify whether it's a search, list, or filter operation, nor does it describe output format, pagination, rate limits, or authentication requirements. This leaves significant gaps for a tool with 8 parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy for an agent to quickly understand the core functionality.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 8 parameters, no annotations, and no output schema, the description is insufficient. It doesn't explain what 'independent expenditures' are in this context, how results are returned, or provide any behavioral context beyond the basic purpose. The agent would need to rely heavily on the schema alone.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description mentions 'supporting or opposing candidates,' which aligns with the support_oppose_indicator parameter, but doesn't add meaningful context beyond what the 100% schema coverage already provides. The schema descriptions thoroughly document all 8 optional parameters, so the description adds minimal value here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and resource ('independent expenditures') with the purpose of retrieving data about expenditures supporting or opposing candidates. It distinguishes itself from siblings like get_candidate_contributions or get_communication_costs by focusing specifically on independent expenditures, though it doesn't explicitly contrast with them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context, or compare with sibling tools like get_communication_costs or get_party_coordinated_expenditures, leaving the agent to infer usage based on the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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