Skip to main content
Glama
RowanErasmus

DailyMed MCP Server

by RowanErasmus

get_all_drug_classes

Retrieve all drug classes from the FDA DailyMed database with pagination support for comprehensive pharmacologic classification access.

Instructions

Get all available drug classes in the DailyMed database with pagination support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageNoPage number for pagination (1-based, default: 1)
pageSizeNoNumber of results per page (default: 100, max: 100)

Implementation Reference

  • The core implementation for searching and retrieving drug classes from the DailyMed API.
    async searchDrugClassesAdvanced(params: DrugClassSearchParams = {}): Promise<PaginatedDrugClassResponse> {
      const { page = 1, pageSize = 100, ...searchParams } = params;
      
      validatePaginationParams(page, pageSize, 100);
    
      try {
        const queryParams: any = {
          page,
          pagesize: Math.min(pageSize, 100), // API max is 100
        };
    
        // Add search filters
        if (searchParams.drug_class_code) queryParams.drug_class_code = searchParams.drug_class_code;
        if (searchParams.drug_class_coding_system) queryParams.drug_class_coding_system = searchParams.drug_class_coding_system;
        if (searchParams.class_code_type) queryParams.class_code_type = searchParams.class_code_type;
        if (searchParams.class_name) queryParams.class_name = searchParams.class_name;
        if (searchParams.unii_code) queryParams.unii_code = searchParams.unii_code;
    
        const response = await this.client.get("/drugclasses.json", {
          params: queryParams,
        });
    
        if (
          response.data &&
          response.data.data &&
          Array.isArray(response.data.data)
        ) {
          const drugClasses = response.data.data.map((item: any) => ({
            drugClassName: item.name,
            drugClassCode: item.code,
            drugClassCodingSystem: item.codingSystem,
            classCodeType: item.type,
            uniiCode: item.unii_code,
          }));
    
          // Extract pagination metadata from API response
          const totalResults = response.data.metadata?.total_elements || drugClasses.length;
          const totalPages = Math.ceil(totalResults / pageSize);
    
          return {
            data: drugClasses,
            pagination: {
              page,
              pageSize,
              totalResults,
              totalPages,
              hasNextPage: page < totalPages,
              hasPreviousPage: page > 1,
            },
          };
        } else {
          throw new Error("Unexpected response structure for drug class search");
        }
      } catch (error) {
        throw new Error(
          `Failed to search drug classes: ${error instanceof Error ? error.message : "Unknown error"}`,
        );
      }
    }
  • The specific handler function for 'get_all_drug_classes' which delegates to the advanced search method.
    async getAllDrugClasses(page: number = 1, pageSize: number = 100): Promise<PaginatedDrugClassResponse> {
      return this.searchDrugClassesAdvanced({ page, pageSize });
    }
  • src/tools.ts:104-122 (registration)
    Definition and registration of the 'get_all_drug_classes' tool in the MCP tool list.
      name: "get_all_drug_classes",
      description: "Get all available drug classes in the DailyMed database with pagination support",
      inputSchema: {
        type: "object",
        properties: {
          page: {
            type: "number",
            description: "Page number for pagination (1-based, default: 1)",
            minimum: 1,
          },
          pageSize: {
            type: "number",
            description: "Number of results per page (default: 100, max: 100)",
            minimum: 1,
            maximum: 100,
          },
        },
      },
    },
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 adds value by specifying 'pagination support', which indicates the tool handles large result sets, but does not cover other aspects like rate limits, authentication needs, error handling, or the format of returned data. This leaves gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get all available drug classes') and includes key behavioral context ('with pagination support'). There is no wasted verbiage, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a read operation with pagination), no annotations, and no output schema, the description is minimally adequate. It covers the basic purpose and pagination behavior but lacks details on output format, error cases, or integration with sibling tools, leaving 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?

The input schema has 100% description coverage, clearly documenting the 'page' and 'pageSize' parameters with defaults and constraints. The description adds no additional parameter semantics beyond what the schema provides, such as explaining how pagination works in practice. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/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 the resource 'all available drug classes in the DailyMed database', making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'search_drug_classes', which might be used for filtered queries instead of retrieving all classes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions 'pagination support', which implies usage for large datasets, but provides no explicit guidance on when to use this tool versus alternatives like 'search_drug_classes' or other 'get_all_' siblings. There is no mention of prerequisites, exclusions, or comparative contexts.

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/RowanErasmus/dailymed-mcp-server'

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