Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_drug_label_info

Retrieve FDA drug labeling information including active ingredients, dosage forms, administration routes, indications, warnings, and dosage details.

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

TableJSON Schema
NameRequiredDescriptionDefault
brand_nameNoBrand name of the drug
generic_nameNoGeneric name of the drug
ndcNoNational Drug Code (NDC)

Implementation Reference

  • Handler function for the 'bc_get_drug_label_info' tool. It queries the FDA OpenFDA drug label API using brand name, generic name, or NDC code to retrieve comprehensive drug labeling information including active ingredients, indications, warnings, and dosage details.
    @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}"}
  • The core_mcp FastMCP server instance named 'BC' where tools like 'bc_get_drug_label_info' are registered via decorators. The 'bc_' prefix comes from the server name.
    core_mcp = FastMCP( # type: ignore "BC", instructions="Provides access to biomedical knowledge bases.", )
  • Imports the core_mcp server (containing the tool) into the main BioContextAI MCP app.
    for mcp in [core_mcp, *(await get_openapi_mcps())]: await mcp_app.import_server( mcp, slugify(mcp.name), )
  • Input schema defined inline with Pydantic Field descriptions for the tool parameters.
    @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}"}
  • Imports the get_drug_label_info function into the openfda module namespace.
    from ._count_drugs import count_drugs_by_field, get_drug_statistics from ._get_drug_info import get_drug_by_application_number, get_drug_label_info

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/biocontext-ai/knowledgebase-mcp'

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