get-drug-info
Retrieve detailed drug information using its generic name with a tool designed for FHIR-based digital health solutions, enabling efficient clinical workflows and pre-authorization processes.
Instructions
Get Drug details by a generic name
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| genericName | Yes |
Implementation Reference
- The primary handler for the 'get-drug-info' tool. It extracts the genericName from arguments, caches the result using CacheManager, fetches drug information by calling searchGenericName, and returns the JSON-formatted drug data.async getDrug(args: any, cache: CacheManager) { const { genericName} = args const cacheKey = cache.createKey('interactions', { genericName: genericName}); const drug = await cache.getOrFetch( cacheKey, () => this.searchGenericName(genericName) ); return { content: [{ type: 'text', text: JSON.stringify(drug, null, 2) }] }; }
- The input schema and metadata definition for the 'get-drug-info' tool, specifying genericName as required string input.{ name: 'get-drug-info', description: 'Get Drug details by a generic name', inputSchema: { type: 'object', properties: { genericName: { type: 'string' }, }, required: ['genericName'] } },
- src/server/handlers/ToolHandler.ts:96-97 (registration)Registration and dispatch for 'get-drug-info' tool in the handleCall switch statement, delegating to FDA.getDrug method.case "get-drug-info": return await this.fdaApi.getDrug(request.params.arguments,this.cache);
- Supporting helper function that performs the actual FDA API query for drugs matching the generic name and returns the results.async searchGenericName(genericName: string): Promise<Generics[]> { const url = new URL(this.baseUrl); url.searchParams.append('search', `generic_name:"${genericName}"`) const response = await fetch(url); const data = await response.json() as FDAResponse; return data.results; }