bc_get_drug_label_info
Fetch FDA drug label data including indications, warnings, dosage forms, and active ingredients by brand name, generic name, or NDC.
Instructions
Get comprehensive drug labeling information from FDA. Includes active ingredients, dosage forms, administration routes.
Returns: dict: Drug label results with indications, warnings, dosage, active ingredients or error message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| brand_name | No | Brand name of the drug | |
| generic_name | No | Generic name of the drug | |
| ndc | No | National Drug Code (NDC) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The handler function (MCP tool) that executes the get_drug_label_info logic. Accepts brand_name, generic_name, or ndc, queries the FDA drug label API endpoint, and returns results.
@core_mcp.tool() def get_drug_label_info( brand_name: Annotated[Optional[str], Field(description="Brand name of the drug")] = None, generic_name: Annotated[Optional[str], Field(description="Generic name of the drug")] = None, ndc: Annotated[Optional[str], Field(description="National Drug Code (NDC)")] = None, ) -> dict: """Get comprehensive drug labeling information from FDA. Includes active ingredients, dosage forms, administration routes. Returns: dict: Drug label results with indications, warnings, dosage, active ingredients or error message. """ if not any([brand_name, generic_name, ndc]): return {"error": "At least one of brand_name, generic_name, or ndc must be provided"} # Use the Drug Label API endpoint query_parts = [] if brand_name: query_parts.append(f"openfda.brand_name:{brand_name}") if generic_name: query_parts.append(f"openfda.generic_name:{generic_name}") if ndc: query_parts.append(f"openfda.package_ndc:{ndc}") query = " OR ".join(query_parts) if len(query_parts) > 1: query = f"({query})" base_url = "https://api.fda.gov/drug/label.json" params = {"search": query, "limit": 5} try: response = requests.get(base_url, params=params) # type: ignore response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: return {"error": f"Failed to fetch FDA drug label data: {e!s}"} - Input schema/type annotations for the tool: three optional string parameters (brand_name, generic_name, ndc) with Pydantic field descriptions.
def get_drug_label_info( brand_name: Annotated[Optional[str], Field(description="Brand name of the drug")] = None, generic_name: Annotated[Optional[str], Field(description="Generic name of the drug")] = None, ndc: Annotated[Optional[str], Field(description="National Drug Code (NDC)")] = None, ) -> dict: """Get comprehensive drug labeling information from FDA. Includes active ingredients, dosage forms, administration routes. Returns: dict: Drug label results with indications, warnings, dosage, active ingredients or error message. """ - src/biocontext_kb/core/openfda/_get_drug_info.py:6-7 (registration)Tool registration via @core_mcp.tool() decorator on the get_drug_label_info function. core_mcp is a FastMCP instance defined in src/biocontext_kb/core/_server.py.
from biocontext_kb.core._server import core_mcp - src/biocontext_kb/core/openfda/__init__.py:7-8 (registration)Re-export of get_drug_label_info from the openfda package's __init__.py.
from ._get_drug_info import get_drug_by_application_number, get_drug_label_info from ._search_drugs import search_drugs_fda - The FastMCP server instance ('core_mcp') used to register the tool via the @core_mcp.tool() decorator.
from fastmcp import FastMCP core_mcp = FastMCP( # type: ignore "BC", instructions="Provides access to biomedical knowledge bases.", )