Google or Gemini
You can integrate b.well Health SDK for AI with Google or Gemini like this.
Pre-requisite
Install the Google GenAI python library:
pip install google-genai fastmcpIf you have already received a b.well user token from Identity Gateway
import asyncio
from fastmcp import Client
from fastmcp.client.auth import BearerAuth
from google import genai
person_id = "{insert person id here}"
user_token = "{insert user token here}"
mcp_fhir_agent_url = "https://mcpfhiragent.client-sandbox.icanbwell.com"
mcp_client = Client(
mcp_fhir_agent_url,
auth=BearerAuth(user_token),
)
gemini_client = genai.Client(api_key="{insert your Gemini Key here}")
async def main():
async with mcp_client:
response = await gemini_client.aio.models.generate_content(
model="gemini-2.0-flash",
contents=f"Get Active Medications for person_id={person_id}",
config=genai.types.GenerateContentConfig(
temperature=0,
tools=[mcp_client.session]
),
)
print(response.text)
if __name__ == "__main__":
asyncio.run(main())Updated about 1 month ago
