get_patient_observations
Retrieve patient observations such as vitals and lab results using LOINC or SNOMED codes, specified date ranges, and status filters through the MCP Server for Google Cloud Healthcare API.
Instructions
Get observations (vitals, labs) for a patient
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | LOINC or SNOMED code | |
| dateFrom | No | YYYY-MM-DD | |
| dateTo | No | YYYY-MM-DD | |
| patientId | Yes | ||
| status | No |
Implementation Reference
- The handler function that executes the tool logic: constructs FHIR search parameters for Observation resources filtered by patient and optional criteria, fetches from server, and formats response.async getPatientObservations(args: any) { const params = new URLSearchParams(); params.append('patient', `${args.patientId}`); if (args.code) params.append('code', args.code); if (args.status) params.append('status', args.status); if (args.dateFrom) params.append('date', `ge${args.dateFrom}`); if (args.dateTo) params.append('date', `le${args.dateTo}`); const response = await this.client.get(`/Observation?${params}`); return this.formatResponse(`fhir://Patient/${args.patientId}/observations`, response.data); }
- src/server/constants/tools.ts:19-36 (schema)Input schema definition and metadata for the get_patient_observations tool.{ name: "get_patient_observations", description: "Get observations (vitals, labs) for a patient", inputSchema: { type: "object", properties: { patientId: { type: "string" }, code: { type: "string", description: "LOINC or SNOMED code" }, dateFrom: { type: "string", description: "YYYY-MM-DD" }, dateTo: { type: "string", description: "YYYY-MM-DD" }, status: { type: "string", enum: ["registered", "preliminary", "final", "amended", "corrected", "cancelled"] } }, required: ["patientId"] } },
- src/server/handlers/ToolHandler.ts:68-69 (registration)Registration of the tool handler in the MCP callTool request switch statement, dispatching to the FhirClient implementation.case "get_patient_observations": return await this.fhirClient.getPatientObservations(request.params.arguments);
- src/server/handlers/ToolHandler.ts:37-39 (registration)The listTools handler that returns the TOOL_DEFINITIONS array containing this tool's registration.private handleList = async () => ({ tools: TOOL_DEFINITIONS });