Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_search_drugs_fda

Search FDA-approved drug products using brand names, generic names, active ingredients, or other criteria to retrieve application details, sponsors, and product information.

Instructions

Search FDA Drugs@FDA database for approved drug products. Supports multiple search criteria.

Returns: dict: Results array with drug products including application numbers, sponsors, products array or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
brand_nameNoBrand or trade name (e.g., 'Tylenol')
generic_nameNoGeneric name (e.g., 'acetaminophen')
active_ingredientNoActive ingredient name
sponsor_nameNoCompany/sponsor name
application_numberNoFDA application number (NDA, ANDA, or BLA)
marketing_statusNoMarketing status: 'Prescription', 'Over-the-counter', 'Discontinued', or 'None (Tentative Approval)'
dosage_formNoDosage form (e.g., 'TABLET', 'INJECTION', 'CAPSULE')
routeNoRoute of administration (e.g., 'ORAL', 'INJECTION', 'TOPICAL')
search_typeNo'and' for all terms must match, 'or' for any term matchesor
sort_byNoField to sort by (e.g., 'sponsor_name', 'application_number')
limitNoNumber of results to return
skipNoNumber of results to skip for pagination

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'search_drugs_fda' tool (prefixed to 'bc_search_drugs_fda' upon server import), decorated with @core_mcp.tool(). Includes input schema via Annotated Fields and full execution logic querying the FDA Drugs@FDA API.
    @core_mcp.tool()
    def search_drugs_fda(
        brand_name: Annotated[Optional[str], Field(description="Brand or trade name (e.g., 'Tylenol')")] = None,
        generic_name: Annotated[Optional[str], Field(description="Generic name (e.g., 'acetaminophen')")] = None,
        active_ingredient: Annotated[Optional[str], Field(description="Active ingredient name")] = None,
        sponsor_name: Annotated[Optional[str], Field(description="Company/sponsor name")] = None,
        application_number: Annotated[
            Optional[str], Field(description="FDA application number (NDA, ANDA, or BLA)")
        ] = None,
        marketing_status: Annotated[
            Optional[str],
            Field(
                description="Marketing status: 'Prescription', 'Over-the-counter', 'Discontinued', or 'None (Tentative Approval)'"
            ),
        ] = None,
        dosage_form: Annotated[
            Optional[str], Field(description="Dosage form (e.g., 'TABLET', 'INJECTION', 'CAPSULE')")
        ] = None,
        route: Annotated[
            Optional[str], Field(description="Route of administration (e.g., 'ORAL', 'INJECTION', 'TOPICAL')")
        ] = None,
        search_type: Annotated[str, Field(description="'and' for all terms must match, 'or' for any term matches")] = "or",
        sort_by: Annotated[
            Optional[str], Field(description="Field to sort by (e.g., 'sponsor_name', 'application_number')")
        ] = None,
        limit: Annotated[int, Field(description="Number of results to return", ge=1, le=1000)] = 25,
        skip: Annotated[int, Field(description="Number of results to skip for pagination", ge=0, le=25000)] = 0,
    ) -> dict:
        """Search FDA Drugs@FDA database for approved drug products. Supports multiple search criteria.
    
        Returns:
            dict: Results array with drug products including application numbers, sponsors, products array or error message.
        """
        # Ensure at least one search parameter is provided
        search_params = [
            brand_name,
            generic_name,
            active_ingredient,
            sponsor_name,
            application_number,
            marketing_status,
            dosage_form,
            route,
        ]
        if not any(search_params):
            return {"error": "At least one search parameter must be provided"}
    
        # Build query components - using correct schema field paths
        query_parts = []
    
        if brand_name:
            # Search in both openfda.brand_name and products.brand_name arrays
            query_parts.append(f"(openfda.brand_name:{brand_name} OR products.brand_name:{brand_name})")
    
        if generic_name:
            # openfda.generic_name is an array
            query_parts.append(f"openfda.generic_name:{generic_name}")
    
        if active_ingredient:
            # products.active_ingredients.name
            query_parts.append(f"products.active_ingredients.name:{active_ingredient}")
    
        if sponsor_name:
            query_parts.append(f"sponsor_name:{sponsor_name}")
    
        if application_number:
            query_parts.append(f"application_number.exact:{application_number}")
    
        if marketing_status:
            # Map user-friendly terms to API values - products.marketing_status
            status_mapping = {
                "prescription": "1",
                "discontinued": "2",
                "none (tentative approval)": "3",
                "over-the-counter": "4",
            }
            status_value = status_mapping.get(marketing_status.lower(), marketing_status)
            query_parts.append(f"products.marketing_status:{status_value}")
    
        if dosage_form:
            query_parts.append(f"products.dosage_form:{dosage_form}")
    
        if route:
            query_parts.append(f"products.route:{route}")
    
        # Join query parts based on search type
        query = " AND ".join(query_parts) if search_type.lower() == "and" else " OR ".join(query_parts)
    
        # Build URL parameters for proper encoding
        params = {"search": query, "limit": limit, "skip": skip}
    
        # Add sorting if specified
        if sort_by:
            params["sort"] = f"{sort_by}:desc"
    
        # Build the complete URL
        base_url = "https://api.fda.gov/drug/drugsfda.json"
    
        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 data: {e!s}"}
  • Registers the core_mcp server (containing the search_drugs_fda tool) into the main MCP app with prefix 'bc' via slugify('BC'), resulting in tool name 'bc_search_drugs_fda'.
    for mcp in [core_mcp, *(await get_openapi_mcps())]:
        await mcp_app.import_server(
            mcp,
            slugify(mcp.name),
        )
    logger.info("MCP server setup complete.")
  • Defines the core_mcp FastMCP server instance named 'BC' where tools like search_drugs_fda are registered via decorators.
    core_mcp = FastMCP(  # type: ignore
        "BC",
        instructions="Provides access to biomedical knowledge bases.",
    )
  • Imports all tools from openfda module into core namespace, ensuring search_drugs_fda is available for registration in core_mcp.
    from .openfda import *
    from .opentargets import *
  • Exports the search_drugs_fda tool function (with its inline schema) for import into core module.
    from ._search_drugs import search_drugs_fda
    
    __all__ = [
        "count_drugs_by_field",
        "get_available_pharmacologic_classes",
        "get_drug_by_application_number",
        "get_drug_label_info",
        "get_drug_statistics",
        "get_generic_equivalents",
        "search_drugs_by_therapeutic_class",
        "search_drugs_fda",
    ]
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the return type ('dict: Results array with drug products including application numbers, sponsors, products array or error message'), which adds some context. However, it lacks details on error handling, rate limits, authentication needs, or whether it's a read-only operation (implied by 'Search' but not explicit). This is inadequate for a tool with 12 parameters and no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, with two sentences that directly state the purpose and return value. There is no wasted text, and it efficiently communicates key information. However, it could be slightly improved by integrating usage hints more seamlessly.

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

Completeness3/5

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

Given the complexity (12 parameters, no annotations, but with output schema), the description is minimally adequate. It covers the purpose and return format, but lacks behavioral context, usage guidelines, and error handling details. The output schema likely documents return values, reducing the burden, but the description should still address when and how to use the tool effectively.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents all 12 parameters with descriptions. The description adds minimal value beyond the schema, only implying support for 'multiple search criteria' without detailing parameter interactions or semantics. Baseline 3 is appropriate when the schema handles parameter documentation effectively.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Search FDA Drugs@FDA database for approved drug products.' It specifies the verb ('Search'), resource ('FDA Drugs@FDA database'), and scope ('approved drug products'). However, it does not explicitly differentiate from sibling tools like 'bc_search_drugs_by_therapeutic_class' or 'bc_get_drug_by_application_number', which are related but not directly compared.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions 'Supports multiple search criteria' but does not specify scenarios, prerequisites, or exclusions. For example, it does not clarify if this is for broad searches versus more targeted tools like 'bc_get_drug_by_application_number' for specific lookups.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

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

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

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