Skip to main content
Glama
Kartha-AI

MCP Server for Google Cloud Healthcare API

by Kartha-AI

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
NameRequiredDescriptionDefault
birthDateNoYYYY-MM-DD format
firstNameNo
genderNo
lastNameYes

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);
    }
  • 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"]
      }
    },
  • ToolHandler switch statement registers/dispatches 'find_patient' tool call to FhirClient.findPatient.
    case "find_patient":
      return await this.fhirClient.findPatient(request.params.arguments);
  • handleList method returns TOOL_DEFINITIONS for MCP listTools request, effectively registering available tools including find_patient.
    private handleList = async () => ({
      tools: TOOL_DEFINITIONS
    });
Install Server

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kartha-AI/google-cloud-healthcare-api-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server