Skip to main content
Glama
RowanErasmus

DailyMed MCP Server

by RowanErasmus

search_rxcuis

Find RxCUI codes for drug concepts using drug names, identifiers, or term types to map medications within the DailyMed FDA database.

Instructions

Search for RxCUI codes using various parameters with pagination support

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rxstringNoRxString value of an RxConcept (drug name/description)
rxcuiNoSpecific RxCUI identifier to search for
rxttyNoTerm Type of RxConcept
pageNoPage number for pagination (1-based, default: 1)
pageSizeNoNumber of results per page (default: 25, max: 100)

Implementation Reference

  • The handler implementation for `searchRxCUIs` in the `RxNormClient` class. It manages API parameters, executes the request, and transforms the response structure.
    async searchRxCUIs(params: RxCUISearchParams = {}): Promise<PaginatedRxCUIResponse> {
      const { page = 1, pageSize = 25, ...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.rxstring) queryParams.rxstring = searchParams.rxstring;
        if (searchParams.rxcui) queryParams.rxcui = searchParams.rxcui;
        if (searchParams.rxtty) queryParams.rxtty = searchParams.rxtty;
    
        const response = await this.client.get("/rxcuis.json", {
          params: queryParams,
        });
    
        if (
          response.data &&
          response.data.data &&
          Array.isArray(response.data.data)
        ) {
          const rxcuis = response.data.data.map((item: any) => ({
            rxcui: item.rxcui,
            drugName: item.rxstring || item.drug_name || item.drugName,
            termType: item.rxtty,
          }));
    
          // Extract pagination metadata from API response
          const totalResults = response.data.metadata?.total_elements || rxcuis.length;
          const totalPages = Math.ceil(totalResults / pageSize);
    
          return {
            data: rxcuis,
            pagination: {
              page,
              pageSize,
              totalResults,
              totalPages,
              hasNextPage: page < totalPages,
              hasPreviousPage: page > 1,
            },
          };
        } else {
          throw new Error("Unexpected response structure for RxCUI search");
        }
      } catch (error) {
        throw new Error(
          `Failed to search RxCUIs: ${error instanceof Error ? error.message : "Unknown error"}`,
        );
      }
    }
  • Tool definition and input schema for `search_rxcuis`.
    {
      name: "search_rxcuis",
      description: "Search for RxCUI codes using various parameters with pagination support",
      inputSchema: {
        type: "object",
        properties: {
          rxstring: {
            type: "string",
            description: "RxString value of an RxConcept (drug name/description)",
          },
          rxcui: {
            type: "string",
            description: "Specific RxCUI identifier to search for",
          },
          rxtty: {
            type: "string",
            description: "Term Type of RxConcept",
            enum: ["PSN", "SBD", "SCD", "BPCK", "GPCK", "SY"],
          },
          page: {
            type: "number",
            description: "Page number for pagination (1-based, default: 1)",
            minimum: 1,
          },
          pageSize: {
            type: "number",
            description: "Number of results per page (default: 25, max: 100)",
            minimum: 1,
            maximum: 100,
          },
        },
      },
    },

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