Skip to main content
Glama

openfda_device_searcher

Query the FDA's MAUDE database to identify medical device issues, including malfunctions, patient injuries, and genomic/diagnostic device problems. Filter by device type, manufacturer, or problem description to uncover adverse event reports.

Instructions

Search FDA device adverse event reports (MAUDE) for medical device issues.

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

Searches FDA's device adverse event database for:
- Device malfunctions and failures
- Patient injuries related to devices
- Genomic test and diagnostic device issues

By default, filters to genomic/diagnostic devices relevant to precision medicine.
Set genomics_only=False to search all medical devices.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoOptional OpenFDA API key (overrides OPENFDA_API_KEY env var)
deviceNoDevice name to search for
genomics_onlyNoFilter to genomic/diagnostic devices only
limitNoMaximum number of results
manufacturerNoManufacturer name
pageNoPage number (1-based)
problemNoDevice problem description
product_codeNoFDA product code

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler function 'openfda_device_searcher'. Defines the tool schema with Pydantic annotations, registers via @mcp_app.tool(), and delegates execution to the core search_device_events helper.
    @track_performance("biomcp.openfda_device_searcher")
    async def openfda_device_searcher(
        device: Annotated[
            str | None,
            Field(description="Device name to search for"),
        ] = None,
        manufacturer: Annotated[
            str | None,
            Field(description="Manufacturer name"),
        ] = None,
        problem: Annotated[
            str | None,
            Field(description="Device problem description"),
        ] = None,
        product_code: Annotated[
            str | None,
            Field(description="FDA product code"),
        ] = None,
        genomics_only: Annotated[
            bool,
            Field(description="Filter to genomic/diagnostic devices only"),
        ] = True,
        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 device adverse event reports (MAUDE) for medical device issues.
    
        ⚠️ PREREQUISITE: Use the 'think' tool FIRST to plan your research strategy!
    
        Searches FDA's device adverse event database for:
        - Device malfunctions and failures
        - Patient injuries related to devices
        - Genomic test and diagnostic device issues
    
        By default, filters to genomic/diagnostic devices relevant to precision medicine.
        Set genomics_only=False to search all medical devices.
        """
        from biomcp.openfda import search_device_events
    
        skip = (page - 1) * limit
        return await search_device_events(
            device=device,
            manufacturer=manufacturer,
            problem=problem,
            product_code=product_code,
            genomics_only=genomics_only,
            limit=limit,
            skip=skip,
            api_key=api_key,
        )
  • Core helper function implementing the OpenFDA MAUDE device events search. Builds complex search queries, handles API requests, analyzes common problems, formats summaries and sample reports with genomics filtering.
    async def search_device_events(
        device: str | None = None,
        manufacturer: str | None = None,
        problem: str | None = None,
        product_code: str | None = None,
        genomics_only: bool = True,
        limit: int = OPENFDA_DEFAULT_LIMIT,
        skip: int = 0,
        api_key: str | None = None,
    ) -> str:
        """
        Search FDA device adverse event reports (MAUDE).
    
        Args:
            device: Device name to search for
            manufacturer: Manufacturer name
            problem: Device problem description
            product_code: FDA product code
            genomics_only: Filter to genomic/diagnostic devices 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 device event information
        """
        if not device and not manufacturer and not product_code and not problem:
            return (
                "⚠️ Please specify a device name, manufacturer, or problem to search.\n\n"
                "Examples:\n"
                "- Search by device: --device 'FoundationOne'\n"
                "- Search by manufacturer: --manufacturer 'Illumina'\n"
                "- Search by problem: --problem 'false positive'"
            )
    
        # Build and execute search
        search_query = _build_device_search_query(
            device, manufacturer, problem, product_code, genomics_only
        )
        params = {
            "search": search_query,
            "limit": min(limit, OPENFDA_MAX_LIMIT),
            "skip": skip,
        }
    
        response, error = await make_openfda_request(
            OPENFDA_DEVICE_EVENTS_URL, params, "openfda_device_events", api_key
        )
    
        if error:
            return f"⚠️ Error searching device events: {error}"
    
        if not response or not response.get("results"):
            return _format_no_results(device, manufacturer, problem, genomics_only)
    
        results = response["results"]
        total = (
            response.get("meta", {}).get("results", {}).get("total", len(results))
        )
    
        # Build output
        output = ["## FDA Device Adverse Event Reports\n"]
        output.extend(
            _format_search_summary(
                device, manufacturer, problem, genomics_only, total
            )
        )
    
        # Analyze and format problems
        all_problems, all_device_names, _ = analyze_device_problems(results)
        output.extend(format_top_problems(all_problems, results))
    
        # Show device distribution if searching by problem
        if problem:
            output.extend(format_device_distribution(all_device_names, results))
    
        # Display 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_device_report_summary(result, i))
    
        # Add tips
        if genomics_only:
            output.append(
                "\n💡 **Note**: Results filtered to genomic/diagnostic devices. "
                "Use --no-genomics-only to search all medical devices."
            )
    
        output.append(f"\n{OPENFDA_DISCLAIMER}")
        return "\n".join(output)
  • Exposes the search_device_events helper function for import in the MCP tool handler.
    from .device_events import (
        search_device_events,
        get_device_event,
    )
    from .drug_approvals import (
        search_drug_approvals,
        get_drug_approval,
    )
    from .drug_recalls import (
        search_drug_recalls,
        get_drug_recall,
    )
    from .drug_shortages import (
        search_drug_shortages,
        get_drug_shortage,
    )
    
    __all__ = [
        "get_adverse_event",
        "get_device_event",
        "get_drug_approval",
        "get_drug_label",
        "get_drug_recall",
        "get_drug_shortage",
        "search_adverse_events",
        "search_device_events",
        "search_drug_approvals",
        "search_drug_labels",
        "search_drug_recalls",
        "search_drug_shortages",
    ]
  • Helper function that constructs sophisticated OpenFDA search queries with exact matches, wildcards, multi-word handling, and genomic product code filtering.
    def _build_device_search_query(
        device: str | None,
        manufacturer: str | None,
        problem: str | None,
        product_code: str | None,
        genomics_only: bool,
    ) -> str:
        """Build the search query for device events."""
        search_parts = []
    
        if device:
            # Build flexible search queries
            device_queries = []
    
            # First try exact match
            device_queries.extend([
                f'device.brand_name:"{device}"',
                f'device.generic_name:"{device}"',
                f'device.openfda.device_name:"{device}"',
            ])
    
            # For multi-word terms, also search for key words with wildcards
            # This helps match "FoundationOne CDx" to "F1CDX" or similar variations
            words = device.split()
    
            # If it's a multi-word query, add wildcard searches for significant words
            for word in words:
                # Skip common words and very short ones
                if len(word) > 3 and word.lower() not in [
                    "test",
                    "system",
                    "device",
                ]:
                    # Use prefix wildcard for better performance
                    device_queries.append(f"device.brand_name:{word}*")
                    device_queries.append(f"device.generic_name:{word}*")
    
            # Also try searching by removing spaces (e.g., "Foundation One" -> "FoundationOne")
            if len(words) > 1:
                combined = "".join(words)
                device_queries.append(f'device.brand_name:"{combined}"')
                device_queries.append(f'device.generic_name:"{combined}"')
    
            search_parts.append(f"({' OR '.join(device_queries)})")
    
        if manufacturer:
            # Search manufacturer field with both exact and wildcard matching
            mfr_queries = [
                f'device.manufacturer_d_name:"{manufacturer}"',
                f"device.manufacturer_d_name:*{manufacturer}*",
            ]
            search_parts.append(f"({' OR '.join(mfr_queries)})")
    
        if problem:
            search_parts.append(f'device.device_problem_text:"{problem}"')
    
        if product_code:
            search_parts.append(f'device.openfda.product_code:"{product_code}"')
        elif (
            genomics_only and not device
        ):  # Only apply genomics filter if no specific device is named
            # Filter to genomic device product codes
            code_parts = [
                f'device.openfda.product_code:"{code}"'
                for code in GENOMIC_DEVICE_PRODUCT_CODES
            ]
            if code_parts:
                search_parts.append(f"({' OR '.join(code_parts)})")
    
        return " AND ".join(search_parts)
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the tool's default filtering behavior (genomics/diagnostic devices), mentions the database source (FDA's MAUDE), and specifies the types of issues searched (malfunctions, failures, patient injuries). However, it doesn't mention rate limits, authentication requirements beyond the optional API key, 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 with clear sections: purpose statement, prerequisite warning, search scope details, and default behavior explanation. It's appropriately sized for an 8-parameter tool, though the prerequisite warning could be more concise. Every sentence adds value.

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 (8 parameters, no annotations, but with output schema), the description provides good context about the tool's purpose, usage guidelines, and default behavior. The presence of an output schema means the description doesn't need to explain return values. It covers the essential context but could benefit from more behavioral details like rate limits or error conditions.

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 8 parameters thoroughly. The description adds some context about the default genomics_only filter behavior but doesn't provide additional parameter semantics beyond what's in the schema. This meets the baseline expectation when schema coverage is high.

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 searches FDA device adverse event reports (MAUDE) for medical device issues, specifying the resource (FDA database) and verb (search). It distinguishes itself from siblings by focusing specifically on device adverse events rather than other FDA data types like approvals, labels, or recalls.

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 specifies when to use alternatives by explaining the default genomics-only filter and how to disable it for broader searches.

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