Skip to main content
Glama

openfda_adverse_searcher

Search FDA Adverse Event Reporting System (FAERS) to identify drug side effects, serious reactions, and safety signals across patient populations. Use to gather insights from voluntary reports on adverse drug events.

Instructions

Search FDA adverse event reports (FAERS) for drug safety information.

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

Searches FDA's Adverse Event Reporting System for:
- Drug side effects and adverse reactions
- Serious event reports (death, hospitalization, disability)
- Safety signal patterns across patient populations

Note: These reports do not establish causation - they are voluntary reports
that may contain incomplete or unverified information.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoOptional OpenFDA API key (overrides OPENFDA_API_KEY env var)
drugNoDrug name to search for adverse events
limitNoMaximum number of results
pageNoPage number (1-based)
reactionNoAdverse reaction term to search for
seriousNoFilter for serious events only

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'openfda_adverse_searcher'. Registers the tool with @mcp_app.tool(), defines input schema via Annotated Fields, and implements logic by calling the OpenFDA search helper.
    @mcp_app.tool()
    @track_performance("biomcp.openfda_adverse_searcher")
    async def openfda_adverse_searcher(
        drug: Annotated[
            str | None,
            Field(description="Drug name to search for adverse events"),
        ] = None,
        reaction: Annotated[
            str | None,
            Field(description="Adverse reaction term to search for"),
        ] = None,
        serious: Annotated[
            bool | None,
            Field(description="Filter for serious events only"),
        ] = 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 adverse event reports (FAERS) for drug safety information.
    
        ⚠️ PREREQUISITE: Use the 'think' tool FIRST to plan your research strategy!
    
        Searches FDA's Adverse Event Reporting System for:
        - Drug side effects and adverse reactions
        - Serious event reports (death, hospitalization, disability)
        - Safety signal patterns across patient populations
    
        Note: These reports do not establish causation - they are voluntary reports
        that may contain incomplete or unverified information.
        """
        from biomcp.openfda import search_adverse_events
    
        skip = (page - 1) * limit
        return await search_adverse_events(
            drug=drug,
            reaction=reaction,
            serious=serious,
            limit=limit,
            skip=skip,
            api_key=api_key,
        )
  • Core helper function implementing the OpenFDA adverse events search logic: query building, API request, error handling, and response formatting.
    async def search_adverse_events(  # noqa: C901
        drug: str | None = None,
        reaction: str | None = None,
        serious: bool | None = None,
        limit: int = OPENFDA_DEFAULT_LIMIT,
        skip: int = 0,
        api_key: str | None = None,
    ) -> str:
        """
        Search FDA adverse event reports (FAERS).
    
        Args:
            drug: Drug name to search for
            reaction: Adverse reaction term to search for
            serious: Filter for serious events only
            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 adverse event information
        """
        if not drug and not reaction:
            return (
                "⚠️ Please specify either a drug name or reaction term to search "
                "adverse events.\n\n"
                "Examples:\n"
                "- Search by drug: --drug 'imatinib'\n"
                "- Search by reaction: --reaction 'nausea'\n"
                "- Both: --drug 'imatinib' --reaction 'nausea'"
            )
    
        # Build and execute search
        search_query = _build_search_query(drug, reaction, serious)
        params = {
            "search": search_query,
            "limit": min(limit, OPENFDA_MAX_LIMIT),
            "skip": skip,
        }
    
        try:
            response, error = await make_openfda_request(
                OPENFDA_DRUG_EVENTS_URL, params, "openfda_adverse_events", api_key
            )
        except OpenFDARateLimitError:
            return (
                "⚠️ **FDA API Rate Limit Exceeded**\n\n"
                "You've exceeded the FDA's rate limit. Options:\n"
                "• Wait a moment and try again\n"
                "• Provide an FDA API key for higher limits (240/min vs 40/min)\n"
                "• Get a free key at: https://open.fda.gov/apis/authentication/"
            )
        except OpenFDATimeoutError:
            return (
                "⏱️ **Request Timeout**\n\n"
                "The FDA API is taking too long to respond. This may be due to:\n"
                "• High server load\n"
                "• Complex query\n"
                "• Network issues\n\n"
                "Please try again in a moment."
            )
        except OpenFDAConnectionError as e:
            return (
                "🔌 **Connection Error**\n\n"
                f"Unable to connect to FDA API: {e}\n\n"
                "Please check your internet connection and try again."
            )
    
        if error:
            return f"⚠️ Error searching adverse events: {error}"
    
        if not response or not response.get("results"):
            search_desc = []
            if drug:
                search_desc.append(f"drug '{drug}'")
            if reaction:
                search_desc.append(f"reaction '{reaction}'")
            return (
                f"No adverse event reports found for {' and '.join(search_desc)}."
            )
    
        results = response["results"]
        total = (
            response.get("meta", {}).get("results", {}).get("total", len(results))
        )
    
        # Build output
        output = ["## FDA Adverse Event Reports\n"]
        output.extend(format_search_summary(drug, reaction, serious, total))
    
        # Add top reactions if searching by drug
        if drug and not reaction:
            output.extend(format_top_reactions(results))
    
        # Add sample reports
        output.append(
            f"### Sample Reports (showing {min(len(results), 3)} of {total}):\n"
        )
        for i, result in enumerate(results[:3], 1):
            output.extend(format_report_summary(result, i))
    
        output.append(f"\n{OPENFDA_DISCLAIMER}")
        return "\n".join(output)
  • Tool registration via MCP app decorator and performance tracking.
    @mcp_app.tool()
    @track_performance("biomcp.openfda_adverse_searcher")
Behavior4/5

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

With no annotations provided, the description carries full burden and does well by disclosing key behavioral traits: it warns about data limitations ('voluntary reports that may contain incomplete or unverified information'), clarifies the nature of results ('do not establish causation'), and describes what types of events are searched. However, it doesn't mention rate limits, authentication requirements, or pagination behavior.

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 well-structured and appropriately sized with clear sections: purpose statement, prerequisite warning, search scope list, and data quality disclaimer. Every sentence earns its place, though the prerequisite warning could be slightly more concise. The information is front-loaded with the core purpose first.

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 (search functionality with 6 parameters), no annotations, but with an output schema present, the description is reasonably complete. It covers purpose, usage guidance, data limitations, and search scope. The output schema will handle return values, so the description appropriately focuses on behavioral context rather than output details.

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 6 parameters thoroughly. The description adds minimal parameter-specific information beyond what's in the schema - it mentions 'drug side effects' and 'serious event reports' which map to the 'drug' and 'serious' parameters, but doesn't provide additional semantic context. Baseline 3 is appropriate when schema does the heavy lifting.

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 specific action ('Search FDA adverse event reports'), resource ('FAERS'), and scope ('for drug safety information'). It distinguishes this tool from its sibling 'openfda_adverse_getter' by emphasizing search functionality rather than retrieval of specific records.

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 guidance with a prerequisite warning ('Use the 'think' tool FIRST to plan your research strategy!') and clarifies when to use this tool by listing specific search purposes (drug side effects, serious events, safety patterns). It also implicitly distinguishes from other FDA tools by focusing on adverse events.

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