find_patient
Search for patients using demographic details like name, birth date, and gender. Part of the MCP Server for Google Cloud Healthcare API, designed for FHIR-based health solutions.
Instructions
Search for a patient by demographics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| birthDate | No | YYYY-MM-DD format | |
| firstName | No | ||
| gender | No | ||
| lastName | Yes |
Implementation Reference
- Core implementation of the find_patient tool: searches FHIR Patient resources using family name, given name, birthdate; extracts and formats patient demographics from the first matching result.async findPatient(args: any) { const params = new URLSearchParams(); if (args.lastName) params.append('family', args.lastName); if (args.firstName) params.append('given', args.firstName); if (args.birthDate) params.append('birthdate', args.birthDate); const response = await this.client.get(`/Patient?${params}`); // Check if we have results if (!response.data?.entry?.[0]?.resource) { return this.formatResponse("fhir://Patient/search", { message: "No patients found" }); } const resource = response.data.entry[0].resource; const name = resource.name?.[0] ?? {}; const address = resource.address?.[0] ?? {}; const patient = { name: name.given?.[0] ?? 'Unknown', familyName: name.family ?? 'Unknown', dob: resource.birthDate ?? 'Unknown', gender: resource.gender ?? 'Unknown', address: address.line?.[0] ?? 'Unknown', city: address.city ?? 'Unknown', state: address.state ?? 'Unknown', zip: address.postalCode ?? 'Unknown', id: resource.id ?? 'Unknown' }; return this.formatResponse("fhir://Patient/search", patient); }
- src/server/constants/tools.ts:2-18 (schema)Tool definition including name, description, and input schema (requires lastName; optional firstName, birthDate, gender). Part of TOOL_DEFINITIONS array used for tool listing.{ name: "find_patient", description: "Search for a patient by demographics", inputSchema: { type: "object", properties: { lastName: { type: "string" }, firstName: { type: "string" }, birthDate: { type: "string", description: "YYYY-MM-DD format" }, gender: { type: "string", enum: ["male", "female", "other", "unknown"] } }, required: ["lastName"] } },
- src/server/handlers/ToolHandler.ts:66-67 (registration)ToolHandler switch statement registers/dispatches 'find_patient' tool call to FhirClient.findPatient.case "find_patient": return await this.fhirClient.findPatient(request.params.arguments);
- src/server/handlers/ToolHandler.ts:37-39 (registration)handleList method returns TOOL_DEFINITIONS for MCP listTools request, effectively registering available tools including find_patient.private handleList = async () => ({ tools: TOOL_DEFINITIONS });