Skip to main content
Glama

openfda_recall_getter

Retrieve comprehensive FDA drug recall details, including product description, reason, distribution pattern, quantity, firm actions, and event timeline, using a specific recall number.

Instructions

Get detailed FDA drug recall information for a specific recall.

Returns complete recall details including:
- Full product description and code information
- Complete reason for recall
- Distribution pattern and locations
- Quantity of product recalled
- Firm information and actions taken
- Timeline of recall events

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoOptional OpenFDA API key (overrides OPENFDA_API_KEY env var)
recall_numberYesFDA recall number

Implementation Reference

  • MCP tool definition including handler function, input schema via Pydantic Annotated Fields, and @mcp_app.tool() registration decorator. Delegates to openfda.get_drug_recall for core logic.
    @mcp_app.tool()
    @track_performance("biomcp.openfda_recall_getter")
    async def openfda_recall_getter(
        recall_number: Annotated[
            str,
            Field(description="FDA recall number"),
        ],
        api_key: Annotated[
            str | None,
            Field(
                description="Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)"
            ),
        ] = None,
    ) -> str:
        """Get detailed FDA drug recall information for a specific recall.
    
        Returns complete recall details including:
        - Full product description and code information
        - Complete reason for recall
        - Distribution pattern and locations
        - Quantity of product recalled
        - Firm information and actions taken
        - Timeline of recall events
        """
        from biomcp.openfda import get_drug_recall
    
        return await get_drug_recall(recall_number, api_key=api_key)
  • Core helper function that performs the OpenFDA API request for a specific drug recall number, processes the response, and formats the detailed output using helper formatting functions.
    async def get_drug_recall(
        recall_number: str,
        api_key: str | None = None,
    ) -> str:
        """
        Get detailed drug recall information for a specific recall.
    
        Args:
            recall_number: FDA recall number
    
            api_key: Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)
    
        Returns:
            Formatted string with detailed recall information
        """
        # Search for the specific recall
        search_params = {"search": f'recall_number:"{recall_number}"', "limit": 1}
    
        response, error = await make_openfda_request(
            OPENFDA_DRUG_ENFORCEMENT_URL, search_params, "openfda_recalls", api_key
        )
    
        if error:
            return f"⚠️ Error retrieving drug recall: {error}"
    
        if not response or not response.get("results"):
            return f"No recall record found for {recall_number}"
    
        recall = response["results"][0]
    
        # Format detailed recall information
        output = [f"## Drug Recall Details: {recall_number}\n"]
    
        # Basic information
        output.extend(_format_recall_header(recall))
    
        # Reason and details
        output.extend(_format_recall_details(recall))
    
        # Distribution information
        output.extend(_format_distribution_info(recall))
    
        # OpenFDA metadata
        if openfda := recall.get("openfda"):
            output.extend(_format_recall_openfda(openfda))
    
        output.append(f"\n{OPENFDA_DISCLAIMER}")
    
        return "\n".join(output)
  • The @mcp_app.tool() decorator registers this function as an MCP tool named 'openfda_recall_getter'.
    @mcp_app.tool()
    @track_performance("biomcp.openfda_recall_getter")
  • Pydantic-based input schema definition using Annotated with Field descriptions for tool parameters.
    recall_number: Annotated[
        str,
        Field(description="FDA recall number"),
    ],
    api_key: Annotated[
        str | None,
        Field(
            description="Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)"
        ),
    ] = None,

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