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
| Name | Required | Description | Default |
|---|---|---|---|
| rxstring | No | RxString value of an RxConcept (drug name/description) | |
| rxcui | No | Specific RxCUI identifier to search for | |
| rxtty | No | Term Type of RxConcept | |
| page | No | Page number for pagination (1-based, default: 1) | |
| pageSize | No | Number of results per page (default: 25, max: 100) |
Implementation Reference
- src/clients/rxnorm-client.ts:30-84 (handler)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"}`, ); } } - src/tools.ts:315-347 (schema)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, }, }, }, },