# Using with Google
URL: https://metorial.com/docs/build/providers/google

Use Metorial with Google Gemini models

---

The Google provider integration lets you use Metorial's MCP tools with Google's Gemini models. The integration converts Metorial tools into Google's function calling format, allowing Gemini to use tools from your providers.

Gemini models offer competitive performance and pricing, with strong multimodal capabilities. You'll need both a Metorial API key and a Google AI API key to use this integration.

**What this example does:**

1. Initializes both Metorial and Google AI clients
2. Creates a Metorial session that provides tools in Google's format
3. Passes those tools when creating a Gemini model instance
4. The model can then call tools as needed during generation

## Example [#example]

<CodeBlockTabs defaultValue="TypeScript" mode="code">
  <CodeBlockTabsList>
    <CodeBlockTabsTrigger value="TypeScript">
      TypeScript
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="Python">
      Python
    </CodeBlockTabsTrigger>
  </CodeBlockTabsList>

  <CodeBlockTab value="TypeScript">
    ```typescript
    import { Metorial } from 'metorial';
    import { metorialGoogle } from '@metorial/google';
    import { GoogleGenerativeAI } from '@google/generative-ai';

    let metorial = new Metorial({ apiKey: process.env.METORIAL_API_KEY });
    let genAI = new GoogleGenerativeAI(process.env.GOOGLE_API_KEY);

    let session = await metorial.connect({
      adapter: metorialGoogle(),
      providers: [
        { providerDeploymentId: 'your-provider-deployment-id' },
      ],
    });

    let model = genAI.getGenerativeModel({
      model: "gemini-1.5-pro",
      tools: session.tools()
    });
    ```
  </CodeBlockTab>

  <CodeBlockTab value="Python">
    ```python
    from metorial import Metorial, metorial_google
    import google.generativeai as genai
    import asyncio
    import os

    metorial = Metorial(api_key=os.getenv("METORIAL_API_KEY"))
    genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))

    async def main():
        session = await metorial.connect(
            adapter=metorial_google(),
            providers=[{"provider_deployment_id": "your-provider-deployment-id"}],
        )

        model = genai.GenerativeModel("gemini-2.5-pro", tools=session.tools())
        chat = model.start_chat()
        response = chat.send_message("What's trending on Hacker News?")

        for part in response.parts:
            if fn := part.function_call:
                result = await session.call_tool(fn.name, dict(fn.args))
                # Continue conversation with result...

    asyncio.run(main())
    ```
  </CodeBlockTab>
</CodeBlockTabs>