openfda_label_getter
Retrieve complete FDA drug label information by set ID, including indications, dosing, warnings, pharmacology, and manufacturing details. Specify sections for targeted data or use default key sections.
Instructions
Get complete FDA drug label information by set ID.
Retrieves the full prescribing information including:
- Complete indications and usage text
- Detailed dosing instructions
- All warnings and precautions
- Clinical pharmacology and studies
- Manufacturing and storage information
Specify sections to retrieve specific parts, or leave empty for default key sections.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | Optional OpenFDA API key (overrides OPENFDA_API_KEY env var) | |
| sections | No | Specific sections to retrieve (default: key sections) | |
| set_id | Yes | Label set ID |
Implementation Reference
- src/biomcp/individual_tools.py:1420-1454 (handler)MCP tool handler function for openfda_label_getter, including schema definition via Annotated Fields and registration via @mcp_app.tool() decorator. Delegates to get_drug_label implementation.@mcp_app.tool() @track_performance("biomcp.openfda_label_getter") async def openfda_label_getter( set_id: Annotated[ str, Field(description="Label set ID"), ], sections: Annotated[ list[str] | None, Field( description="Specific sections to retrieve (default: key sections)" ), ] = None, api_key: Annotated[ str | None, Field( description="Optional OpenFDA API key (overrides OPENFDA_API_KEY env var)" ), ] = None, ) -> str: """Get complete FDA drug label information by set ID. Retrieves the full prescribing information including: - Complete indications and usage text - Detailed dosing instructions - All warnings and precautions - Clinical pharmacology and studies - Manufacturing and storage information Specify sections to retrieve specific parts, or leave empty for default key sections. """ from biomcp.openfda import get_drug_label return await get_drug_label(set_id, sections, api_key=api_key)
- Core implementation of the drug label retrieval logic, querying OpenFDA API by set_id, formatting specific sections of the label, handling boxed warnings, and returning formatted output.async def get_drug_label( set_id: str, sections: list[str] | None = None, api_key: str | None = None, ) -> str: """ Get detailed drug label information by set ID. Args: set_id: Label set ID sections: Specific sections to retrieve (default: key sections) api_key: Optional OpenFDA API key (overrides OPENFDA_API_KEY env var) Returns: Formatted string with detailed label information """ params = { "search": f'set_id:"{set_id}"', "limit": 1, } response, error = await make_openfda_request( OPENFDA_DRUG_LABELS_URL, params, "openfda_drug_label_detail", api_key ) if error: return f"⚠️ Error retrieving drug label: {error}" if not response or not response.get("results"): return f"Drug label with ID '{set_id}' not found." result = response["results"][0] # Use default sections if not specified if not sections: sections = get_default_sections() # Build output output = format_label_header(result, set_id) # Boxed warning (if exists) if "boxed_warning" in result: output.extend(_format_boxed_warning(result["boxed_warning"])) # Display requested sections section_titles = get_section_titles() for section in sections: output.extend(format_label_section(result, section, section_titles)) output.append(f"\n{OPENFDA_DISCLAIMER}") return "\n".join(output)