io.github.cyanheads/openfda-mcp-server is an MCP server published by io.github.cyanheads, hosted at openfda.caseyjhand.com. When last checked on 2026-11-22 it was working: it answers and lists its tools. It declares 14 tools, including openfda_search_adverse_events, openfda_search_animal_events, openfda_search_drug_shortages, openfda_search_recalls, openfda_search_tobacco_reports.
Query FDA data on drugs, food, devices, and recalls via openFDA. STDIO or Streamable HTTP.
428 connections through 5 shared values. Tap any node.
Search adverse event reports across drugs, food, and devices. Use to investigate safety signals, find reports for a specific product, or explore reactions by demographics. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Field paths take only letters, digits, underscores, and dots; any other character or… |
| limit | integer | Records per page. Default and cap by category: drug 5 (cap 25), food 25 (cap 1000), device 10 (cap 175); a larger value returns at most that cap and says so. |
None yet. Changes appear after a server's second daily check.
Squares are this server's values; dots are other servers sharing them. A shared address or publisher is a lead, not proof of a common operator.
Inferred from the host name and headers: what a server runs on, not who runs it.
| stage | boolean | Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_… |
| fields | array | Dotted record paths to keep on each returned record, e.g. ["receivedate", "patient.drug.medicinalproduct"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (safetyreportid, report_number, m… |
| search | string | openFDA search query. Examples: patient.drug.medicinalproduct:"aspirin", patient.reaction.reactionmeddrapt:"nausea" AND serious:"1". Omit both search and sort to browse the newest reports first. Separate clauses with spaces. A "+" written in the URL style of openFDA's examples also reads as a space … |
| category * | string | Product category — each has different field schemas in the response |
| canvas_id | string | Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas. |
{
"name": "openfda_search_adverse_events",
"title": "Openfda Search Adverse Events",
"description": "Search adverse event reports across drugs, food, and devices. Use to investigate safety signals, find reports for a specific product, or explore reactions by demographics. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"category"
],
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. Sortable date fields are category-specific: drug → receivedate (or receiptdate), food → date_created (or date_started), device → date_received (or date_of_event). A field from another category (e.g. receivedate on food or device) causes a query error — use the field for this category. With search also omitted, the default is newest first: drug receivedate:desc, food date_created:desc, device date_received:desc. A search with no sort keeps openFDA's own order."
},
"limit": {
"type": "integer",
"minimum": 1,
"description": "Records per page. Default and cap by category: drug 5 (cap 25), food 25 (cap 1000), device 10 (cap 175); a larger value returns at most that cap and says so."
},
"stage": {
"type": "boolean",
"default": false,
"description": "Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_rows reports how many reached it). Staging is for record-level SQL over a bounded slice; for a distribution over everything that matched, openfda_count_values aggregates server-side in one request. Requires CANVAS_PROVIDER_TYPE=duckdb."
},
"fields": {
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9_.]+$"
},
"description": "Dotted record paths to keep on each returned record, e.g. [\"receivedate\", \"patient.drug.medicinalproduct\"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (safetyreportid, report_number, mdr_report_key), identically on both response surfaces, and a path through an array applies to every element. Use it when records are large: when a record on the page serializes above 24000 bytes, page_bytes reports the page's size and page_largest_fields names the largest record's biggest fields. A path no returned record carries is named on the notice. Omit for whole records. Paths take only letters, digits, underscores, and dots; anything else is rejected before the request. With stage=true, only the inline page is projected — the staged table keeps its columns."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "openFDA search query. Examples: patient.drug.medicinalproduct:\"aspirin\", patient.reaction.reactionmeddrapt:\"nausea\" AND serious:\"1\". Omit both search and sort to browse the newest reports first. Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"category": {
"enum": [
"drug",
"food",
"device"
],
"type": "string",
"description": "Product category — each has different field schemas in the response"
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"totalResults"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Pagination offset"
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching records in the database"
},
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"limit_above_cap",
"canvas_disabled",
"canvas_not_found",
"canvas_capacity_exhausted",
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `limit_above_cap`: limit exceeds the cap of the endpoint this call selects, on a deployment that rejects rather than clamps it. `canvas_disabled`: Staging was requested (stage=true or a canvas_id) but DataCanvas is disabled. `canvas_not_found`: The canvas_id is well-formed but names no active canvas — expired or never minted. `canvas_capacity_exhausted`: canvas_id was omitted and the active canvas cap is already reached. `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"notice": {
"type": "string",
"description": "Canvas staging disclosure when the call staged, the limit clamp when limit exceeded the category's cap (requested value, cap, next skip), the fields projection and any requested path no record carries, the size and largest fields when a report on the page exceeds 24000 bytes, and guidance when results are empty or paging overshot — how to broaden filters or adjust the query."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "Adverse event records — fields vary by category (drug: patient/reactions/drugs, device: device details/event type, food: products/outcomes)"
},
"spilled": {
"type": "boolean",
"description": "True when this call staged its matched set on the canvas — use canvas_id with openfda_dataframe_describe for its columns, then openfda_dataframe_query for SQL. Absent when staging was not requested."
},
"canvas_id": {
"type": "string",
"description": "DataCanvas session id for the staged result set. Present when this call staged. Pass to openfda_dataframe_query / openfda_dataframe_describe, or back into this tool to accumulate more tables on the same canvas."
},
"truncated": {
"type": "boolean",
"description": "True when fewer rows reached the canvas than matched upstream — staging stopped at its size budget or openFDA's 25000-row pagination ceiling. Narrow the query (filters, date range) for a complete set."
},
"page_bytes": {
"type": "number",
"description": "Serialized size of results in this response, in UTF-8 bytes. Present only when a record on the page serializes above 24000 bytes on its own — page_largest_fields then names the largest record's biggest fields, and fields projects each record to the paths you need."
},
"staged_rows": {
"type": "number",
"description": "Rows written to the canvas table. Compare with meta.total: a smaller value means staging stopped at its size budget or openFDA's 25000-row pagination ceiling, and the table holds only the first staged_rows records."
},
"canvas_table": {
"type": "string",
"description": "Canvas table holding the staged rows. Present when rows were staged; list its columns with openfda_dataframe_describe, then reference it in openfda_dataframe_query FROM clauses."
},
"totalResults": {
"type": "number",
"description": "Total matching adverse event records in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the query, as submitted to openFDA"
},
"projected_fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "The field paths each record in results was projected to, as requested — present only when the call passed fields. Every record also keeps its identity key; any other field is absent because the projection left it out, not because openFDA lacks it. Re-call without fields for whole records."
},
"page_largest_fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"bytes"
],
"properties": {
"path": {
"type": "string",
"description": "Dotted field path on the record. Fields of array elements share their array path, so patient.drug.openfda covers that block in every drug of the report."
},
"bytes": {
"type": "number",
"description": "Serialized UTF-8 bytes the field holds, totalled across array elements."
}
},
"description": "One field of the largest record and its serialized size.",
"additionalProperties": false
},
"description": "Present with page_bytes: the biggest fields of the largest record on the page, largest first — the deepest single field that holds that record's excess over 24000 bytes, or else up to three top-level fields. Leave them out with a fields projection to shrink the records."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Search adverse event reports for veterinary drugs and devices submitted to the FDA Center for Veterinary Medicine. Records include animal species, breed, age, weight, drug name and route, adverse reactions (using VeDDRA terminology), and outcome. Use to investigate safety signals for veterinary products, find reports by animal species or drug, or explore reaction patterns. Brand and manufacturer names are masked as "MSK" on every record (the FDA null flavor for withheld data), so find a product by active ingredient on drug.active_ingredients.name, unsuffixed. An ingredient search spans every product containing it and cannot attribute reports to one brand; drug.manufacturer.registration_number (the full value, e.g. "USA-USFDACVM-N141426") narrows it to one approval. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Omitted with no search, defaults to original_receive_date:desc, newest first; omitte… |
| limit | integer | Records per page. Default 25; a larger value returns at most 450 and says so. |
| stage | boolean | Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_… |
| fields | array | Dotted record paths to keep on each returned record, e.g. ["original_receive_date", "animal.species"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (unique_aer_id_number), identically on… |
| search | string | openFDA search query using field:value syntax. Examples: animal.species:"Dog", drug.active_ingredients.name:"Fluralaner", reaction.veddra_term_name:"Vomiting", serious_ae:"true". Omit to browse newest first, sorted by original_receive_date:desc. Separate clauses with spaces. A "+" written in the URL… |
| canvas_id | string | Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas. |
{
"name": "openfda_search_animal_events",
"title": "Openfda Search Animal Events",
"description": "Search adverse event reports for veterinary drugs and devices submitted to the FDA Center for Veterinary Medicine. Records include animal species, breed, age, weight, drug name and route, adverse reactions (using VeDDRA terminology), and outcome. Use to investigate safety signals for veterinary products, find reports by animal species or drug, or explore reaction patterns. Brand and manufacturer names are masked as \"MSK\" on every record (the FDA null flavor for withheld data), so find a product by active ingredient on drug.active_ingredients.name, unsuffixed. An ingredient search spans every product containing it and cannot attribute reports to one brand; drug.manufacturer.registration_number (the full value, e.g. \"USA-USFDACVM-N141426\") narrows it to one approval. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Omitted with no search, defaults to original_receive_date:desc, newest first; omitted with a search, results come in openFDA's relevance order. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. A well-formed but non-sortable field still causes a query error — use a documented field name."
},
"limit": {
"type": "integer",
"default": 25,
"minimum": 1,
"description": "Records per page. Default 25; a larger value returns at most 450 and says so."
},
"stage": {
"type": "boolean",
"default": false,
"description": "Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_rows reports how many reached it). Staging is for record-level SQL over a bounded slice; for a distribution over everything that matched, openfda_count_values aggregates server-side in one request. Requires CANVAS_PROVIDER_TYPE=duckdb."
},
"fields": {
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9_.]+$"
},
"description": "Dotted record paths to keep on each returned record, e.g. [\"original_receive_date\", \"animal.species\"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (unique_aer_id_number), identically on both response surfaces, and a path through an array applies to every element. Use it when records are large: when a record on the page serializes above 24000 bytes, page_bytes reports the page's size and page_largest_fields names the largest record's biggest fields. A path no returned record carries is named on the notice. Omit for whole records. Paths take only letters, digits, underscores, and dots; anything else is rejected before the request. With stage=true, only the inline page is projected — the staged table keeps its columns."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "openFDA search query using field:value syntax. Examples: animal.species:\"Dog\", drug.active_ingredients.name:\"Fluralaner\", reaction.veddra_term_name:\"Vomiting\", serious_ae:\"true\". Omit to browse newest first, sorted by original_receive_date:desc. Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"totalResults"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Pagination offset"
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching records in the dataset"
},
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"canvas_disabled",
"canvas_not_found",
"canvas_capacity_exhausted",
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `canvas_disabled`: Staging was requested (stage=true or a canvas_id) but DataCanvas is disabled. `canvas_not_found`: The canvas_id is well-formed but names no active canvas — expired or never minted. `canvas_capacity_exhausted`: canvas_id was omitted and the active canvas cap is already reached. `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"notice": {
"type": "string",
"description": "Canvas staging disclosure when the call staged, the limit clamp when limit exceeded the cap (requested value, cap, next skip), the fields projection and any requested path no record carries, the size and largest fields when a record on the page exceeds 24000 bytes, and guidance when results are empty or paging overshot — how to broaden filters or adjust the query."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "Animal adverse event records. Key fields: unique_aer_id_number, original_receive_date, serious_ae, animal (species, gender, breed, age, weight), drug[] (brand_name, active_ingredients, route, dose, administered_by), reaction[] (veddra_term_name, number_of_animals_affected), outcome[] (medical_status), primary_reporter, type_of_information."
},
"spilled": {
"type": "boolean",
"description": "True when this call staged its matched set on the canvas — use canvas_id with openfda_dataframe_describe for its columns, then openfda_dataframe_query for SQL. Absent when staging was not requested."
},
"canvas_id": {
"type": "string",
"description": "DataCanvas session id for the staged result set. Present when this call staged. Pass to openfda_dataframe_query / openfda_dataframe_describe, or back into this tool to accumulate more tables on the same canvas."
},
"truncated": {
"type": "boolean",
"description": "True when fewer rows reached the canvas than matched upstream — staging stopped at its size budget or openFDA's 25000-row pagination ceiling. Narrow the query (filters, date range) for a complete set."
},
"page_bytes": {
"type": "number",
"description": "Serialized size of results in this response, in UTF-8 bytes. Present only when a record on the page serializes above 24000 bytes on its own — page_largest_fields then names the largest record's biggest fields, and fields projects each record to the paths you need."
},
"staged_rows": {
"type": "number",
"description": "Rows written to the canvas table. Compare with meta.total: a smaller value means staging stopped at its size budget or openFDA's 25000-row pagination ceiling, and the table holds only the first staged_rows records."
},
"canvas_table": {
"type": "string",
"description": "Canvas table holding the staged rows. Present when rows were staged; list its columns with openfda_dataframe_describe, then reference it in openfda_dataframe_query FROM clauses."
},
"totalResults": {
"type": "number",
"description": "Total matching animal adverse event records in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the query, as submitted to openFDA"
},
"projected_fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "The field paths each record in results was projected to, as requested — present only when the call passed fields. Every record also keeps its identity key; any other field is absent because the projection left it out, not because openFDA lacks it. Re-call without fields for whole records."
},
"page_largest_fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"bytes"
],
"properties": {
"path": {
"type": "string",
"description": "Dotted field path on the record. Fields of array elements share their array path, so patient.drug.openfda covers that block in every drug of the report."
},
"bytes": {
"type": "number",
"description": "Serialized UTF-8 bytes the field holds, totalled across array elements."
}
},
"description": "One field of the largest record and its serialized size.",
"additionalProperties": false
},
"description": "Present with page_bytes: the biggest fields of the largest record on the page, largest first — the deepest single field that holds that record's excess over 24000 bytes, or else up to three top-level fields. Leave them out with a fields projection to shrink the records."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Search FDA drug shortage records. Returns per-product shortage status, availability, therapeutic category, dosage form, manufacturer, and dates. Use to check whether a drug is currently in shortage, find all oncology drugs with supply issues, or retrieve the openfda block (brand_name, product_ndc, rxcui) to chain into openfda_get_drug_label or openfda_lookup_ndc. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Example: update_date:desc. Field paths take only letters, digits, underscores, and d… |
| limit | integer | Records per page. Default 25; a larger value returns at most 1000 and says so. |
| stage | boolean | Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_… |
| fields | array | Dotted record paths to keep on each returned record, e.g. ["generic_name", "status"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (package_ndc), identically on both response surfaces, a… |
| search | string | openFDA search query using field:value syntax. Examples: status:"Current", therapeutic_category:"Oncology", generic_name:"carboplatin", company_name:"pfizer". Omit to browse all records. Separate clauses with spaces. A "+" written in the URL style of openFDA's examples also reads as a space where it… |
| canvas_id | string | Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas. |
{
"name": "openfda_search_drug_shortages",
"title": "Openfda Search Drug Shortages",
"description": "Search FDA drug shortage records. Returns per-product shortage status, availability, therapeutic category, dosage form, manufacturer, and dates. Use to check whether a drug is currently in shortage, find all oncology drugs with supply issues, or retrieve the openfda block (brand_name, product_ndc, rxcui) to chain into openfda_get_drug_label or openfda_lookup_ndc. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Example: update_date:desc. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. A well-formed but non-sortable field still causes a query error — use a documented field name."
},
"limit": {
"type": "integer",
"default": 25,
"minimum": 1,
"description": "Records per page. Default 25; a larger value returns at most 1000 and says so."
},
"stage": {
"type": "boolean",
"default": false,
"description": "Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_rows reports how many reached it). Staging is for record-level SQL over a bounded slice; for a distribution over everything that matched, openfda_count_values aggregates server-side in one request. Requires CANVAS_PROVIDER_TYPE=duckdb."
},
"fields": {
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9_.]+$"
},
"description": "Dotted record paths to keep on each returned record, e.g. [\"generic_name\", \"status\"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (package_ndc), identically on both response surfaces, and a path through an array applies to every element. Use it when records are large: when a record on the page serializes above 24000 bytes, page_bytes reports the page's size and page_largest_fields names the largest record's biggest fields. A path no returned record carries is named on the notice. Omit for whole records. Paths take only letters, digits, underscores, and dots; anything else is rejected before the request. With stage=true, only the inline page is projected — the staged table keeps its columns."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "openFDA search query using field:value syntax. Examples: status:\"Current\", therapeutic_category:\"Oncology\", generic_name:\"carboplatin\", company_name:\"pfizer\". Omit to browse all records. Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request. Call openfda_describe_fields({ endpoint: \"drug/shortages\" }) for the complete field list."
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"totalResults"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Pagination offset"
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching shortage records in the database"
},
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"canvas_disabled",
"canvas_not_found",
"canvas_capacity_exhausted",
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `canvas_disabled`: Staging was requested (stage=true or a canvas_id) but DataCanvas is disabled. `canvas_not_found`: The canvas_id is well-formed but names no active canvas — expired or never minted. `canvas_capacity_exhausted`: canvas_id was omitted and the active canvas cap is already reached. `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"notice": {
"type": "string",
"description": "Canvas staging disclosure when the call staged, the limit clamp when limit exceeded the cap (requested value, cap, next skip), the fields projection and any requested path no record carries, the size and largest fields when a record on the page exceeds 24000 bytes, and guidance when results are empty — how to broaden filters or correct field names."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "Drug shortage records. Key fields: generic_name, status (\"Current\", \"To Be Discontinued\", or \"Resolved\"), availability, therapeutic_category, dosage_form, presentation, package_ndc, company_name, contact_info, initial_posting_date, update_date, update_type. openfda block contains brand_name, product_ndc, rxcui, spl_set_id for cross-linking."
},
"spilled": {
"type": "boolean",
"description": "True when this call staged its matched set on the canvas — use canvas_id with openfda_dataframe_describe for its columns, then openfda_dataframe_query for SQL. Absent when staging was not requested."
},
"canvas_id": {
"type": "string",
"description": "DataCanvas session id for the staged result set. Present when this call staged. Pass to openfda_dataframe_query / openfda_dataframe_describe, or back into this tool to accumulate more tables on the same canvas."
},
"truncated": {
"type": "boolean",
"description": "True when fewer rows reached the canvas than matched upstream — staging stopped at its size budget or openFDA's 25000-row pagination ceiling. Narrow the query (filters, date range) for a complete set."
},
"page_bytes": {
"type": "number",
"description": "Serialized size of results in this response, in UTF-8 bytes. Present only when a record on the page serializes above 24000 bytes on its own — page_largest_fields then names the largest record's biggest fields, and fields projects each record to the paths you need."
},
"staged_rows": {
"type": "number",
"description": "Rows written to the canvas table. Compare with meta.total: a smaller value means staging stopped at its size budget or openFDA's 25000-row pagination ceiling, and the table holds only the first staged_rows records."
},
"canvas_table": {
"type": "string",
"description": "Canvas table holding the staged rows. Present when rows were staged; list its columns with openfda_dataframe_describe, then reference it in openfda_dataframe_query FROM clauses."
},
"totalResults": {
"type": "number",
"description": "Total matching drug shortage records in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the drug/shortages query, as submitted to openFDA"
},
"projected_fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "The field paths each record in results was projected to, as requested — present only when the call passed fields. Every record also keeps its identity key; any other field is absent because the projection left it out, not because openFDA lacks it. Re-call without fields for whole records."
},
"page_largest_fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"bytes"
],
"properties": {
"path": {
"type": "string",
"description": "Dotted field path on the record. Fields of array elements share their array path, so patient.drug.openfda covers that block in every drug of the report."
},
"bytes": {
"type": "number",
"description": "Serialized UTF-8 bytes the field holds, totalled across array elements."
}
},
"description": "One field of the largest record and its serialized size.",
"additionalProperties": false
},
"description": "Present with page_bytes: the biggest fields of the largest record on the page, largest first — the deepest single field that holds that record's excess over 24000 bytes, or else up to three top-level fields. Leave them out with a fields projection to shrink the records."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Search enforcement reports and recall actions across drugs, food, and devices. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort (e.g. report_date:desc,status.exact:asc). Omitted with no search, defaults to report_… |
| limit | integer | Records per page. Default and cap by category and endpoint: drug or food enforcement 25 (cap 1000), device enforcement 10 (cap 125), device recall 10 (cap 50); a larger value returns at most that cap and says so. |
| stage | boolean | Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_… |
| fields | array | Dotted record paths to keep on each returned record, e.g. ["recalling_firm", "reason_for_recall"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (recall_number, product_res_number), ident… |
| search | string | openFDA search query. Examples: classification:"Class I" (also "Class II" or "Class III"), recalling_firm:"pfizer", reason_for_recall:"undeclared allergen". Omit to browse newest first, sorted by report_date:desc (event_date_initiated:desc on the device recall endpoint). Separate clauses with spaces… |
| category * | string | Product category |
| endpoint | string | Report type. Default enforcement. The recall endpoint is only available for devices. |
| canvas_id | string | Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas. |
{
"name": "openfda_search_recalls",
"title": "Openfda Search Recalls",
"description": "Search enforcement reports and recall actions across drugs, food, and devices. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"category"
],
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort (e.g. report_date:desc,status.exact:asc). Omitted with no search, defaults to report_date:desc (event_date_initiated:desc on the device recall endpoint), newest first; omitted with a search, results come in openFDA's relevance order. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. A well-formed but non-sortable field still causes a query error — use a documented field name."
},
"limit": {
"type": "integer",
"minimum": 1,
"description": "Records per page. Default and cap by category and endpoint: drug or food enforcement 25 (cap 1000), device enforcement 10 (cap 125), device recall 10 (cap 50); a larger value returns at most that cap and says so."
},
"stage": {
"type": "boolean",
"default": false,
"description": "Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_rows reports how many reached it). Staging is for record-level SQL over a bounded slice; for a distribution over everything that matched, openfda_count_values aggregates server-side in one request. Requires CANVAS_PROVIDER_TYPE=duckdb."
},
"fields": {
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9_.]+$"
},
"description": "Dotted record paths to keep on each returned record, e.g. [\"recalling_firm\", \"reason_for_recall\"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (recall_number, product_res_number), identically on both response surfaces, and a path through an array applies to every element. Use it when records are large: when a record on the page serializes above 24000 bytes, page_bytes reports the page's size and page_largest_fields names the largest record's biggest fields. A path no returned record carries is named on the notice. Omit for whole records. Paths take only letters, digits, underscores, and dots; anything else is rejected before the request. With stage=true, only the inline page is projected — the staged table keeps its columns."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "openFDA search query. Examples: classification:\"Class I\" (also \"Class II\" or \"Class III\"), recalling_firm:\"pfizer\", reason_for_recall:\"undeclared allergen\". Omit to browse newest first, sorted by report_date:desc (event_date_initiated:desc on the device recall endpoint). Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"category": {
"enum": [
"drug",
"food",
"device"
],
"type": "string",
"description": "Product category"
},
"endpoint": {
"enum": [
"enforcement",
"recall"
],
"type": "string",
"default": "enforcement",
"description": "Report type. Default enforcement. The recall endpoint is only available for devices."
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"totalResults"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Pagination offset"
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching records"
},
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"recall_endpoint_non_device",
"limit_above_cap",
"canvas_disabled",
"canvas_not_found",
"canvas_capacity_exhausted",
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `recall_endpoint_non_device`: The recall endpoint was requested for a non-device category. `limit_above_cap`: limit exceeds the cap of the endpoint this call selects, on a deployment that rejects rather than clamps it. `canvas_disabled`: Staging was requested (stage=true or a canvas_id) but DataCanvas is disabled. `canvas_not_found`: The canvas_id is well-formed but names no active canvas — expired or never minted. `canvas_capacity_exhausted`: canvas_id was omitted and the active canvas cap is already reached. `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"notice": {
"type": "string",
"description": "Canvas staging disclosure when the call staged, the limit clamp when limit exceeded the endpoint's cap (requested value, cap, next skip), the fields projection and any requested path no record carries, the size and largest fields when a record on the page exceeds 24000 bytes, and guidance when results are empty — how to broaden filters or correct field names."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "Enforcement or recall records. Enforcement records (every category) carry recall_number, classification, status, voluntary_mandated, recalling_firm, product_description, reason_for_recall, distribution_pattern, report_date. Device recall records name identity product_res_number and status recall_status, add res_event_number and root_cause_description, share the firm, product, reason, and distribution fields, and carry no recall hazard classification."
},
"spilled": {
"type": "boolean",
"description": "True when this call staged its matched set on the canvas — use canvas_id with openfda_dataframe_describe for its columns, then openfda_dataframe_query for SQL. Absent when staging was not requested."
},
"canvas_id": {
"type": "string",
"description": "DataCanvas session id for the staged result set. Present when this call staged. Pass to openfda_dataframe_query / openfda_dataframe_describe, or back into this tool to accumulate more tables on the same canvas."
},
"truncated": {
"type": "boolean",
"description": "True when fewer rows reached the canvas than matched upstream — staging stopped at its size budget or openFDA's 25000-row pagination ceiling. Narrow the query (filters, date range) for a complete set."
},
"page_bytes": {
"type": "number",
"description": "Serialized size of results in this response, in UTF-8 bytes. Present only when a record on the page serializes above 24000 bytes on its own — page_largest_fields then names the largest record's biggest fields, and fields projects each record to the paths you need."
},
"staged_rows": {
"type": "number",
"description": "Rows written to the canvas table. Compare with meta.total: a smaller value means staging stopped at its size budget or openFDA's 25000-row pagination ceiling, and the table holds only the first staged_rows records."
},
"canvas_table": {
"type": "string",
"description": "Canvas table holding the staged rows. Present when rows were staged; list its columns with openfda_dataframe_describe, then reference it in openfda_dataframe_query FROM clauses."
},
"totalResults": {
"type": "number",
"description": "Total matching recall/enforcement records in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the recall query, as submitted to openFDA"
},
"projected_fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "The field paths each record in results was projected to, as requested — present only when the call passed fields. Every record also keeps its identity key; any other field is absent because the projection left it out, not because openFDA lacks it. Re-call without fields for whole records."
},
"page_largest_fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"bytes"
],
"properties": {
"path": {
"type": "string",
"description": "Dotted field path on the record. Fields of array elements share their array path, so patient.drug.openfda covers that block in every drug of the report."
},
"bytes": {
"type": "number",
"description": "Serialized UTF-8 bytes the field holds, totalled across array elements."
}
},
"description": "One field of the largest record and its serialized size.",
"additionalProperties": false
},
"description": "Present with page_bytes: the biggest fields of the largest record on the page, largest first — the deepest single field that holds that record's excess over 24000 bytes, or else up to three top-level fields. Leave them out with a fields projection to shrink the records."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Search problem reports submitted to the FDA for tobacco products, including e-cigarettes, vaping products, cigarettes, and smokeless tobacco. Reports capture product type, reported health problems (e.g. seizure, chest pain), product problems (e.g. exploding battery), whether a non-user was affected, and submission date. Use to investigate safety signals, find reports by product type, or analyze health effects. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Omitted with no search, defaults to date_submitted:desc, newest first; omitted with … |
| limit | integer | Records per page. Default 25; a larger value returns at most 1000 and says so. |
| stage | boolean | Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_… |
| fields | array | Dotted record paths to keep on each returned record, e.g. ["date_submitted", "reported_health_problems"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (report_id), identically on both re… |
| search | string | openFDA search query using field:value syntax. Examples: tobacco_products:"Electronic cigarette", reported_health_problems:"Seizure", nonuser_affected:"Yes". Omit to browse newest first, sorted by date_submitted:desc. Separate clauses with spaces. A "+" written in the URL style of openFDA's examples… |
| canvas_id | string | Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas. |
{
"name": "openfda_search_tobacco_reports",
"title": "Openfda Search Tobacco Reports",
"description": "Search problem reports submitted to the FDA for tobacco products, including e-cigarettes, vaping products, cigarettes, and smokeless tobacco. Reports capture product type, reported health problems (e.g. seizure, chest pain), product problems (e.g. exploding battery), whether a non-user was affected, and submission date. Use to investigate safety signals, find reports by product type, or analyze health effects. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Omitted with no search, defaults to date_submitted:desc, newest first; omitted with a search, results come in openFDA's relevance order. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. A well-formed but non-sortable field still causes a query error — use a documented field name."
},
"limit": {
"type": "integer",
"default": 25,
"minimum": 1,
"description": "Records per page. Default 25; a larger value returns at most 1000 and says so."
},
"stage": {
"type": "boolean",
"default": false,
"description": "Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_rows reports how many reached it). Staging is for record-level SQL over a bounded slice; for a distribution over everything that matched, openfda_count_values aggregates server-side in one request. Requires CANVAS_PROVIDER_TYPE=duckdb."
},
"fields": {
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9_.]+$"
},
"description": "Dotted record paths to keep on each returned record, e.g. [\"date_submitted\", \"reported_health_problems\"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (report_id), identically on both response surfaces, and a path through an array applies to every element. Use it when records are large: when a record on the page serializes above 24000 bytes, page_bytes reports the page's size and page_largest_fields names the largest record's biggest fields. A path no returned record carries is named on the notice. Omit for whole records. Paths take only letters, digits, underscores, and dots; anything else is rejected before the request. With stage=true, only the inline page is projected — the staged table keeps its columns."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "openFDA search query using field:value syntax. Examples: tobacco_products:\"Electronic cigarette\", reported_health_problems:\"Seizure\", nonuser_affected:\"Yes\". Omit to browse newest first, sorted by date_submitted:desc. Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"totalResults"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Pagination offset"
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching records in the dataset"
},
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"canvas_disabled",
"canvas_not_found",
"canvas_capacity_exhausted",
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `canvas_disabled`: Staging was requested (stage=true or a canvas_id) but DataCanvas is disabled. `canvas_not_found`: The canvas_id is well-formed but names no active canvas — expired or never minted. `canvas_capacity_exhausted`: canvas_id was omitted and the active canvas cap is already reached. `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"notice": {
"type": "string",
"description": "Canvas staging disclosure when the call staged, the limit clamp when limit exceeded the cap (requested value, cap, next skip), the fields projection and any requested path no record carries, the size and largest fields when a record on the page exceeds 24000 bytes, and guidance when results are empty or paging overshot — how to broaden filters or adjust the query."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "Tobacco problem report records. Key fields: report_id, date_submitted, tobacco_products[] (product type description), reported_health_problems[] (health effects), reported_product_problems[] (device/product defects), number_tobacco_products, number_health_problems, number_product_problems, nonuser_affected."
},
"spilled": {
"type": "boolean",
"description": "True when this call staged its matched set on the canvas — use canvas_id with openfda_dataframe_describe for its columns, then openfda_dataframe_query for SQL. Absent when staging was not requested."
},
"canvas_id": {
"type": "string",
"description": "DataCanvas session id for the staged result set. Present when this call staged. Pass to openfda_dataframe_query / openfda_dataframe_describe, or back into this tool to accumulate more tables on the same canvas."
},
"truncated": {
"type": "boolean",
"description": "True when fewer rows reached the canvas than matched upstream — staging stopped at its size budget or openFDA's 25000-row pagination ceiling. Narrow the query (filters, date range) for a complete set."
},
"page_bytes": {
"type": "number",
"description": "Serialized size of results in this response, in UTF-8 bytes. Present only when a record on the page serializes above 24000 bytes on its own — page_largest_fields then names the largest record's biggest fields, and fields projects each record to the paths you need."
},
"staged_rows": {
"type": "number",
"description": "Rows written to the canvas table. Compare with meta.total: a smaller value means staging stopped at its size budget or openFDA's 25000-row pagination ceiling, and the table holds only the first staged_rows records."
},
"canvas_table": {
"type": "string",
"description": "Canvas table holding the staged rows. Present when rows were staged; list its columns with openfda_dataframe_describe, then reference it in openfda_dataframe_query FROM clauses."
},
"totalResults": {
"type": "number",
"description": "Total matching tobacco problem reports in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the query, as submitted to openFDA"
},
"projected_fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "The field paths each record in results was projected to, as requested — present only when the call passed fields. Every record also keeps its identity key; any other field is absent because the projection left it out, not because openFDA lacks it. Re-call without fields for whole records."
},
"page_largest_fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"bytes"
],
"properties": {
"path": {
"type": "string",
"description": "Dotted field path on the record. Fields of array elements share their array path, so patient.drug.openfda covers that block in every drug of the report."
},
"bytes": {
"type": "number",
"description": "Serialized UTF-8 bytes the field holds, totalled across array elements."
}
},
"description": "One field of the largest record and its serialized size.",
"additionalProperties": false
},
"description": "Present with page_bytes: the biggest fields of the largest record on the page, largest first — the deepest single field that holds that record's excess over 24000 bytes, or else up to three top-level fields. Leave them out with a fields projection to shrink the records."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Aggregate and tally unique values for any field across any openFDA endpoint. Returns ranked term-count pairs sorted by count descending; a date field tallies one term per distinct YYYYMMDD date, ranked the same way. Pair with openfda_search_adverse_events, openfda_search_drug_approvals, openfda_search_device_clearances, openfda_search_recalls, openfda_get_drug_label, or openfda_lookup_ndc when sample records help interpret the aggregates.
| Parameter | Type | Description |
|---|---|---|
| count * | string | Field to count. openfda_describe_fields gives the verified expression per field as countAs (null = not countable in any form). Otherwise: append .exact for whole-phrase counting of free-text fields (e.g. "patient.reaction.reactionmeddrapt.exact"); count identifier fields openFDA already indexes as k… |
| limit | integer | Number of top terms to return. truncated reports whether more distinct terms exist beyond it, except at 1000 — openFDA's own count maximum — where openFDA offers no way to tell. A date field is the exception: openFDA sends every date, so the tool ranks them all and truncated is exact at any limit; s… |
| search | string | Filter query to scope the count (e.g. patient.drug.medicinalproduct:"metformin"). Omit to count across every record in the endpoint. Separate clauses with spaces. A "+" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closin… |
| endpoint * | string | Full openFDA endpoint path (e.g. "drug/event", "device/classification") |
{
"name": "openfda_count_values",
"title": "Openfda Count Values",
"description": "Aggregate and tally unique values for any field across any openFDA endpoint. Returns ranked term-count pairs sorted by count descending; a date field tallies one term per distinct YYYYMMDD date, ranked the same way. Pair with openfda_search_adverse_events, openfda_search_drug_approvals, openfda_search_device_clearances, openfda_search_recalls, openfda_get_drug_label, or openfda_lookup_ndc when sample records help interpret the aggregates.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"endpoint",
"count"
],
"properties": {
"count": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "Field to count. openfda_describe_fields gives the verified expression per field as countAs (null = not countable in any form). Otherwise: append .exact for whole-phrase counting of free-text fields (e.g. \"patient.reaction.reactionmeddrapt.exact\"); count identifier fields openFDA already indexes as keywords (product_ndc, application_number, pma_number) bare — .exact on those is rejected as not countable. A date field (receivedate, report_date, decision_date) is counted bare and yields one term per distinct YYYYMMDD date."
},
"limit": {
"type": "integer",
"default": 100,
"minimum": 1,
"description": "Number of top terms to return. truncated reports whether more distinct terms exist beyond it, except at 1000 — openFDA's own count maximum — where openFDA offers no way to tell. A date field is the exception: openFDA sends every date, so the tool ranks them all and truncated is exact at any limit; scope search to at most limit dates to list each one. Default 100; a larger value returns at most 1000 and says so."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "Filter query to scope the count (e.g. patient.drug.medicinalproduct:\"metformin\"). Omit to count across every record in the endpoint. Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"endpoint": {
"enum": [
"drug/event",
"drug/label",
"drug/enforcement",
"drug/ndc",
"drug/drugsfda",
"drug/shortages",
"food/event",
"food/enforcement",
"device/event",
"device/510k",
"device/pma",
"device/recall",
"device/enforcement",
"device/classification",
"device/registrationlisting",
"device/udi",
"device/covid19serology",
"animalandveterinary/event",
"tobacco/problem",
"other/substance"
],
"type": "string",
"description": "Full openFDA endpoint path (e.g. \"drug/event\", \"device/classification\")"
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"termCount"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"cap": {
"type": "number",
"description": "The limit applied to the term list."
},
"meta": {
"type": "object",
"required": [
"lastUpdated"
],
"properties": {
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"not_aggregatable"
],
"description": "Machine-readable failure mode. Declared by this tool: `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search or count query was rejected by openFDA (malformed field name, invalid syntax). `not_aggregatable`: openFDA cannot aggregate the count expression as written — an analyzed text field, .exact on a field already indexed as a keyword, or a field with no countable form. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"shown": {
"type": "number",
"description": "Number of terms returned in this response."
},
"notice": {
"type": "string",
"description": "Why the tally is empty — the search matched no records, or the matched records carry no value for the field — and how to widen it; when truncated, how to reach the omitted terms (on a date field, how many distinct dates were counted); at the 1000-term maximum, that openFDA cannot show whether more distinct values exist; how many count rows openFDA sent without a value or numeric count, which are left out; when limit exceeded the 1000-term cap, the requested value and the cap applied. Absent when a complete list is returned at the requested limit."
},
"results": {
"type": "array",
"items": {
"type": "object",
"required": [
"term",
"count"
],
"properties": {
"term": {
"type": "string",
"description": "Field value; on a date field, the date as YYYYMMDD"
},
"count": {
"type": "number",
"description": "Number of occurrences"
}
},
"description": "A single term-count pair",
"additionalProperties": false
},
"description": "Term-count pairs sorted by count descending"
},
"termCount": {
"type": "number",
"description": "Number of distinct terms returned"
},
"truncated": {
"type": "boolean",
"description": "True when at least one more distinct term exists beyond the limit. Absent when the list is complete, and at the 1000-term maximum, where openFDA cannot show whether more exist (notice says so). Exact at any limit on a date field, where every date arrives."
},
"truncationCeiling": {
"type": "number",
"description": "Count of the lowest-ranked term returned — omitted terms fall at or below it."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Return the searchable field paths for an openFDA endpoint, grouped by category with type and description. Use before constructing a search query to find the correct dotted field path — field names differ per endpoint and are not discoverable from the tool schema alone.
| Parameter | Type | Description |
|---|---|---|
| endpoint * | string | openFDA endpoint to describe (e.g. "drug/event", "drug/shortages", "device/510k"). Must be one of the cataloged endpoints. |
{
"name": "openfda_describe_fields",
"title": "Openfda Describe Fields",
"description": "Return the searchable field paths for an openFDA endpoint, grouped by category with type and description. Use before constructing a search query to find the correct dotted field path — field names differ per endpoint and are not discoverable from the tool schema alone.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"endpoint"
],
"properties": {
"endpoint": {
"enum": [
"drug/event",
"drug/label",
"drug/enforcement",
"drug/ndc",
"drug/drugsfda",
"drug/shortages",
"food/event",
"food/enforcement",
"device/event",
"device/510k",
"device/pma",
"device/recall",
"device/enforcement",
"device/classification",
"device/registrationlisting",
"device/udi",
"device/covid19serology",
"animalandveterinary/event",
"tobacco/problem",
"other/substance"
],
"type": "string",
"description": "openFDA endpoint to describe (e.g. \"drug/event\", \"drug/shortages\", \"device/510k\"). Must be one of the cataloged endpoints."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"endpoint",
"groups",
"queryTips"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure mode."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"groups": {
"type": "array",
"items": {
"type": "object",
"required": [
"label",
"fields"
],
"properties": {
"label": {
"type": "string",
"description": "Field group label"
},
"fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"type",
"countAs",
"note"
],
"properties": {
"note": {
"type": "string",
"description": "What this field contains"
},
"path": {
"type": "string",
"description": "Dotted field path for use in search queries"
},
"type": {
"type": "string",
"description": "Data type (string, date, integer, float, boolean)"
},
"countAs": {
"type": [
"string",
"null"
],
"description": "Verified expression to pass as count in openfda_count_values (the bare path or path.exact); null when openFDA cannot aggregate the field in any form"
}
},
"description": "A single searchable field entry",
"additionalProperties": false
},
"description": "Searchable fields in this group"
}
},
"description": "A named group of related fields",
"additionalProperties": false
},
"description": "Field groups for this endpoint"
},
"endpoint": {
"type": "string",
"description": "The endpoint these fields apply to"
},
"queryTips": {
"type": "string",
"description": "openFDA query syntax reminders relevant to this endpoint"
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Look up FDA drug labeling (package inserts / SPL documents). Check indications, warnings, dosage, contraindications, active ingredients, or any structured label section. A label runs to tens of thousands of tokens, so a page that exceeds the inline budget returns the list of available sections instead; re-call with sections to pull the ones you need.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Example: effective_time:desc. Field paths take only letters, digits, underscores, an… |
| limit | integer | Labels per page. Labels are large, and the cost of a sections selection is the section summed across every record on the page — so it scales with this limit. Lower it before widening a selection. Default 5; a larger value returns at most 1000 and says so. |
| search * | string | Query targeting label fields. Examples: openfda.brand_name:"aspirin", openfda.generic_name:"metformin", openfda.manufacturer_name:"pfizer". To fetch one product's label, pass set_id with the SPL UUID returned in earlier results; it returns the label's current revision only, since openFDA does not se… |
| sections | array | Label sections to return, e.g. ["boxed_warning","indications_and_usage"]. Names come from the outline an oversized page returns, or from openfda_describe_fields. Omit for the whole label — which returns the section outline instead when the page exceeds the inline size budget; an empty list is treate… |
{
"name": "openfda_get_drug_label",
"title": "Openfda Get Drug Label",
"description": "Look up FDA drug labeling (package inserts / SPL documents). Check indications, warnings, dosage, contraindications, active ingredients, or any structured label section. A label runs to tens of thousands of tokens, so a page that exceeds the inline budget returns the list of available sections instead; re-call with sections to pull the ones you need.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"search"
],
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Example: effective_time:desc. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. A well-formed but non-sortable field still causes a query error — use a documented field name."
},
"limit": {
"type": "integer",
"default": 5,
"minimum": 1,
"description": "Labels per page. Labels are large, and the cost of a sections selection is the section summed across every record on the page — so it scales with this limit. Lower it before widening a selection. Default 5; a larger value returns at most 1000 and says so."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "Query targeting label fields. Examples: openfda.brand_name:\"aspirin\", openfda.generic_name:\"metformin\", openfda.manufacturer_name:\"pfizer\". To fetch one product's label, pass set_id with the SPL UUID returned in earlier results; it returns the label's current revision only, since openFDA does not serve earlier ones. Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"sections": {
"type": "array",
"items": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "A top-level label section name."
},
"description": "Label sections to return, e.g. [\"boxed_warning\",\"indications_and_usage\"]. Names come from the outline an oversized page returns, or from openfda_describe_fields. Omit for the whole label — which returns the section outline instead when the page exceeds the inline size budget; an empty list is treated as omitted. A selection is returned whole even when it exceeds that budget, with its serialized size reported on the notice; the outline names a section measured to fit at the requested limit. Sections ending in _table hold SPL table markup: raw in structured results, rendered as Markdown tables in the text output. Metadata (openfda, set_id, id, effective_time, version) is returned either way and counts toward the size."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"kind",
"totalResults",
"effectiveQuery"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"cap": {
"type": "number",
"description": "The limit applied to this page."
},
"kind": {
"enum": [
"full",
"outline"
],
"type": "string",
"description": "Whether this response carries label records (\"full\") or only the section outline of a page too large to inline (\"outline\")."
},
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Number of results skipped."
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching results in the dataset."
},
"lastUpdated": {
"type": "string",
"description": "Date the dataset was last updated."
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Pagination and freshness metadata.",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"shown": {
"type": "number",
"description": "Number of labels returned in this response."
},
"notice": {
"type": "string",
"description": "Guidance for this page: how to broaden filters or correct field names when results are empty or paging overshot, the sized re-call example when a page overflowed to its section outline, section names no record carried, the serialized size when a sections selection exceeds the inline budget, and the requested value, the cap applied, and the next skip when limit exceeded the 1000-record cap. Absent when nothing needs saying."
},
"outline": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"bytes"
],
"properties": {
"name": {
"type": "string",
"description": "Section identifier — pass in `sections` to retrieve it"
},
"bytes": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": 0,
"description": "Serialized byte size of the section"
}
},
"description": "One retrievable label section and its serialized size.",
"additionalProperties": false
},
"description": "Section names available across the matched page and their serialized size, largest first. Present when kind is \"outline\" — pass names back in sections to retrieve them."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "Drug label records, present when kind is \"full\". Each carries an openfda block (brand_name, generic_name, manufacturer_name, route) plus optional SPL sections like indications_and_usage, warnings, dosage_and_administration, contraindications, adverse_reactions; section presence varies per label. Sections ending in _table carry raw SPL table markup (tags and character entities) exactly as openFDA returns it. Narrowed to the requested sections plus metadata when sections was supplied."
},
"truncated": {
"type": "boolean",
"description": "True when more labels matched than this page returned — page with skip for the rest."
},
"totalResults": {
"type": "number",
"description": "Total matching label records in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the drug label query, as submitted to openFDA"
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Search the Drugs@FDA database for drug application approvals (NDAs and ANDAs). Returns application details, sponsor info, and full submission history. Pair with openfda_get_drug_label to read the approved label, or openfda_count_values to aggregate by sponsor_name, product_type, or route. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Omitted with no search, defaults to submissions.submission_status_date:desc: applica… |
| limit | integer | Records per page. A record carries its application's whole submission history, so a long-running application is an order of magnitude larger than a recent one. Default 25; a larger value returns at most 375 and says so. |
| stage | boolean | Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_… |
| fields | array | Dotted record paths to keep on each returned record, e.g. ["sponsor_name", "submissions.submission_status_date"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (application_number), ident… |
| search | string | openFDA search query. Examples: products.brand_name:"eliquis" (any letter case; openfda.* fields are filled only on harmonized applications, so openfda.brand_name misses the rest), sponsor_name:"PFIZER", submissions.submission_type:"ORIG" AND submissions.review_priority:"PRIORITY". Exact quoted valu… |
| canvas_id | string | Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas. |
{
"name": "openfda_search_drug_approvals",
"title": "Openfda Search Drug Approvals",
"description": "Search the Drugs@FDA database for drug application approvals (NDAs and ANDAs). Returns application details, sponsor info, and full submission history. Pair with openfda_get_drug_label to read the approved label, or openfda_count_values to aggregate by sponsor_name, product_type, or route. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Omitted with no search, defaults to submissions.submission_status_date:desc: applications by their latest submission status date, supplements included, newest first — not by approval date. Omitted with a search, results come in openFDA's relevance order. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. A well-formed but non-sortable field still causes a query error — use a documented field name."
},
"limit": {
"type": "integer",
"default": 25,
"minimum": 1,
"description": "Records per page. A record carries its application's whole submission history, so a long-running application is an order of magnitude larger than a recent one. Default 25; a larger value returns at most 375 and says so."
},
"stage": {
"type": "boolean",
"default": false,
"description": "Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_rows reports how many reached it). Staging is for record-level SQL over a bounded slice; for a distribution over everything that matched, openfda_count_values aggregates server-side in one request. Requires CANVAS_PROVIDER_TYPE=duckdb."
},
"fields": {
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9_.]+$"
},
"description": "Dotted record paths to keep on each returned record, e.g. [\"sponsor_name\", \"submissions.submission_status_date\"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (application_number), identically on both response surfaces, and a path through an array applies to every element. Use it when records are large: when a record on the page serializes above 24000 bytes, page_bytes reports the page's size and page_largest_fields names the largest record's biggest fields. A path no returned record carries is named on the notice. Omit for whole records. Paths take only letters, digits, underscores, and dots; anything else is rejected before the request. With stage=true, only the inline page is projected — the staged table keeps its columns."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "openFDA search query. Examples: products.brand_name:\"eliquis\" (any letter case; openfda.* fields are filled only on harmonized applications, so openfda.brand_name misses the rest), sponsor_name:\"PFIZER\", submissions.submission_type:\"ORIG\" AND submissions.review_priority:\"PRIORITY\". Exact quoted values can be case-sensitive on some fields — sponsor_name is stored uppercase, so use sponsor_name:\"PFIZER\" (a lowercase quoted value returns no matches). Omit to browse by latest submission, newest first, sorted by submissions.submission_status_date:desc. Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"totalResults"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Pagination offset"
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching records"
},
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"canvas_disabled",
"canvas_not_found",
"canvas_capacity_exhausted",
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `canvas_disabled`: Staging was requested (stage=true or a canvas_id) but DataCanvas is disabled. `canvas_not_found`: The canvas_id is well-formed but names no active canvas — expired or never minted. `canvas_capacity_exhausted`: canvas_id was omitted and the active canvas cap is already reached. `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"notice": {
"type": "string",
"description": "Canvas staging disclosure when the call staged, the limit clamp when limit exceeded the cap (requested value, cap, next skip), the fields projection and any requested path no record carries, the size and largest fields when a record on the page exceeds 24000 bytes, and guidance when results are empty — how to broaden filters or correct field names."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "Drug application records — application_number, sponsor_name, openfda block on harmonized applications only (brand_name, generic_name, route, product_type, substance_name), products[] (brand_name, active_ingredients, dosage_form, marketing_status), submissions[] (submission_type, submission_status, submission_status_date, review_priority)."
},
"spilled": {
"type": "boolean",
"description": "True when this call staged its matched set on the canvas — use canvas_id with openfda_dataframe_describe for its columns, then openfda_dataframe_query for SQL. Absent when staging was not requested."
},
"canvas_id": {
"type": "string",
"description": "DataCanvas session id for the staged result set. Present when this call staged. Pass to openfda_dataframe_query / openfda_dataframe_describe, or back into this tool to accumulate more tables on the same canvas."
},
"truncated": {
"type": "boolean",
"description": "True when fewer rows reached the canvas than matched upstream — staging stopped at its size budget or openFDA's 25000-row pagination ceiling. Narrow the query (filters, date range) for a complete set."
},
"page_bytes": {
"type": "number",
"description": "Serialized size of results in this response, in UTF-8 bytes. Present only when a record on the page serializes above 24000 bytes on its own — page_largest_fields then names the largest record's biggest fields, and fields projects each record to the paths you need."
},
"staged_rows": {
"type": "number",
"description": "Rows written to the canvas table. Compare with meta.total: a smaller value means staging stopped at its size budget or openFDA's 25000-row pagination ceiling, and the table holds only the first staged_rows records."
},
"canvas_table": {
"type": "string",
"description": "Canvas table holding the staged rows. Present when rows were staged; list its columns with openfda_dataframe_describe, then reference it in openfda_dataframe_query FROM clauses."
},
"totalResults": {
"type": "number",
"description": "Total matching drug approval records in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the Drugs@FDA query, as submitted to openFDA"
},
"projected_fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "The field paths each record in results was projected to, as requested — present only when the call passed fields. Every record also keeps its identity key; any other field is absent because the projection left it out, not because openFDA lacks it. Re-call without fields for whole records."
},
"page_largest_fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"bytes"
],
"properties": {
"path": {
"type": "string",
"description": "Dotted field path on the record. Fields of array elements share their array path, so patient.drug.openfda covers that block in every drug of the report."
},
"bytes": {
"type": "number",
"description": "Serialized UTF-8 bytes the field holds, totalled across array elements."
}
},
"description": "One field of the largest record and its serialized size.",
"additionalProperties": false
},
"description": "Present with page_bytes: the biggest fields of the largest record on the page, largest first — the deepest single field that holds that record's excess over 24000 bytes, or else up to three top-level fields. Leave them out with a fields projection to shrink the records."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Search FDA device premarket notifications — 510(k) clearances and PMA approvals. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Omitted with no search, defaults to decision_date:desc, newest first; omitted with a… |
| limit | integer | Records per page. Default and cap by pathway: 510k 10 (cap 175), pma 25 (cap 575); a larger value returns at most that cap and says so. |
| stage | boolean | Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_… |
| fields | array | Dotted record paths to keep on each returned record, e.g. ["decision_date", "applicant"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (k_number, pma_number, supplement_number), identica… |
| search | string | openFDA search query. Examples: applicant:"medtronic", advisory_committee_description:"cardiovascular", product_code:"DXN", openfda.device_name:"catheter". Omit to browse newest first, sorted by decision_date:desc. Separate clauses with spaces. A "+" written in the URL style of openFDA's examples al… |
| pathway * | string | Premarket pathway. 510(k) is the most common; PMA is for higher-risk devices. |
| canvas_id | string | Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas. |
{
"name": "openfda_search_device_clearances",
"title": "Openfda Search Device Clearances",
"description": "Search FDA device premarket notifications — 510(k) clearances and PMA approvals. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"pathway"
],
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Omitted with no search, defaults to decision_date:desc, newest first; omitted with a search, results come in openFDA's relevance order. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. A well-formed but non-sortable field still causes a query error — use a documented field name."
},
"limit": {
"type": "integer",
"minimum": 1,
"description": "Records per page. Default and cap by pathway: 510k 10 (cap 175), pma 25 (cap 575); a larger value returns at most that cap and says so."
},
"stage": {
"type": "boolean",
"default": false,
"description": "Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_rows reports how many reached it). Staging is for record-level SQL over a bounded slice; for a distribution over everything that matched, openfda_count_values aggregates server-side in one request. Requires CANVAS_PROVIDER_TYPE=duckdb."
},
"fields": {
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9_.]+$"
},
"description": "Dotted record paths to keep on each returned record, e.g. [\"decision_date\", \"applicant\"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (k_number, pma_number, supplement_number), identically on both response surfaces, and a path through an array applies to every element. Use it when records are large: when a record on the page serializes above 24000 bytes, page_bytes reports the page's size and page_largest_fields names the largest record's biggest fields. A path no returned record carries is named on the notice. Omit for whole records. Paths take only letters, digits, underscores, and dots; anything else is rejected before the request. With stage=true, only the inline page is projected — the staged table keeps its columns."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "openFDA search query. Examples: applicant:\"medtronic\", advisory_committee_description:\"cardiovascular\", product_code:\"DXN\", openfda.device_name:\"catheter\". Omit to browse newest first, sorted by decision_date:desc. Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"pathway": {
"enum": [
"510k",
"pma"
],
"type": "string",
"description": "Premarket pathway. 510(k) is the most common; PMA is for higher-risk devices."
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID returned by a prior stage=true call to this tool or another openFDA search tool (openfda_search_* or openfda_lookup_ndc). Passing one stages this search onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"totalResults"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Pagination offset"
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching records"
},
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"limit_above_cap",
"canvas_disabled",
"canvas_not_found",
"canvas_capacity_exhausted",
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `limit_above_cap`: limit exceeds the cap of the endpoint this call selects, on a deployment that rejects rather than clamps it. `canvas_disabled`: Staging was requested (stage=true or a canvas_id) but DataCanvas is disabled. `canvas_not_found`: The canvas_id is well-formed but names no active canvas — expired or never minted. `canvas_capacity_exhausted`: canvas_id was omitted and the active canvas cap is already reached. `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"notice": {
"type": "string",
"description": "Canvas staging disclosure when the call staged, the limit clamp when limit exceeded the pathway's cap (requested value, cap, next skip), the fields projection and any requested path no record carries, the size and largest fields when a record on the page exceeds 24000 bytes, and guidance when results are empty — how to broaden filters or correct field names."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "510(k) or PMA records — 510(k) carries k_number, device_name, applicant, product_code, decision_date, decision_description, advisory_committee_description; PMA carries pma_number, trade_name, generic_name, supplement_number plus shared applicant/product_code/decision_date/decision_description."
},
"spilled": {
"type": "boolean",
"description": "True when this call staged its matched set on the canvas — use canvas_id with openfda_dataframe_describe for its columns, then openfda_dataframe_query for SQL. Absent when staging was not requested."
},
"canvas_id": {
"type": "string",
"description": "DataCanvas session id for the staged result set. Present when this call staged. Pass to openfda_dataframe_query / openfda_dataframe_describe, or back into this tool to accumulate more tables on the same canvas."
},
"truncated": {
"type": "boolean",
"description": "True when fewer rows reached the canvas than matched upstream — staging stopped at its size budget or openFDA's 25000-row pagination ceiling. Narrow the query (filters, date range) for a complete set."
},
"page_bytes": {
"type": "number",
"description": "Serialized size of results in this response, in UTF-8 bytes. Present only when a record on the page serializes above 24000 bytes on its own — page_largest_fields then names the largest record's biggest fields, and fields projects each record to the paths you need."
},
"staged_rows": {
"type": "number",
"description": "Rows written to the canvas table. Compare with meta.total: a smaller value means staging stopped at its size budget or openFDA's 25000-row pagination ceiling, and the table holds only the first staged_rows records."
},
"canvas_table": {
"type": "string",
"description": "Canvas table holding the staged rows. Present when rows were staged; list its columns with openfda_dataframe_describe, then reference it in openfda_dataframe_query FROM clauses."
},
"totalResults": {
"type": "number",
"description": "Total matching device clearance records in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the device clearance query, as submitted to openFDA"
},
"projected_fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "The field paths each record in results was projected to, as requested — present only when the call passed fields. Every record also keeps its identity key; any other field is absent because the projection left it out, not because openFDA lacks it. Re-call without fields for whole records."
},
"page_largest_fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"bytes"
],
"properties": {
"path": {
"type": "string",
"description": "Dotted field path on the record. Fields of array elements share their array path, so patient.drug.openfda covers that block in every drug of the report."
},
"bytes": {
"type": "number",
"description": "Serialized UTF-8 bytes the field holds, totalled across array elements."
}
},
"description": "One field of the largest record and its serialized size.",
"additionalProperties": false
},
"description": "Present with page_bytes: the biggest fields of the largest record on the page, largest first — the deepest single field that holds that record's excess over 24000 bytes, or else up to three top-level fields. Leave them out with a fields projection to shrink the records."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Look up drugs in the NDC (National Drug Code) Directory. Identify drug products by NDC code, find active ingredients, packaging details, or manufacturer info. Pair with openfda_get_drug_label using the returned brand_name or set_id to read the package insert. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.
| Parameter | Type | Description |
|---|---|---|
| skip | number | Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error. |
| sort | string | Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Example: listing_expiration_date:desc. Field paths take only letters, digits, unders… |
| limit | integer | Records per page. A record grows with its packaging list, so a product with many package configurations is several times the size of one with a single package. Default 25; a larger value returns at most 1000 and says so. |
| stage | boolean | Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_… |
| fields | array | Dotted record paths to keep on each returned record, e.g. ["brand_name", "active_ingredients.name"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (product_ndc), identically on both respo… |
| search * | string | openFDA search query. Examples: product_ndc:"0363-0218", brand_name:"aspirin", generic_name:"metformin", labeler_name:"walgreen", active_ingredients.name:"ASPIRIN". Separate clauses with spaces. A "+" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND… |
| canvas_id | string | Canvas ID returned by a prior stage=true call to this tool or an openFDA search tool (openfda_search_*). Passing one stages this lookup onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas. |
{
"name": "openfda_lookup_ndc",
"title": "Openfda Lookup Ndc",
"description": "Look up drugs in the NDC (National Drug Code) Directory. Identify drug products by NDC code, find active ingredients, packaging details, or manufacturer info. Pair with openfda_get_drug_label using the returned brand_name or set_id to read the package insert. With stage=true, call openfda_dataframe_describe for the staged columns, then openfda_dataframe_query for SQL.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"search"
],
"properties": {
"skip": {
"type": "number",
"default": 0,
"minimum": 0,
"description": "Number of records to skip for pagination (default 0). openFDA caps pagination at 25000 records; a higher value returns a pagination_limit_reached error."
},
"sort": {
"type": "string",
"pattern": "^\\s*(?=\\S)(?![,:.])(?!.*,(?: *[,:.]|\\s*$))(?!.*[^\\s,] +[^\\s,])(?!.*\\.(?:[.:,\\s]|$))(?!.*:(?!(?:[Aa][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?|[Dd][Ee][Ss][Cc](?:[Ee][Nn][Dd][Ii][Nn][Gg])?)(?: *,|\\s*$)))[A-Za-z0-9_.:, ]*[A-Za-z0-9_]\\s*$",
"minLength": 1,
"description": "Sort expression — a field path optionally suffixed with :asc or :desc (any letter case; :ascending and :descending are also accepted, and every direction is sent as asc or desc); comma-separate for multi-field sort. Example: listing_expiration_date:desc. Field paths take only letters, digits, underscores, and dots; any other character or direction is rejected before the request. A well-formed but non-sortable field still causes a query error — use a documented field name."
},
"limit": {
"type": "integer",
"default": 25,
"minimum": 1,
"description": "Records per page. A record grows with its packaging list, so a product with many package configurations is several times the size of one with a single package. Default 25; a larger value returns at most 1000 and says so."
},
"stage": {
"type": "boolean",
"default": false,
"description": "Stage the matched set on a DataCanvas for SQL analysis — openfda_dataframe_describe lists the staged columns, openfda_dataframe_query runs the SQL. Default false — the call returns one page for one upstream request. When true, records are also drained onto a canvas table up to a size budget (staged_rows reports how many reached it). Staging is for record-level SQL over a bounded slice; for a distribution over everything that matched, openfda_count_values aggregates server-side in one request. Requires CANVAS_PROVIDER_TYPE=duckdb."
},
"fields": {
"type": "array",
"items": {
"type": "string",
"pattern": "^(?!\\.)(?!.*\\.\\.)(?!.*\\.$)[A-Za-z0-9_.]+$"
},
"description": "Dotted record paths to keep on each returned record, e.g. [\"brand_name\", \"active_ingredients.name\"] — any key path on a returned record works, and openfda_describe_fields lists the searchable ones. Each record is projected to these paths plus its identity key (product_ndc), identically on both response surfaces, and a path through an array applies to every element. Use it when records are large: when a record on the page serializes above 24000 bytes, page_bytes reports the page's size and page_largest_fields names the largest record's biggest fields. A path no returned record carries is named on the notice. Omit for whole records. Paths take only letters, digits, underscores, and dots; anything else is rejected before the request. With stage=true, only the inline page is projected — the staged table keeps its columns."
},
"search": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "openFDA search query. Examples: product_ndc:\"0363-0218\", brand_name:\"aspirin\", generic_name:\"metformin\", labeler_name:\"walgreen\", active_ingredients.name:\"ASPIRIN\". Separate clauses with spaces. A \"+\" written in the URL style of openFDA's examples also reads as a space where it separates: beside AND, OR, NOT, or TO, after a closing quote, paren, or bracket, or between a term and the next \"field:\" prefix (a:\"x\"+AND+b:\"y\", [20200101+TO+20201231], c:x+d:y). In a query that marks a clause required with a leading +field:, only the AND/OR/NOT/TO positions read that way. Any other \"+\" is sent as written, and inside a quoted phrase \"+\" is a literal plus sign. Double quotes, parentheses, and range brackets must balance, and the query must not end on a backslash — each is rejected before the request."
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID returned by a prior stage=true call to this tool or an openFDA search tool (openfda_search_*). Passing one stages this lookup onto that canvas (same effect as stage=true) so result sets accumulate for cross-table joins. Omit to stage onto a fresh canvas."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"results",
"totalResults",
"effectiveQuery"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"total",
"skip",
"limit",
"lastUpdated"
],
"properties": {
"skip": {
"type": "number",
"description": "Pagination offset"
},
"limit": {
"type": "number",
"description": "Page size applied to this request: the requested limit, the endpoint default when limit was omitted, or the endpoint cap when limit exceeded it (the notice then says so). A window running past the end of the matched set returns fewer records than this, so read the length of results for the actual count."
},
"total": {
"type": "number",
"description": "Total matching records"
},
"lastUpdated": {
"type": "string",
"description": "Dataset last updated date"
},
"totalUnverified": {
"type": "boolean",
"description": "Present (true) only on an empty page at skip > 0 whose total could not be confirmed: openFDA answers a page past the end and a search that matched nothing alike, and the follow-up request for the total failed. total then reads 0 without ruling out records at a lower skip — re-call with skip=0 to tell."
}
},
"description": "Response metadata",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"canvas_disabled",
"canvas_not_found",
"canvas_capacity_exhausted",
"rate_limited",
"upstream_error",
"malformed_search",
"query_error",
"pagination_limit_reached"
],
"description": "Machine-readable failure mode. Declared by this tool: `canvas_disabled`: Staging was requested (stage=true or a canvas_id) but DataCanvas is disabled. `canvas_not_found`: The canvas_id is well-formed but names no active canvas — expired or never minted. `canvas_capacity_exhausted`: canvas_id was omitted and the active canvas cap is already reached. `rate_limited`: The openFDA daily or per-minute request limit is exceeded. `upstream_error`: The openFDA API returned a 5xx server error. `malformed_search`: The search query leaves a double quote, parenthesis, or range bracket unclosed, or ends on a backslash. `query_error`: The search query was rejected by openFDA (malformed field name, invalid syntax). `pagination_limit_reached`: skip exceeds the 25000 record pagination ceiling. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"notice": {
"type": "string",
"description": "Canvas staging disclosure when the call staged, the limit clamp when limit exceeded the cap (requested value, cap, next skip), the fields projection and any requested path no record carries, the size and largest fields when a record on the page exceeds 24000 bytes, and guidance when results are empty — how to broaden filters or correct field names."
},
"results": {
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "NDC directory records — product_ndc, brand_name, generic_name, labeler_name, dosage_form, route, marketing_category, active_ingredients[], packaging[], listing_expiration_date."
},
"spilled": {
"type": "boolean",
"description": "True when this call staged its matched set on the canvas — use canvas_id with openfda_dataframe_describe for its columns, then openfda_dataframe_query for SQL. Absent when staging was not requested."
},
"canvas_id": {
"type": "string",
"description": "DataCanvas session id for the staged result set. Present when this call staged. Pass to openfda_dataframe_query / openfda_dataframe_describe, or back into this tool to accumulate more tables on the same canvas."
},
"truncated": {
"type": "boolean",
"description": "True when fewer rows reached the canvas than matched upstream — staging stopped at its size budget or openFDA's 25000-row pagination ceiling. Narrow the query (filters, date range) for a complete set."
},
"page_bytes": {
"type": "number",
"description": "Serialized size of results in this response, in UTF-8 bytes. Present only when a record on the page serializes above 24000 bytes on its own — page_largest_fields then names the largest record's biggest fields, and fields projects each record to the paths you need."
},
"staged_rows": {
"type": "number",
"description": "Rows written to the canvas table. Compare with meta.total: a smaller value means staging stopped at its size budget or openFDA's 25000-row pagination ceiling, and the table holds only the first staged_rows records."
},
"canvas_table": {
"type": "string",
"description": "Canvas table holding the staged rows. Present when rows were staged; list its columns with openfda_dataframe_describe, then reference it in openfda_dataframe_query FROM clauses."
},
"totalResults": {
"type": "number",
"description": "Total matching NDC records in the dataset"
},
"effectiveQuery": {
"type": "string",
"description": "Search filter applied to the NDC lookup, as submitted to openFDA"
},
"projected_fields": {
"type": "array",
"items": {
"type": "string"
},
"description": "The field paths each record in results was projected to, as requested — present only when the call passed fields. Every record also keeps its identity key; any other field is absent because the projection left it out, not because openFDA lacks it. Re-call without fields for whole records."
},
"page_largest_fields": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"bytes"
],
"properties": {
"path": {
"type": "string",
"description": "Dotted field path on the record. Fields of array elements share their array path, so patient.drug.openfda covers that block in every drug of the report."
},
"bytes": {
"type": "number",
"description": "Serialized UTF-8 bytes the field holds, totalled across array elements."
}
},
"description": "One field of the largest record and its serialized size.",
"additionalProperties": false
},
"description": "Present with page_bytes: the biggest fields of the largest record on the page, largest first — the deepest single field that holds that record's excess over 24000 bytes, or else up to three top-level fields. Leave them out with a fields projection to shrink the records."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}Resolve one drug name to its FDA identity, then fan out in parallel across the bounded per-drug openFDA endpoints and merge into one profile: identity, label highlights, adverse-event summary, recall history, Drugs@FDA approval, and shortage status. Identity and label come from an original packager's label when one matches (identity.is_original_packager says when they do not), approval is the drug's own application ranked over its Drugs@FDA matches, and each section names the product it describes. Replaces chaining openfda_get_drug_label, openfda_search_adverse_events, openfda_search_recalls, openfda_search_drug_approvals, and openfda_search_drug_shortages — and reconciles the identifier drift between endpoints that makes that chaining error-prone. Each section is best-effort: a miss returns null rather than failing the call, and a sub-query the 50 s profile deadline cuts is listed in degraded. For deep dives into any one area, use the dedicated tool.
| Parameter | Type | Description |
|---|---|---|
| drug * | string | Drug name to profile — brand or generic (e.g. "metformin", "Humira", "Glucophage"). Resolved once to an FDA identity. The Drugs@FDA approval is ranked over this name's matches; meta.fanOutKey reports the name the recall and shortage sub-queries searched. |
{
"name": "openfda_drug_profile",
"title": "Openfda Drug Profile",
"description": "Resolve one drug name to its FDA identity, then fan out in parallel across the bounded per-drug openFDA endpoints and merge into one profile: identity, label highlights, adverse-event summary, recall history, Drugs@FDA approval, and shortage status. Identity and label come from an original packager's label when one matches (identity.is_original_packager says when they do not), approval is the drug's own application ranked over its Drugs@FDA matches, and each section names the product it describes. Replaces chaining openfda_get_drug_label, openfda_search_adverse_events, openfda_search_recalls, openfda_search_drug_approvals, and openfda_search_drug_shortages — and reconciles the identifier drift between endpoints that makes that chaining error-prone. Each section is best-effort: a miss returns null rather than failing the call, and a sub-query the 50 s profile deadline cuts is listed in degraded. For deep dives into any one area, use the dedicated tool.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"drug"
],
"properties": {
"drug": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "Drug name to profile — brand or generic (e.g. \"metformin\", \"Humira\", \"Glucophage\"). Resolved once to an FDA identity. The Drugs@FDA approval is ranked over this name's matches; meta.fanOutKey reports the name the recall and shortage sub-queries searched."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"meta",
"identity",
"label",
"adverse_events",
"recalls",
"recalls_total",
"approval",
"shortage",
"degraded",
"sectionsFound"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"meta": {
"type": "object",
"required": [
"drug",
"resolvedVia",
"fanOutKey"
],
"properties": {
"drug": {
"type": "string",
"description": "The drug name supplied in the request, echoed back."
},
"fanOutKey": {
"type": "string",
"description": "Name the recall/enforcement and shortage sub-queries ran against, and the Drugs@FDA approval search when the input name matches no application — the input term when it is whole words of the resolved generic name (an ingredient such as \"metformin\" or \"adalimumab\", so one label's product-specific generic does not narrow them), otherwise the resolved generic name, falling back to a brand name, then the input term. Derived from the label the name itself matched, before any swap to the approval's own label. The adverse-event sub-queries instead key off the raw input term to match heterogeneous reporter-entered values."
},
"resolvedVia": {
"enum": [
"label",
"ndc",
"none"
],
"type": "string",
"description": "Which endpoint resolved the canonical identity: drug/label, drug/ndc, or none."
}
},
"description": "Request metadata.",
"additionalProperties": false
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"blank_drug_name"
],
"description": "Machine-readable failure mode. Declared by this tool: `blank_drug_name`: The drug name carries no searchable character — only quotes, backslashes, or whitespace. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"label": {
"anyOf": [
{
"type": "object",
"required": [
"indications",
"warnings",
"dosage"
],
"properties": {
"dosage": {
"type": [
"string",
"null"
],
"description": "Dosage and administration (truncated)."
},
"warnings": {
"type": [
"string",
"null"
],
"description": "Warnings (truncated) — boxed warning or warnings_and_cautions for Rx labels, falling back to the OTC-monograph warnings section."
},
"indications": {
"type": [
"string",
"null"
],
"description": "Indications and usage (truncated)."
}
},
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "Label highlights from the drug/label record identity was resolved from, or null when no label matched."
},
"notice": {
"type": "string",
"description": "Guidance when the drug could not be resolved, upstream errors degraded the profile, a failed label lookup left another label shown, or the approval ranking or shortage counts covered only the first 100 matches. Absent otherwise."
},
"recalls": {
"type": "array",
"items": {
"type": "object",
"required": [
"classification",
"reason",
"recalling_firm",
"date"
],
"properties": {
"date": {
"type": [
"string",
"null"
],
"description": "Recall initiation or report date (YYYYMMDD)."
},
"reason": {
"type": [
"string",
"null"
],
"description": "Reason for recall (truncated)."
},
"classification": {
"type": [
"string",
"null"
],
"description": "Recall hazard class (Class I/II/III)."
},
"recalling_firm": {
"type": [
"string",
"null"
],
"description": "Firm conducting the recall."
}
},
"description": "A single recall or enforcement action.",
"additionalProperties": false
},
"description": "The newest 5 drug/enforcement recall actions whose openfda.generic_name or product_description matches meta.fanOutKey (may be empty); recalls_total counts every match."
},
"approval": {
"anyOf": [
{
"type": "object",
"required": [
"applicationNumber",
"sponsor",
"marketingStatus",
"brandNames",
"candidates"
],
"properties": {
"sponsor": {
"type": [
"string",
"null"
],
"description": "Sponsor/applicant name."
},
"brandNames": {
"type": "array",
"items": {
"type": "string"
},
"description": "Brand names of the application's products (products.brand_name)."
},
"candidates": {
"type": "number",
"description": "Drugs@FDA applications the ranked search matched. Above 100, only the first 100 were ranked, and a notice says so."
},
"marketingStatus": {
"type": [
"string",
"null"
],
"description": "Derived marketing/approval status."
},
"applicationNumber": {
"type": [
"string",
"null"
],
"description": "NDA, ANDA, or BLA application number."
}
},
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "The drug's own Drugs@FDA application, ranked over up to 100 matches of the input name: NDA and BLA applications by openfda.generic_name or products.active_ingredients.name, and any application whose products.brand_name is the name. Ranked on each application's own products: a brand name equal to the input that is not an ingredient name, then one ingredient (several when the name is a combination), then an ingredient without a biologic suffix, then reference_drug Yes, then NDA or BLA, then marketed over discontinued over tentative, then the lowest application number. When the name matches none, the same rank runs over meta.fanOutKey's openfda.generic_name and products.active_ingredients.name matches. Null when nothing matched or the search failed (listed in degraded)."
},
"degraded": {
"type": "array",
"items": {
"type": "object",
"required": [
"section",
"reason",
"message"
],
"properties": {
"reason": {
"type": "string",
"description": "Machine-readable failure reason (e.g. rate_limited, upstream_error, query_error, or timeout when the profile deadline cut the request)."
},
"message": {
"type": "string",
"description": "Upstream failure message for this section, truncated."
},
"section": {
"enum": [
"identity",
"label",
"adverse_events",
"recalls",
"approval",
"shortage"
],
"type": "string",
"description": "Profile section whose sub-query failed."
}
},
"description": "One failed sub-query and why it failed.",
"additionalProperties": false
},
"description": "Sub-queries that failed upstream, empty when every section resolved. A section listed here is unknown, not absent — a null section with no entry here genuinely has no FDA record."
},
"identity": {
"type": "object",
"required": [
"brand_names",
"generic_name",
"product_ndc",
"manufacturer",
"application_number",
"is_original_packager",
"rxcui",
"spl_set_id"
],
"properties": {
"rxcui": {
"type": [
"string",
"null"
],
"description": "RxNorm concept unique identifier, when available."
},
"spl_set_id": {
"type": [
"string",
"null"
],
"description": "SPL set ID for the drug label, when available."
},
"brand_names": {
"type": "array",
"items": {
"type": "string"
},
"description": "Brand names on the resolved record: a label's openfda.brand_name, or the drug/ndc record's brand_name."
},
"product_ndc": {
"type": [
"string",
"null"
],
"description": "Representative product NDC, when available."
},
"generic_name": {
"type": [
"string",
"null"
],
"description": "Generic name (openfda.generic_name) of the resolved label or NDC record — it can name one product (e.g. \"ADALIMUMAB-AACF\" on a biosimilar's label). meta.fanOutKey uses it unless the input term is whole words of it."
},
"manufacturer": {
"type": [
"string",
"null"
],
"description": "Manufacturer on the resolved label (openfda.manufacturer_name), or the drug/ndc record's labeler."
},
"application_number": {
"type": [
"string",
"null"
],
"description": "Application (NDA, ANDA, BLA) the resolved label or NDC record is filed under. When it differs from approval.applicationNumber, identity and label describe another product than approval does."
},
"is_original_packager": {
"type": [
"boolean",
"null"
],
"description": "True when openFDA flags the resolved record as the original packager's (openfda.is_original_packager). False for a harmonized record openFDA leaves unflagged, as a repackager's or relabeler's is. Null when openFDA harmonized nothing for the record."
}
},
"description": "Identity of one product: an original packager's drug/label record matching the name, else any label matching the name, else a drug/ndc record — replaced by the approval application's own original-packager label whenever the record found is not it.",
"additionalProperties": false
},
"shortage": {
"anyOf": [
{
"type": "object",
"required": [
"status",
"availability",
"product",
"company",
"presentation",
"namesInput",
"total",
"statusCounts"
],
"properties": {
"total": {
"type": "number",
"description": "Shortage records whose generic_name matches meta.fanOutKey."
},
"status": {
"type": [
"string",
"null"
],
"description": "Status of the shown record (Current, To Be Discontinued, or Resolved) — one presentation, not the whole drug; statusCounts tallies every record."
},
"company": {
"type": [
"string",
"null"
],
"description": "Company the shown record names (company_name)."
},
"product": {
"type": [
"string",
"null"
],
"description": "Product the shown record covers: its openfda.brand_name, else its presentation's lead."
},
"namesInput": {
"type": "boolean",
"description": "True when the shown record names the input drug, by product or presentation, or the input itself keyed the search. False for brand input no record names: the record shown is the newest for meta.fanOutKey, another product's."
},
"availability": {
"type": [
"string",
"null"
],
"description": "Availability note (truncated)."
},
"presentation": {
"type": [
"string",
"null"
],
"description": "Presentation the shown record covers: product, dosage form, strength, NDC."
},
"statusCounts": {
"type": "array",
"items": {
"type": "object",
"required": [
"status",
"count"
],
"properties": {
"count": {
"type": "number",
"description": "Records with this status."
},
"status": {
"type": [
"string",
"null"
],
"description": "Shortage status."
}
},
"description": "A status paired with its record count.",
"additionalProperties": false
},
"description": "Records per status over the newest 100 matches, most frequent first."
}
},
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "One drug/shortages record for meta.fanOutKey — for brand input, the newest naming the brand, else the newest — with the product, company, and presentation it covers, the match total, and per-status counts. Null when none on record or the search failed (listed in degraded)."
},
"recalls_total": {
"type": [
"number",
"null"
],
"description": "Total drug/enforcement reports the recall search matched — recalls lists the newest 5 of them. Null when the recall sub-query failed (listed in degraded): unknown, not zero."
},
"sectionsFound": {
"type": "number",
"description": "How many profile sections (label, adverse_events, recalls, approval, shortage) returned data."
},
"adverse_events": {
"anyOf": [
{
"type": "object",
"required": [
"total",
"seriousCount",
"topReactions"
],
"properties": {
"total": {
"type": "number",
"description": "Adverse-event reports naming this drug — every matching report, including those with no seriousness recorded; equals openfda_search_adverse_events meta.total for the same medicinalproduct search."
},
"seriousCount": {
"type": "number",
"description": "Reports flagged serious (serious=1). total − seriousCount covers both non-serious reports and those with no seriousness recorded."
},
"topReactions": {
"type": "array",
"items": {
"type": "object",
"required": [
"term",
"count"
],
"properties": {
"term": {
"type": "string",
"description": "MedDRA reaction term."
},
"count": {
"type": "number",
"description": "Reports citing this reaction."
}
},
"description": "A reaction term paired with its report count.",
"additionalProperties": false
},
"description": "Most-frequent reported reactions, descending."
}
},
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "Adverse-event summary aggregated over drug/event, or null when unavailable."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true
}
}List the tables and column schemas on a DataCanvas staged by an openFDA search tool. Call before openfda_dataframe_query to discover the exact table name, column names, and DuckDB types needed for valid SQL. row_count is the full staged result set, not the inline preview count. Columns typed JSON hold nested openFDA objects/arrays — query them with DuckDB json functions.
| Parameter | Type | Description |
|---|---|---|
| canvas_id * | string | Canvas ID from the canvas_id field of an openFDA search tool response (openfda_search_* or openfda_lookup_ndc), present when the search ran with stage=true. |
{
"name": "openfda_dataframe_describe",
"title": "Openfda Dataframe Describe",
"description": "List the tables and column schemas on a DataCanvas staged by an openFDA search tool. Call before openfda_dataframe_query to discover the exact table name, column names, and DuckDB types needed for valid SQL. row_count is the full staged result set, not the inline preview count. Columns typed JSON hold nested openFDA objects/arrays — query them with DuckDB json functions.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"canvas_id"
],
"properties": {
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID from the canvas_id field of an openFDA search tool response (openfda_search_* or openfda_lookup_ndc), present when the search ran with stage=true."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"tables",
"canvas_id"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"canvas_disabled",
"canvas_not_found"
],
"description": "Machine-readable failure mode. Declared by this tool: `canvas_disabled`: DataCanvas is disabled — CANVAS_PROVIDER_TYPE=none. `canvas_not_found`: The canvas_id does not correspond to an active canvas session. Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"tables": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"kind",
"row_count",
"columns"
],
"properties": {
"kind": {
"type": "string",
"description": "Object type: \"table\" for staged data, \"view\" for a derived view."
},
"name": {
"type": "string",
"description": "Table or view name — use verbatim in SQL FROM clauses."
},
"columns": {
"type": "array",
"items": {
"type": "object",
"required": [
"name",
"type"
],
"properties": {
"name": {
"type": "string",
"description": "Column name — use in SELECT, WHERE, GROUP BY, ORDER BY."
},
"type": {
"type": "string",
"description": "DuckDB type (VARCHAR, JSON, BIGINT, DOUBLE, BOOLEAN, ...)."
},
"nullable": {
"type": "boolean",
"description": "True when the column may contain NULL. Absent when unknown."
}
},
"description": "A single column in the table.",
"additionalProperties": false
},
"description": "All columns in this table, in schema order."
},
"row_count": {
"type": "number",
"description": "Total rows in this table — the full staged set, not the inline preview."
}
},
"description": "A registered table or view on the canvas.",
"additionalProperties": false
},
"description": "All tables and views available on this canvas."
},
"canvas_id": {
"type": "string",
"description": "Canvas ID that was described — pass to openfda_dataframe_query."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": false,
"idempotentHint": true
}
}Run a read-only SQL SELECT against a DataCanvas table staged by an openFDA search tool (call one with stage=true; its response carries canvas_id + canvas_table). Enables GROUP BY, COUNT/SUM/AVG, time-series, and joins across the staged result set without re-paging the API. Call openfda_dataframe_describe first to get the exact table and column names. Results are capped at the canvas row limit — when truncated is true, page the rest with ORDER BY plus LIMIT/OFFSET. Scalar fields are stored as text (CAST for numeric math); nested objects/arrays are JSON columns — read them with DuckDB json functions, e.g. json_extract_string(openfda, '$.brand_name[0]'). Only SELECT is allowed — DDL, DML, COPY, and file-reading functions are blocked.
| Parameter | Type | Description |
|---|---|---|
| query * | string | SQL SELECT against the staged table. Use the table name from openfda_dataframe_describe. Example: "SELECT classification, COUNT(*) AS n FROM spilled_ab12cd34 GROUP BY classification ORDER BY n DESC". |
| canvas_id * | string | Canvas ID from the canvas_id field of an openFDA search tool response (openfda_search_* or openfda_lookup_ndc), present when the search ran with stage=true. |
{
"name": "openfda_dataframe_query",
"title": "Openfda Dataframe Query",
"description": "Run a read-only SQL SELECT against a DataCanvas table staged by an openFDA search tool (call one with stage=true; its response carries canvas_id + canvas_table). Enables GROUP BY, COUNT/SUM/AVG, time-series, and joins across the staged result set without re-paging the API. Call openfda_dataframe_describe first to get the exact table and column names. Results are capped at the canvas row limit — when truncated is true, page the rest with ORDER BY plus LIMIT/OFFSET. Scalar fields are stored as text (CAST for numeric math); nested objects/arrays are JSON columns — read them with DuckDB json functions, e.g. json_extract_string(openfda, '$.brand_name[0]'). Only SELECT is allowed — DDL, DML, COPY, and file-reading functions are blocked.",
"inputSchema": {
"type": "object",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"canvas_id",
"query"
],
"properties": {
"query": {
"type": "string",
"pattern": "\\S",
"minLength": 1,
"description": "SQL SELECT against the staged table. Use the table name from openfda_dataframe_describe. Example: \"SELECT classification, COUNT(*) AS n FROM spilled_ab12cd34 GROUP BY classification ORDER BY n DESC\"."
},
"canvas_id": {
"type": "string",
"pattern": "^[A-Za-z0-9_-]{10}$",
"description": "Canvas ID from the canvas_id field of an openFDA search tool response (openfda_search_* or openfda_lookup_ndc), present when the search ran with stage=true."
}
},
"additionalProperties": false
},
"outputSchema": {
"type": "object",
"anyOf": [
{
"not": {
"required": [
"error"
]
},
"required": [
"rows",
"row_count",
"truncated",
"canvas_id"
]
},
{
"required": [
"error"
]
}
],
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"rows": {
"type": "array",
"items": {
"type": "object",
"description": "A result row — keys are the SELECT column names, values the computed data.",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"description": "Rows returned by the query (capped at the canvas row limit)."
},
"error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"maximum": 9007199254740991,
"minimum": -9007199254740991,
"description": "JSON-RPC error code for this failure."
},
"data": {
"type": "object",
"properties": {
"reason": {
"type": "string",
"examples": [
"canvas_disabled",
"canvas_not_found",
"missing_table",
"invalid_query"
],
"description": "Machine-readable failure mode. Declared by this tool: `canvas_disabled`: DataCanvas is disabled — CANVAS_PROVIDER_TYPE=none. `canvas_not_found`: The canvas_id does not correspond to an active canvas session. `missing_table`: The SQL references a table that is not on the canvas — dropped, expired, or mistyped. `invalid_query`: The SQL is not a valid SELECT, references an unknown column, uses a blocked operation, or fails on a staged value (a CAST that does not convert). Other values are possible when a failure originates below the handler."
},
"recovery": {
"type": "object",
"required": [
"hint"
],
"properties": {
"hint": {
"type": "string"
}
},
"description": "Actionable next step for the caller.",
"additionalProperties": {}
},
"retryable": {
"type": "boolean",
"description": "Whether retrying may succeed."
}
},
"additionalProperties": {}
},
"message": {
"type": "string",
"description": "Human-readable description of what went wrong."
}
},
"description": "Present when the call failed. Absent on success.",
"additionalProperties": {}
},
"canvas_id": {
"type": "string",
"description": "Canvas ID that was queried — reuse for follow-up queries."
},
"row_count": {
"type": "number",
"description": "Number of rows in this response. Equals the canvas row limit when truncated is true."
},
"truncated": {
"type": "boolean",
"description": "True when the result hit the canvas row limit and rows beyond it were dropped. Page the rest with ORDER BY plus LIMIT/OFFSET."
}
},
"additionalProperties": false
},
"annotations": {
"readOnlyHint": true,
"openWorldHint": false,
"idempotentHint": true
}
}Use the openfda_* tools to query the openFDA public API for drugs, food, devices, and animal/veterinary products: search adverse events, drug approvals, device clearances, and recalls; look up NDC codes; fetch drug labels; aggregate field counts. Queries use dotted field paths joined by AND/OR with double-quoted phrases (e.g. `patient.drug.medicinalproduct:"aspirin"`). The harmonized `openfda` block sits under `patient.drug` on drug adverse events (`patient.drug.openfda.brand_name`) and under `device` on device adverse events, is absent from food, animal, and tobacco records, and elsewhere exists only where openFDA linked the record to a product, so an `openfda.*` miss does not show the product is absent: also search the endpoint's own product field.
Names, descriptions and schemas were written by the server and are shown as data.
Shared addresses on big platforms (Cloudflare, Vercel and the like) put unrelated servers together; those are marked shared_infrastructure. A match is a pivot, not a link between operators.