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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

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:
Behavior3/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 mentions the return format (dict with specific fields) which is helpful, but doesn't address important behavioral aspects like rate limits, authentication requirements, error handling beyond 'error message', or whether this is a read-only operation. The description adds some value but leaves significant gaps.

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 appropriately sized with two sentences that each serve a distinct purpose: the first states what the tool does, the second describes the return format. It's front-loaded with the core functionality. While efficient, the second sentence could be slightly more structured for readability.

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 has an output schema (implied by the Returns section), the description doesn't need to fully explain return values. It provides adequate context for a lookup tool with good parameter documentation in the schema. However, with no annotations and the description lacking behavioral details like rate limits or authentication, there's room for improvement in completeness.

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 fully documents both parameters (class_type with its enum values and limit with its constraints). The description doesn't add any parameter-specific information beyond what's in the schema, making the baseline score of 3 appropriate when the schema does the heavy lifting.

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 verb 'Get' and resource 'available pharmacologic classes from FDA database', making the purpose specific and unambiguous. It distinguishes itself from siblings by focusing on pharmacologic classes rather than drugs, proteins, or other biomedical entities, with no tautology present.

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 explicitly provides usage guidance with 'Call this first to see available options', indicating this tool should be used as an initial step to discover available classes before other operations. This is a clear when-to-use directive that helps differentiate it from alternatives.

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

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