Skip to main content
Glama
psalzman

MCP OpenFEC Server

by psalzman

get_candidate

Retrieve detailed Federal Election Commission candidate information including campaign finance data using the candidate's FEC ID, with optional filtering by election year.

Instructions

Get detailed information about a candidate

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
candidate_idYesFEC candidate ID
election_yearNoOptional: Filter by election year

Implementation Reference

  • The handler function that executes the get_candidate tool: validates args with Zod schema, calls OpenFEC API, returns JSON response as text content.
    private async handleGetCandidate(args: any) {
      const schema = z.object({
        candidate_id: z.string(),
        election_year: z.number().optional(),
      });
    
      const { candidate_id, election_year } = schema.parse(args);
      this.rateLimiter.consumeToken();
    
      const response = await this.axiosInstance.get(`/candidate/${candidate_id}`, {
        params: election_year ? { election_year } : undefined,
      });
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(response.data, null, 2),
          },
        ],
      };
    }
  • src/server.ts:93-110 (registration)
    Tool registration in ListTools handler, defining name, description, and input schema.
    {
      name: 'get_candidate',
      description: 'Get detailed information about a candidate',
      inputSchema: {
        type: 'object',
        properties: {
          candidate_id: {
            type: 'string',
            description: 'FEC candidate ID',
          },
          election_year: {
            type: 'number',
            description: 'Optional: Filter by election year',
          },
        },
        required: ['candidate_id'],
      },
    },
  • Zod runtime input validation schema matching the registered inputSchema.
    const schema = z.object({
      candidate_id: z.string(),
      election_year: z.number().optional(),
    });
  • src/server.ts:447-448 (registration)
    Dispatch case in CallTool handler switch statement that routes to the handler.
    case 'get_candidate':
      return await this.handleGetCandidate(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. It only states the action ('Get detailed information') without revealing traits like read-only status, potential rate limits, authentication needs, or response format. For a tool with no annotation coverage, this is a significant gap in transparency.

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

Conciseness4/5

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

The description is a single sentence that is front-loaded and efficient, with no wasted words. It directly states the tool's purpose without unnecessary elaboration. However, it could be more structured by including key details, but it earns high marks for brevity and clarity in its current form.

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 lack of annotations and output schema, the description is incomplete. It does not explain what 'detailed information' includes, how results are returned, or any behavioral aspects like error handling. For a tool with no structured data to supplement it, the description should provide more context to be fully 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 both parameters ('candidate_id' and 'election_year') documented in the schema. The description does not add any meaning beyond what the schema provides, such as explaining parameter interactions or usage examples. With high schema coverage, a baseline score of 3 is appropriate as the schema handles the heavy lifting.

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

Purpose3/5

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

The description states the tool's purpose ('Get detailed information about a candidate'), which is clear but vague. It specifies the verb 'Get' and resource 'candidate', but lacks specificity about what 'detailed information' entails. It does not distinguish from sibling tools like 'get_candidate_contributions' or 'search_candidates', which limits its 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. It does not mention when to use it over sibling tools such as 'get_candidate_contributions' for financial data or 'search_candidates' for finding candidates. There are no explicit instructions on context or exclusions, leaving usage unclear.

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