bc_get_drug_label_info
Retrieve detailed drug label information from the FDA database, including active ingredients, dosage forms, and usage instructions, by specifying brand name, generic name, or NDC code.
Instructions
Get drug labeling information including active ingredients, dosage, and usage instructions.
This function retrieves comprehensive drug label information from the FDA's drug labeling database, which includes detailed product information, active ingredients, dosage forms, and administration routes.
Args: brand_name (str, optional): Brand name of the drug. generic_name (str, optional): Generic name of the drug. ndc (str, optional): National Drug Code number.
Returns: dict: Drug labeling information from the FDA API.
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) number |
Implementation Reference
- The core handler function for the 'get_drug_label_info' tool (prefixed to 'bc_get_drug_label_info' in the main server). It queries the FDA Drug Label API using brand_name, generic_name, or NDC code, constructs OpenFDA search query, fetches data, and returns JSON or error.@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}"}
- src/biocontext_kb/app.py:35-39 (registration)Registers the core_mcp server (containing the tool) into the main 'BioContextAI' MCP server with prefix 'bc' (slugify('BC')), making the tool accessible as 'bc_get_drug_label_info'.for mcp in [core_mcp, *(await get_openapi_mcps())]: await mcp_app.import_server( mcp, slugify(mcp.name), )
- src/biocontext_kb/core/_server.py:3-7 (registration)Defines the 'core_mcp' FastMCP server instance named 'BC', onto which tools like 'get_drug_label_info' are registered via @core_mcp.tool() decorators.core_mcp = FastMCP( # type: ignore "BC", instructions="Provides access to biomedical knowledge bases.", )
- src/biocontext_kb/core/__init__.py:13-13 (registration)Imports the openfda module into core namespace, executing the module-level code and @tool() decorators that register 'get_drug_label_info' on core_mcp.from .openfda import *
- Pydantic schema for tool inputs defined via Annotated types: optional brand_name, generic_name, ndc strings with 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: