Skip to main content
Glama
Limecooler

fda-mcp

by Limecooler

count_records

Aggregate records across any OpenFDA endpoint to get top values, counts, and percentages. Ideal for statistics, distributions, and top-N lists.

Instructions

Count/aggregate records by field across any OpenFDA endpoint. Returns top values with counts, percentages, and a narrative summary.

When to use: Getting statistics, distributions, or "top N" lists. For individual records, use search_fda instead.

Args: endpoint: One of the 21 OpenFDA endpoint paths (e.g., "drug/event", "device/510k"). Call list_searchable_fields to see valid endpoints. count_field: Field to aggregate on. IMPORTANT: You MUST add .exact suffix for text fields (e.g., "patient.reaction.reactionmeddrapt.exact"). Without .exact, text fields are tokenized and counts will be wrong. Numeric and date fields do NOT need .exact. search: Optional search filter to narrow records before counting. limit: Number of top values to return (default 10, max 1000).

Examples: Top adverse reactions for a drug: endpoint="drug/event", count_field="patient.reaction.reactionmeddrapt.exact", search='patient.drug.openfda.brand_name:"ASPIRIN"' Device recalls by classification: endpoint="device/enforcement", count_field="classification.exact" Food recall reasons: endpoint="food/enforcement", count_field="reason_for_recall.exact", limit=5

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
searchNo
endpointYes
count_fieldYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses return components (counts, percentages, narrative summary), the critical .exact suffix requirement with the consequence of tokenized counts, and the limit's default/max. It lacks rate limits or error behavior, but for this read/aggregate tool it provides substantial behavioral context.

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 well-organized with a concise summary, 'When to use' section, labeled Args list, and practical examples. Every section earns its place and the markdown formatting improves scannability without adding fluff.

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

Completeness5/5

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

For a complex tool with 4 parameters and a non-obvious .exact suffix requirement, the description addresses the core nuances, gives multiple examples, and references sibling tools for additional context. The output schema exists, so not detailing return values is acceptable; the description still mentions the output composition.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must fully compensate. It does: endpoint is explained with examples and a cross-reference, count_field gets a crucial .exact warning with text vs numeric/date distinction, search is described as an optional filter, and limit has default and max values. Examples further clarify usage.

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?

The description clearly states 'Count/aggregate records by field across any OpenFDA endpoint,' giving a specific verb, resource, and scope. It distinguishes itself from the sibling tool search_fda, which is for individual records, and references list_searchable_fields for endpoint discovery.

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

Usage Guidelines5/5

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

An explicit 'When to use' section states to use this for statistics, distributions, or top-N lists, and instructs to use search_fda for individual records. It also cross-references list_searchable_fields, providing clear guidance on when to use this tool vs alternatives.

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/Limecooler/fda-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server