Skip to main content
Glama

openfda

Count/aggregate over an openFDA dataset

count
Read-only

openFDA's most valuable feature: aggregate over any dataset by a field to get a top-terms histogram (returns results: [{term, count}] instead of records). Use the '.exact' field suffix to count whole phrases. Example: endpoint 'drug/event', field 'patient.reaction.reactionmeddrapt.exact', search 'patient.drug.medicinalproduct:"aspirin"' → the most common reactions reported for aspirin.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldYesThe field to count/aggregate on (required), e.g. 'patient.reaction.reactionmeddrapt.exact' or 'classification'. Add '.exact' to count whole phrases rather than tokens.
limitNoMax number of distinct terms to return (1–1000).
searchNoOptional Lucene filter applied before aggregation (same syntax as the search tools).
endpointYesThe openFDA endpoint to query, e.g. 'drug/event', 'device/510k', 'food/enforcement'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations only declare readOnlyHint=true, so the description carries the rest. It discloses the return shape (a term/count histogram rather than records), the '.exact' whole-phrase behavior, and that limit caps distinct terms — genuinely useful behavioral context beyond the annotation.

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?

Front-loaded with the core behavior, then the '.exact' rule, then a concrete example. The 'openFDA's most valuable feature' framing is mildly promotional, but the rest is dense and earns its place.

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?

With no output schema, the description compensates by describing the return structure (`results: [{term, count}]`) and the aggregation semantics. Enough for an agent to call it correctly, though pagination/ordering of top terms is not addressed.

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 four parameters are already documented. The description reinforces the '.exact' suffix convention and gives a search/endpoint/field example, but adds little that the schema does not already state, so the baseline 3 applies.

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

Purpose5/5

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

States a specific verb and output: aggregate over a dataset by a field to get a top-terms histogram, returning `results: [{term, count}]` instead of records. This clearly distinguishes it from the sibling search_* tools, which return records.

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

Usage Guidelines4/5

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

Explains the concrete usage pattern (aggregate by field, optionally prefixed with a Lucene search filter) and includes a worked example. It implies the when-to-use case versus the search tools by contrast, but never explicitly names a sibling or states 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.