forked from philschmid/gemini-api-docs-mcp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathverify_gemini.py
More file actions
33 lines (26 loc) · 974 Bytes
/
verify_gemini.py
File metadata and controls
33 lines (26 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import asyncio
from google import genai # pip install google-genai
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client
client = genai.Client()
server_params = StdioServerParameters(
command="gemini-docs-mcp",
env=None,
)
async def run():
async with stdio_client(server_params) as (read, write):
async with ClientSession(read, write) as session:
prompt = "Create an example on how to funciton calling with gemini 2.5 flash"
await session.initialize()
response = await client.aio.models.generate_content(
model="gemini-flash-latest",
contents=prompt,
config=genai.types.GenerateContentConfig(
tools=[session],
),
)
print(response.text)
# print(response.automatic_function_calling_history)
if __name__ == "__main__":
asyncio.run(run())