Skip to main content
Glama
biocontext-ai

BioContextAI Knowledgebase MCP

Official

bc_get_available_pharmacologic_classes

Retrieve available pharmacologic classes from FDA database to identify medication classification options for research or analysis purposes.

Instructions

Get available pharmacologic classes from FDA database. Call this first to see available options.

Returns: dict: Class type, field, available_classes array with term/count, total_found or error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
class_typeNoClass type: 'epc' (Established Pharmacologic Class), 'moa' (Mechanism of Action), 'pe' (Physiologic Effect), or 'cs' (Chemical Structure)epc
limitNoNumber of unique classes to return

Implementation Reference

  • The core handler function for the 'get_available_pharmacologic_classes' tool. It is decorated with @core_mcp.tool() for MCP registration and implements the logic to query the OpenFDA API for unique pharmacologic classes based on class_type (epc, moa, pe, cs), returning available classes with counts.
    @core_mcp.tool() def get_available_pharmacologic_classes( class_type: Annotated[ str, Field( description="Class type: 'epc' (Established Pharmacologic Class), 'moa' (Mechanism of Action), 'pe' (Physiologic Effect), or 'cs' (Chemical Structure)" ), ] = "epc", limit: Annotated[int, Field(description="Number of unique classes to return", ge=1, le=1000)] = 100, ) -> dict: """Get available pharmacologic classes from FDA database. Call this first to see available options. Returns: dict: Class type, field, available_classes array with term/count, total_found or error message. """ # Map class type to the appropriate OpenFDA field class_field_mapping = { "epc": "openfda.pharm_class_epc", # Established Pharmacologic Class "moa": "openfda.pharm_class_moa", # Mechanism of Action "pe": "openfda.pharm_class_pe", # Physiologic Effect "cs": "openfda.pharm_class_cs", # Chemical Structure } if class_type.lower() not in class_field_mapping: return {"error": "class_type must be one of: epc, moa, pe, cs"} field = class_field_mapping[class_type.lower()] # Use the count endpoint to get unique values base_url = "https://api.fda.gov/drug/drugsfda.json" params: Any = {"count": field, "limit": limit} try: response = requests.get(base_url, params=params) response.raise_for_status() data = response.json() return { "class_type": class_type, "field": field, "available_classes": data.get("results", []), "total_found": len(data.get("results", [])), } except requests.exceptions.RequestException as e: return {"error": f"Failed to fetch available pharmacologic classes: {e!s}"}
  • The openfda module __init__.py exports the get_available_pharmacologic_classes function, making it available for import and use in tool registration contexts.
    from ._advanced_search import ( get_available_pharmacologic_classes, get_generic_equivalents, search_drugs_by_therapeutic_class, ) from ._count_drugs import count_drugs_by_field, get_drug_statistics from ._get_drug_info import get_drug_by_application_number, get_drug_label_info from ._search_drugs import search_drugs_fda __all__ = [ "count_drugs_by_field", "get_available_pharmacologic_classes", "get_drug_by_application_number", "get_drug_label_info", "get_drug_statistics", "get_generic_equivalents", "search_drugs_by_therapeutic_class", "search_drugs_fda", ]
  • Pydantic schema definitions for input parameters: class_type (str, default 'epc') and limit (int, 1-1000, default 100), with detailed descriptions and constraints.
    def get_available_pharmacologic_classes( class_type: Annotated[ str, Field( description="Class type: 'epc' (Established Pharmacologic Class), 'moa' (Mechanism of Action), 'pe' (Physiologic Effect), or 'cs' (Chemical Structure)" ), ] = "epc", limit: Annotated[int, Field(description="Number of unique classes to return", ge=1, le=1000)] = 100, ) -> dict:

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/biocontext-ai/knowledgebase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server