Skip to main content
Glama

Openfec Lookup Elections

openfec_lookup_elections
Read-onlyIdempotent

Look up federal election races and candidate financial summaries. Find who's running in a race with fundraising totals, or get an aggregate race summary.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "office": "<office>",
      "cycle": "<cycle>"
    },
    "name": "openfec_lookup_elections"
  }
}

Input Schema

NameRequiredDescriptionDefault
zipNoZIP code — returns a locator (office, state, district, cycle) for each race covering this ZIP, not candidates; pass a locator back as state and district for that race. Search mode only.
modeNosearch = candidates in a race with financial totals; with zip, locators for the races covering that ZIP instead. summary = aggregate race financial summary.search
pageNoPage number (1-indexed). Search mode only; explicit page is rejected in summary mode. Defaults to 1 for search.
cycleYesElection cycle year (even years only, e.g. 2024).
stateNoTwo-letter US state code (e.g., AZ, CA). Required for senate/house unless zip is provided. Presidential races are filed under US: omit it or pass US.
officeYesOffice sought: H=House, S=Senate, P=President.
districtNoTwo-digit district number (e.g. "07"); 00 for an at-large House seat (e.g., WY, AK). Required for house unless zip is provided. Presidential and Senate races are filed under 00: omit it or pass 00.
per_pageNoResults per page. Search mode only; defaults to 20.
election_fullNoExpand to full election period (4yr president, 6yr senate, 2yr house). Defaults to true when omitted; a ZIP-scoped search rejects it, since that endpoint has no such parameter. Carries no schema default, so an explicit value is distinguishable from an omission.

Output Schema

