Skip to main content
Glama

openfda_label_searcher

Search FDA drug product labels (SPL) for prescribing information. Find approved indications, dosage guidelines, contraindications, warnings, drug interactions, adverse reactions, and special population considerations. Plan research strategy using the 'think' tool first.

Instructions

Search FDA drug product labels (SPL) for prescribing information.

⚠️ PREREQUISITE: Use the 'think' tool FIRST to plan your research strategy!

Searches official FDA drug labels for:
- Approved indications and usage
- Dosage and administration guidelines
- Contraindications and warnings
- Drug interactions and adverse reactions
- Special population considerations

Label sections include: indications, dosage, contraindications, warnings,
adverse, interactions, pregnancy, pediatric, geriatric, overdose

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoOptional OpenFDA API key (overrides OPENFDA_API_KEY env var)
boxed_warningNoFilter for drugs with boxed warnings
indicationNoSearch for drugs indicated for this condition
limitNoMaximum number of results
nameNoDrug name to search for
pageNoPage number (1-based)
sectionNoSpecific label section (e.g., 'contraindications', 'warnings')

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'openfda_label_searcher'. Registers the tool with @mcp_app.tool(), defines input schema with Pydantic Annotated Fields, and delegates to the core search_drug_labels helper function.
    @track_performance("biomcp.openfda_label_searcher")
    async def openfda_label_searcher(
        name: Annotated[
            str | None,
            Field(description="Drug name to search for"),
        ] = None,
        indication: Annotated[
            str | None,
            Field(description="Search for drugs indicated for this condition"),
        ] = None,
        boxed_warning: Annotated[
            bool,
            Field(description="Filter for drugs with boxed warnings"),
        ] = False,
        section: Annotated[
            str | None,
            Field(
                description="Specific label section (e.g., 'contraindications', 'warnings')"
            ),
        ] = None,
        limit: Annotated[
            int,
            Field(description="Maximum number of results", ge=1, le=100),
        ] = 25,
        page: Annotated[
            int,
            Field(description="Page number (1-based)", ge=1),
        ] = 1,
        api_key: Annotated[
            str | None,
            Field(
                description="Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)"
            ),
        ] = None,
    ) -> str:
        """Search FDA drug product labels (SPL) for prescribing information.
    
        ⚠️ PREREQUISITE: Use the 'think' tool FIRST to plan your research strategy!
    
        Searches official FDA drug labels for:
        - Approved indications and usage
        - Dosage and administration guidelines
        - Contraindications and warnings
        - Drug interactions and adverse reactions
        - Special population considerations
    
        Label sections include: indications, dosage, contraindications, warnings,
        adverse, interactions, pregnancy, pediatric, geriatric, overdose
        """
        from biomcp.openfda import search_drug_labels
    
        skip = (page - 1) * limit
        return await search_drug_labels(
            name=name,
            indication=indication,
            boxed_warning=boxed_warning,
            section=section,
            limit=limit,
            skip=skip,
            api_key=api_key,
        )
  • Core helper function search_drug_labels that constructs OpenFDA API query parameters, makes HTTP request to drug labels endpoint, processes response, and formats results for display.
    async def search_drug_labels(
        name: str | None = None,
        indication: str | None = None,
        boxed_warning: bool = False,
        section: str | None = None,
        limit: int = OPENFDA_DEFAULT_LIMIT,
        skip: int = 0,
        api_key: str | None = None,
    ) -> str:
        """
        Search FDA drug product labels (SPL).
    
        Args:
            name: Drug name to search for
            indication: Search for drugs indicated for this condition
            boxed_warning: Filter for drugs with boxed warnings
            section: Specific label section to search
            limit: Maximum number of results
            skip: Number of results to skip
    
            api_key: Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)
    
        Returns:
            Formatted string with drug label information
        """
        if not name and not indication and not section and not boxed_warning:
            return (
                "⚠️ Please specify a drug name, indication, or label section to search.\n\n"
                "Examples:\n"
                "- Search by name: --name 'pembrolizumab'\n"
                "- Search by indication: --indication 'melanoma'\n"
                "- Search by section: --section 'contraindications'"
            )
    
        # Build and execute search
        search_query = build_label_search_query(
            name, indication, boxed_warning, section
        )
        params = {
            "search": search_query,
            "limit": min(limit, OPENFDA_MAX_LIMIT),
            "skip": skip,
        }
    
        response, error = await make_openfda_request(
            OPENFDA_DRUG_LABELS_URL, params, "openfda_drug_labels", api_key
        )
    
        if error:
            return f"⚠️ Error searching drug labels: {error}"
    
        if not response or not response.get("results"):
            return _format_no_results(name, indication, section)
    
        results = response["results"]
        total = (
            response.get("meta", {}).get("results", {}).get("total", len(results))
        )
    
        # Build output
        output = ["## FDA Drug Labels\n"]
        output.extend(_format_search_summary(name, indication, section, total))
    
        # Display results
        output.append(
            f"### Results (showing {min(len(results), 5)} of {total}):\n"
        )
        for i, result in enumerate(results[:5], 1):
            output.extend(format_label_summary(result, i))
    
        # Add tip for getting full labels
        if total > 0 and results and "set_id" in results[0]:
            output.append(
                "\n💡 **Tip**: Use `biomcp openfda label-get <label_id>` to retrieve "
                "the complete label for any drug."
            )
    
        output.append(f"\n{OPENFDA_DISCLAIMER}")
        return "\n".join(output)
  • Tool registration via @mcp_app.tool() decorator in individual_tools.py, which registers openfda_label_searcher with the MCP server.
    @track_performance("biomcp.openfda_label_searcher")
    async def openfda_label_searcher(
        name: Annotated[
            str | None,
            Field(description="Drug name to search for"),
        ] = None,
        indication: Annotated[
            str | None,
            Field(description="Search for drugs indicated for this condition"),
        ] = None,
        boxed_warning: Annotated[
            bool,
            Field(description="Filter for drugs with boxed warnings"),
        ] = False,
        section: Annotated[
            str | None,
            Field(
                description="Specific label section (e.g., 'contraindications', 'warnings')"
            ),
        ] = None,
        limit: Annotated[
            int,
            Field(description="Maximum number of results", ge=1, le=100),
        ] = 25,
        page: Annotated[
            int,
            Field(description="Page number (1-based)", ge=1),
        ] = 1,
        api_key: Annotated[
            str | None,
            Field(
                description="Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)"
            ),
        ] = None,
    ) -> str:
        """Search FDA drug product labels (SPL) for prescribing information.
    
        ⚠️ PREREQUISITE: Use the 'think' tool FIRST to plan your research strategy!
    
        Searches official FDA drug labels for:
        - Approved indications and usage
        - Dosage and administration guidelines
        - Contraindications and warnings
        - Drug interactions and adverse reactions
        - Special population considerations
    
        Label sections include: indications, dosage, contraindications, warnings,
        adverse, interactions, pregnancy, pediatric, geriatric, overdose
        """
        from biomcp.openfda import search_drug_labels
    
        skip = (page - 1) * limit
        return await search_drug_labels(
            name=name,
            indication=indication,
            boxed_warning=boxed_warning,
            section=section,
            limit=limit,
            skip=skip,
            api_key=api_key,
        )
  • Input schema defined via Pydantic Annotated and Field descriptions in the handler function parameters.
        name: Annotated[
            str | None,
            Field(description="Drug name to search for"),
        ] = None,
        indication: Annotated[
            str | None,
            Field(description="Search for drugs indicated for this condition"),
        ] = None,
        boxed_warning: Annotated[
            bool,
            Field(description="Filter for drugs with boxed warnings"),
        ] = False,
        section: Annotated[
            str | None,
            Field(
                description="Specific label section (e.g., 'contraindications', 'warnings')"
            ),
        ] = None,
        limit: Annotated[
            int,
            Field(description="Maximum number of results", ge=1, le=100),
        ] = 25,
        page: Annotated[
            int,
            Field(description="Page number (1-based)", ge=1),
        ] = 1,
        api_key: Annotated[
            str | None,
            Field(
                description="Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)"
            ),
        ] = None,
    ) -> str:
