Skip to main content
Glama
psalzman

MCP OpenFEC Server

by psalzman

get_communication_costs

Retrieve corporate and union communication cost data from Federal Election Commission records to analyze campaign finance expenditures.

Instructions

Get corporate/union communication costs

Input Schema

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

Implementation Reference

  • The core handler function for the 'get_communication_costs' tool. Validates input using Zod schema matching the tool's inputSchema, applies rate limiting, queries the OpenFEC API endpoint '/schedules/schedule_d' for corporate/union communication costs data with optional filters and sorting, and returns the response as a formatted JSON text content block.
    private async handleGetCommunicationCosts(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('/schedules/schedule_d', {
        params: {
          ...params,
          sort_hide_null: true,
          sort: params.sort === 'desc' ? '-cost' : 'cost',
          per_page: 20
        }
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • The input schema definition for the 'get_communication_costs' tool, used in ListTools response for input validation and documentation. Defines optional parameters for filtering and sorting communication costs data from the FEC 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 communication date (YYYY-MM-DD)'
        },
        max_date: {
          type: 'string',
          description: 'Optional: Maximum communication date (YYYY-MM-DD)'
        },
        min_amount: {
          type: 'number',
          description: 'Optional: Minimum cost amount'
        },
        max_amount: {
          type: 'number',
          description: 'Optional: Maximum cost amount'
        },
        sort: {
          type: 'string',
          enum: ['asc', 'desc'],
          description: 'Optional: Sort by cost amount'
        }
      }
    }
  • src/server.ts:351-388 (registration)
    The tool registration object returned by ListToolsRequestHandler, specifying the tool name, description, and input schema for 'get_communication_costs'.
    {
      name: 'get_communication_costs',
      description: 'Get corporate/union communication costs',
      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 communication date (YYYY-MM-DD)'
          },
          max_date: {
            type: 'string',
            description: 'Optional: Maximum communication date (YYYY-MM-DD)'
          },
          min_amount: {
            type: 'number',
            description: 'Optional: Minimum cost amount'
          },
          max_amount: {
            type: 'number',
            description: 'Optional: Maximum cost amount'
          },
          sort: {
            type: 'string',
            enum: ['asc', 'desc'],
            description: 'Optional: Sort by cost amount'
          }
        }
      }
    },
  • src/server.ts:465-466 (registration)
    The switch case in the CallToolRequestHandler that routes calls to the 'get_communication_costs' handler function.
    case 'get_communication_costs':
      return await this.handleGetCommunicationCosts(request.params.arguments);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. 'Get' implies a read operation, but the description doesn't address important behavioral aspects like authentication requirements, rate limits, pagination behavior, error conditions, or what format the costs are returned in. For a 7-parameter tool with no annotation coverage, this is a significant gap.

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 extremely concise at just 4 words, with zero wasted language. It's front-loaded with the core purpose and uses efficient phrasing. Every word earns its place in this minimal description.

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?

Given the complexity of a 7-parameter tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what 'communication costs' encompass, what format results are returned in, or any behavioral characteristics. For a data retrieval tool in what appears to be an FEC API context, more context about the data domain and return format would be helpful.

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 schema description coverage is 100%, with all 7 parameters well-documented in the schema itself. The description adds no parameter-specific information beyond what's already in the schema. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the description.

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 verb 'Get' and resource 'corporate/union communication costs', providing a specific purpose. However, it doesn't distinguish this tool from its siblings like get_audit_cases or get_filings, which likely retrieve different types of FEC data. The description is accurate but lacks sibling differentiation.

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. With 10 sibling tools on the server, there's no indication of what makes this tool unique for retrieving communication costs versus other FEC data types. No context about prerequisites, typical use cases, or exclusions is provided.

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