get_medications_history
Retrieve a patient's detailed medication history, including discontinued medications, to inform clinical workflows and decision-making using Google Cloud Healthcare API.
Instructions
Get patient's medication history including changes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| includeDiscontinued | No | ||
| patientId | Yes |
Implementation Reference
- The main handler function that implements the tool logic by querying the FHIR server for MedicationStatement resources for the given patient, optionally filtered by date range, and formats the response.async getMedicationHistory(args: any) { const params = new URLSearchParams(); params.append('patient', `${args.patientId}`); if (args.dateFrom) params.append('date', `ge${args.dateFrom}`); if (args.dateTo) params.append('date', `le${args.dateTo}`); const response = await this.client.get(`/MedicationStatement?${params}`); return this.formatResponse(`fhir://Patient/${args.patientId}/medication-history`, response.data); }
- Defines the tool's metadata including name, description, and input schema validation.{ name: "get_medications_history", description: "Get patient's medication history including changes", inputSchema: { type: "object", properties: { patientId: { type: "string" }, includeDiscontinued: { type: "boolean" } }, required: ["patientId"] } },
- src/server/handlers/ToolHandler.ts:88-89 (registration)Dispatches calls to the 'get_medications_history' tool to the appropriate FhirClient handler method.case "get_medications_history": return await this.fhirClient.getMedicationHistory(request.params.arguments);