Behavior4/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It effectively describes the tool's function and content scope, including specific label sections searched. However, it lacks details on rate limits, authentication requirements (beyond the api_key parameter), error handling, or response format. The prerequisite warning adds useful context but doesn't fully cover behavioral traits.

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

Conciseness5/5

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

The description is well-structured and front-loaded with the core purpose and critical prerequisite. Each sentence adds value: the first states the purpose, the second gives essential usage guidance, and the subsequent bullets and list clarify searchable content without redundancy. No wasted words.

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

Completeness4/5

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

Given the tool's complexity (7 parameters, search functionality) and the presence of an output schema (which handles return values), the description is largely complete. It covers purpose, usage guidance, and content scope effectively. However, with no annotations, it could better address behavioral aspects like rate limits or authentication nuances, leaving minor gaps.

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 already documents all 7 parameters thoroughly. The description adds no specific parameter information beyond implying searchable content areas (e.g., 'indications', 'dosage') that align with some parameters. It provides marginal value over the schema, meeting the baseline for high coverage.

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

Purpose5/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 as searching FDA drug product labels for prescribing information, specifying the resource (FDA drug labels) and verb (search). It distinguishes itself from siblings like 'openfda_label_getter' by focusing on search functionality rather than retrieval, and lists specific content areas (e.g., indications, dosage) to clarify scope.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance with a prerequisite warning to use the 'think' tool first for research strategy planning. It also implicitly distinguishes from siblings by focusing on label search (vs. adverse events, approvals, etc.), though it doesn't name specific alternatives. The guidance is clear and actionable.

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

Related 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/genomoncology/biomcp'

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