NameRequiredDescriptionDefault
modeNoQuery mode as the server resolved it. Row shapes differ by mode — search rows are per-candidate financial records, summary is one aggregate race row — so read this rather than inferring the shape from the fields present.
errorNoPresent when the call failed. Absent on success.
noticeNoGuidance when the response carries no election results: how to broaden a search that matched nothing, or which requested position ran out when results did match.
resultsNoElection race result set; candidate financial rows in search mode, race locators (office, state, district, cycle) in a search with zip, a single aggregate summary row in summary mode.
paginationNoPage-based pagination metadata.
totalCountNoTotal matching candidates, race locators, or race summaries.
search_criteriaNoEcho of the search filters this call applied, as the server parsed them, minus paging arguments. Always present — compare it against what you sent to confirm every filter was honoured.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed9 schema fields changed
    • changedInput schema / properties / district / description
      Previous value: -"Two-digit district number (e.g. \"07\"). Required for house unless zip is provided."New value: +"Two-digit district number (e.g. \"07\"); 00 for an at-large House seat (e.g., WY, AK). Required for house unless zip is provided. Presidential and Senate races are filed under 00: omit it or pass 00."
    • changedInput schema / properties / mode / description
      Previous value: -"search = candidates in a race with financial totals. summary = aggregate race financial summary."New value: +"search = candidates in a race with financial totals; with zip, locators for the races covering that ZIP instead. summary = aggregate race financial summary."
    • changedInput schema / properties / state / description
      Previous value: -"Two-letter US state code (e.g., AZ, CA). Required for senate/house unless zip is provided."New value: +"Two-letter US state code (e.g., AZ, CA). Required for senate/house unless zip is provided. Presidential races are filed under US: omit it or pass US."
    • changedInput schema / properties / zip / description
      Previous value: -"ZIP code — finds races covering this ZIP. Search mode only."New value: +"ZIP code — returns a locator (office, state, district, cycle) for each race covering this ZIP, not candidates; pass a locator back as state and district for that race. Search mode only."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `cycle_must_be_even`: Cycle is an odd year. `missing_state_for_office`: Senate or House office without a state and without a zip. `missing_district_for_house`: House office without a district number and without a zip. `summary_does_not_support_zip`: Summary mode invoked with a zip parameter. `inputs_not_applicable_to_mode`: The resolved elections endpoint does not accept one or more explicitly supplied inputs. Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `cycle_must_be_even`: Cycle is an odd year. `missing_state_for_office`: Senate or House office without a state and without a zip. `missing_district_for_house`: House office without a district number and without a zip. `inputs_not_applicable_to_office`: A presidential race given a state other than US, or a presidential or Senate race given a district other than 00 (or 0, which OpenFEC pads to 00) — values OpenFEC never files those races under. `summary_does_not_support_zip`: Summary mode invoked with a zip parameter. `inputs_not_applicable_to_mode`: The resolved elections endpoint does not accept one or more explicitly supplied inputs. Other values are possible when a failure originates below the handler."
    • changedOutput schema / properties / error / properties / data / properties / reason / examples
      Previous value: -[
      -  "cycle_must_be_even",
      -  "missing_state_for_office",
      -  "missing_district_for_house",
      -  "summary_does_not_support_zip",
      -  "inputs_not_applicable_to_mode"
      -]New value: +[
      +  "cycle_must_be_even",
      +  "missing_state_for_office",
      +  "missing_district_for_house",
      +  "inputs_not_applicable_to_office",
      +  "summary_does_not_support_zip",
      +  "inputs_not_applicable_to_mode"
      +]
    • changedOutput schema / properties / results / description
      Previous value: -"Election race result set; candidate financial rows in search mode, a single aggregate summary row in summary mode."New value: +"Election race result set; candidate financial rows in search mode, race locators (office, state, district, cycle) in a search with zip, a single aggregate summary row in summary mode."
    • changedOutput schema / properties / results / items / description
      Previous value: -"Candidate financial row (search mode) or aggregate race summary (summary mode)."New value: +"Candidate financial row (search mode), race locator (search with zip), or aggregate race summary (summary mode)."
    • changedOutput schema / properties / totalCount / description
      Previous value: -"Total matching candidates or race summaries."New value: +"Total matching candidates, race locators, or race summaries."
  2. Changed2 schema fields changed
    • changedOutput schema / properties / notice / description
      Previous value: -"Guidance when no election results matched — echoes filters and suggests how to broaden."New value: +"Guidance when the response carries no election results: how to broaden a search that matched nothing, or which requested position ran out when results did match."
    • addedOutput schema / properties / pagination / properties / count_is_approximate
      Added value: +{
      +  "description": "True when OpenFEC reports this count as an estimate rather than a tally, which it does on its highest-volume datasets. Absent means the count is a tally. An estimated count — and the pages derived from it — can be off by a wide margin; treat it as an order of magnitude, not a figure to quote.",
      +  "type": "boolean"
      +}
  3. Changed1 schema field changed
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `cycle_must_be_even`: Cycle is an odd year `missing_state_for_office`: Senate or House office without a state and without a zip `missing_district_for_house`: House office without a district number and without a zip `summary_does_not_support_zip`: Summary mode invoked with a zip parameter `inputs_not_applicable_to_mode`: The resolved elections endpoint does not accept one or more explicitly supplied inputs Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `cycle_must_be_even`: Cycle is an odd year. `missing_state_for_office`: Senate or House office without a state and without a zip. `missing_district_for_house`: House office without a district number and without a zip. `summary_does_not_support_zip`: Summary mode invoked with a zip parameter. `inputs_not_applicable_to_mode`: The resolved elections endpoint does not accept one or more explicitly supplied inputs. Other values are possible when a failure originates below the handler."
  4. Changed5 schema fields changed
    • removedInput schema / properties / page / default
      Removed value: -1
    • changedInput schema / properties / page / description
      Previous value: -"Page number (1-indexed). Search mode only — summary mode returns a single aggregate row. Read pagination.pages in the response to see how many pages exist."New value: +"Page number (1-indexed). Search mode only; explicit page is rejected in summary mode. Defaults to 1 for search."
    • removedInput schema / properties / per_page / default
      Removed value: -20
    • changedInput schema / properties / per_page / description
      Previous value: -"Results per page. Search mode only."New value: +"Results per page. Search mode only; defaults to 20."
    • changedOutput schema / properties / error / properties / data / properties / reason / description
      Previous value: -"Machine-readable failure mode. Declared by this tool: `cycle_must_be_even`: Cycle is an odd year `missing_state_for_office`: Senate or House office without a state and without a zip `missing_district_for_house`: House office without a district number and without a zip `summary_does_not_support_zip`: Summary mode invoked with a zip parameter `inputs_not_applicable_to_mode`: election_full supplied alongside zip — a ZIP-scoped search runs an endpoint that has no such parameter Other values are possible when a failure originates below the handler."New value: +"Machine-readable failure mode. Declared by this tool: `cycle_must_be_even`: Cycle is an odd year `missing_state_for_office`: Senate or House office without a state and without a zip `missing_district_for_house`: House office without a district number and without a zip `summary_does_not_support_zip`: Summary mode invoked with a zip parameter `inputs_not_applicable_to_mode`: The resolved elections endpoint does not accept one or more explicitly supplied inputs Other values are possible when a failure originates below the handler."
  5. Changed6 schema fields changed
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedInput schema / additionalProperties
      Added value: +false
    • changedOutput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
    • addedOutput schema / anyOf
      Added value: +[
      +  {
      +    "not": {
      +      "required": [
      +        "error"
      +      ]
      +    },
      +    "required": [
      +      "results",
      +      "mode",
      +      "pagination",
      +      "search_criteria",
      +      "totalCount"
      +    ]
      +  },
      +  {
      +    "required": [
      +      "error"
      +    ]
      +  }
      +]
    • addedOutput schema / properties / error
      Added value: +{
      +  "additionalProperties": {},
      +  "description": "Present when the call failed. Absent on success.",
      +  "properties": {
      +    "code": {
      +      "description": "JSON-RPC error code for this failure.",
      +      "maximum": 9007199254740991,
      +      "minimum": -9007199254740991,
      +      "type": "integer"
      +    },
      +    "data": {
      +      "additionalProperties": {},
      +      "properties": {
      +        "reason": {
      +          "description": "Machine-readable failure mode. Declared by this tool: `cycle_must_be_even`: Cycle is an odd year `missing_state_for_office`: Senate or House office without a state and without a zip `missing_district_for_house`: House office without a district number and without a zip `summary_does_not_support_zip`: Summary mode invoked with a zip parameter `inputs_not_applicable_to_mode`: election_full supplied alongside zip — a ZIP-scoped search runs an endpoint that has no such parameter Other values are possible when a failure originates below the handler.",
      +          "examples": [
      +            "cycle_must_be_even",
      +            "missing_state_for_office",
      +            "missing_district_for_house",
      +            "summary_does_not_support_zip",
      +            "inputs_not_applicable_to_mode"
      +          ],
      +          "type": "string"
      +        },
      +        "recovery": {
      +          "additionalProperties": {},
      +          "description": "Actionable next step for the caller.",
      +          "properties": {
      +            "hint": {
      +              "type": "string"
      +            }
      +          },
      +          "required": [
      +            "hint"
      +          ],
      +          "type": "object"
      +        },
      +        "retryable": {
      +          "description": "Whether retrying may succeed.",
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "message": {
      +      "description": "Human-readable description of what went wrong.",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "code",
      +    "message"
      +  ],
      +  "type": "object"
      +}
    • removedOutput schema / required
      Removed value: -[
      -  "results",
      -  "mode",
      -  "pagination",
      -  "search_criteria",
      -  "totalCount"
      -]
  6. Changed5 schema fields changed
    • removedInput schema / properties / election_full / default
      Removed value: -true
    • changedInput schema / properties / election_full / description
      Previous value: -"Expand to full election period (4yr president, 6yr senate, 2yr house). Default true. Ignored for ZIP-based searches."New value: +"Expand to full election period (4yr president, 6yr senate, 2yr house). Defaults to true when omitted; a ZIP-scoped search rejects it, since that endpoint has no such parameter. Carries no schema default, so an explicit value is distinguishable from an omission."
    • addedOutput schema / properties / mode
      Added value: +{
      +  "description": "Query mode as the server resolved it. Row shapes differ by mode — search rows are per-candidate financial records, summary is one aggregate race row — so read this rather than inferring the shape from the fields present.",
      +  "enum": [
      +    "search",
      +    "summary"
      +  ],
      +  "type": "string"
      +}
    • changedOutput schema / properties / search_criteria / description
      Previous value: -"Echo of the search filters that produced this result set. Populated when results are empty to help diagnose why nothing matched."New value: +"Echo of the search filters this call applied, as the server parsed them, minus paging arguments. Always present — compare it against what you sent to confirm every filter was honoured."
    • changedOutput schema / required
      Previous value: -[
      -  "results",
      -  "pagination",
      -  "totalCount"
      -]New value: +[
      +  "results",
      +  "mode",
      +  "pagination",
      +  "search_criteria",
      +  "totalCount"
      +]
  7. Changed2 schema fields changed
    • addedInput schema / properties / page
      Added value: +{
      +  "default": 1,
      +  "description": "Page number (1-indexed). Search mode only — summary mode returns a single aggregate row. Read pagination.pages in the response to see how many pages exist.",
      +  "maximum": 9007199254740991,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / per_page
      Added value: +{
      +  "default": 20,
      +  "description": "Results per page. Search mode only.",
      +  "maximum": 100,
      +  "minimum": 1,
      +  "type": "integer"
      +}
  8. Changed3 schema fields changed
    • addedOutput schema / properties / notice
      Added value: +{
      +  "description": "Guidance when no election results matched — echoes filters and suggests how to broaden.",
      +  "type": "string"
      +}
    • addedOutput schema / properties / totalCount
      Added value: +{
      +  "description": "Total matching candidates or race summaries.",
      +  "type": "number"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "results",
      -  "pagination"
      -]New value: +[
      +  "results",
      +  "pagination",
      +  "totalCount"
      +]
  9. Changed6 schema fields changed
    • changedInput schema / properties / office / description
      Previous value: -"Office sought: president, senate, or house."New value: +"Office sought: H=House, S=Senate, P=President."
    • changedInput schema / properties / office / enum
      Previous value: -[
      -  "president",
      -  "senate",
      -  "house"
      -]New value: +[
      +  "H",
      +  "S",
      +  "P"
      +]
    • changedOutput schema / properties / pagination / properties / page / description
      Previous value: -"Current page number."New value: +"Current page number (1-indexed)."
    • changedOutput schema / properties / pagination / properties / pages / description
      Previous value: -"Total pages available."New value: +"Total number of pages."
    • changedOutput schema / properties / results / description
      Previous value: -"Election race records — candidates with financial data, or aggregate summary."New value: +"Election race result set; candidate financial rows in search mode, a single aggregate summary row in summary mode."
    • changedOutput schema / properties / results / items / description
      Previous value: -"An election race record (candidate financial row or aggregate summary)."New value: +"Candidate financial row (search mode) or aggregate race summary (summary mode)."
  10. Changed1 schema field changed
    • addedOutput schema / properties / results / items / description
      Added value: +"An election race record (candidate financial row or aggregate summary)."
  11. Changed4 schema fields changed
    • addedOutput schema / properties / results / items / properties
      Added value: +{}
    • removedOutput schema / properties / results / items / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
    • addedOutput schema / properties / search_criteria / properties
      Added value: +{}
    • removedOutput schema / properties / search_criteria / propertyNames
      Removed value: -{
      -  "type": "string"
      -}
  12. First observed

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and idempotentHint=true, so the safety profile is covered. The description adds a little behavioral context by distinguishing candidate-level fundraising results from aggregate summaries, but it does not mention ZIP-locator behavior, pagination, or mode-specific constraints that the schema later supplies.

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 definition is two sentences and front-loads the core purpose. There is mild redundancy between “candidate financial summaries” and “fundraising totals,” but no wasted framing.

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

Completeness4/5

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

Given the rich schema, complete parameter coverage, output schema, and read-only annotations, the description provides enough orientation to call the tool. It could better mention sibling routing and the ZIP locator mode, but those are documented in the schema rather than required in the description.

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?

Schema description coverage is 100%, so all nine parameters are already documented in the input schema. The description adds only broad meaning around fundraising totals and aggregate summaries, without explaining parameter interactions or ZIP-scoped search behavior beyond what the schema provides.

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 states a specific verb and resource: looking up federal election races and candidate financial summaries. It also distinguishes the candidate-listing and aggregate-summary flavors, though it does not name or contrast sibling tools such as openfec_search_candidates.

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

Usage Guidelines3/5

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

It implies two usage modes by saying the tool can find who is running with fundraising totals or return an aggregate race summary. However, it gives no explicit when-to-use guidance against sibling search tools and no conditions or exclusions.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.