Skip to main content
Glama

openfda_device_getter

Retrieve comprehensive FDA device event reports, including device details, event narratives, patient outcomes, and manufacturer actions for analysis and decision-making.

Instructions

Get detailed information for a specific FDA device event report.

Retrieves complete device event details including:
- Device identification and specifications
- Complete event narrative
- Patient outcomes and impacts
- Manufacturer analysis and actions
- Remedial actions taken

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoOptional OpenFDA API key (overrides OPENFDA_API_KEY env var)
mdr_report_keyYesMDR report key

Implementation Reference

  • The primary MCP tool handler function 'openfda_device_getter' that defines the tool schema, registers it via @mcp_app.tool(), and delegates to the core get_device_event implementation.
    @track_performance("biomcp.openfda_device_getter")
    async def openfda_device_getter(
        mdr_report_key: Annotated[
            str,
            Field(description="MDR report key"),
        ],
        api_key: Annotated[
            str | None,
            Field(
                description="Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)"
            ),
        ] = None,
    ) -> str:
        """Get detailed information for a specific FDA device event report.
    
        Retrieves complete device event details including:
        - Device identification and specifications
        - Complete event narrative
        - Patient outcomes and impacts
        - Manufacturer analysis and actions
        - Remedial actions taken
        """
        from biomcp.openfda import get_device_event
    
        return await get_device_event(mdr_report_key, api_key=api_key)
  • Core helper function that performs the OpenFDA API request for a specific device event report by MDR report key and formats the detailed response using specialized formatters.
    async def get_device_event(
        mdr_report_key: str, api_key: str | None = None
    ) -> str:
        """
        Get detailed information for a specific device event report.
    
        Args:
            mdr_report_key: MDR report key
            api_key: Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)
    
        Returns:
            Formatted string with detailed report information
        """
        params = {
            "search": f'mdr_report_key:"{mdr_report_key}"',
            "limit": 1,
        }
    
        response, error = await make_openfda_request(
            OPENFDA_DEVICE_EVENTS_URL,
            params,
            "openfda_device_event_detail",
            api_key,
        )
    
        if error:
            return f"⚠️ Error retrieving device event report: {error}"
    
        if not response or not response.get("results"):
            return f"Device event report '{mdr_report_key}' not found."
    
        result = response["results"][0]
    
        # Build detailed output
        output = format_device_detail_header(result, mdr_report_key)
    
        # Device details
        if devices := result.get("device", []):
            output.extend(format_detailed_device_info(devices))
    
        # Event narrative
        if event_desc := result.get("event_description"):
            output.append("### Event Description")
            output.append(clean_text(event_desc))
            output.append("")
    
        # Manufacturer narrative
        if mfr_narrative := result.get("manufacturer_narrative"):
            output.append("### Manufacturer's Analysis")
            output.append(clean_text(mfr_narrative))
            output.append("")
    
        # Patient information
        if patient := result.get("patient", []):
            output.extend(format_patient_details(patient))
    
        # Remedial action
        if remedial := result.get("remedial_action"):
            output.append("### Remedial Action")
            if isinstance(remedial, list):
                output.append(", ".join(remedial))
            else:
                output.append(remedial)
            output.append("")
    
        output.append(f"\n{OPENFDA_DISCLAIMER}")
        return "\n".join(output)

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