Skip to main content
Glama
psalzman
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);

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