> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doconda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini

> Doconda con la llamada a funciones de Gemini (@google/genai).

```bash theme={null}
npm install @google/genai @doconda/sdk
```

`doconda.tools()` es JSON Schema, que Gemini acepta en `parametersJsonSchema`:

```ts theme={null}
import { type Content, GoogleGenAI } from "@google/genai"
import { Doconda } from "@doconda/sdk"

const ai = new GoogleGenAI({})
const tools = new Doconda().tools()
const contents: Content[] = [{ role: "user", parts: [{ text: "Hazme un Excel con el presupuesto del evento" }] }]

while (true) {
  const res = await ai.models.generateContent({
    model: "gemini-3.5-flash",
    contents,
    config: { tools: [{ functionDeclarations: tools.map((t) => ({ name: t.name, description: t.description, parametersJsonSchema: t.inputSchema })) }] },
  })
  if (!res.functionCalls?.length) break
  contents.push(res.candidates![0].content!)
  const parts = await Promise.all(
    res.functionCalls.map(async (call) => ({
      functionResponse: { name: call.name, response: { result: await tools.find((t) => t.name === call.name)!.run(call.args ?? {}) } },
    })),
  )
  contents.push({ role: "user", parts })
}
```

<Accordion title="Con MCP (experimental en @google/genai)">
  ```ts theme={null}
  import { GoogleGenAI, mcpToTool } from "@google/genai"
  import { Client } from "@modelcontextprotocol/sdk/client/index.js"
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"

  const doconda = new Client({ name: "my-app", version: "1.0.0" })
  await doconda.connect(
    new StreamableHTTPClientTransport(new URL("https://api.eu.doconda.com/mcp"), {
      requestInit: { headers: { Authorization: `Bearer ${process.env.DOCONDA_API_KEY}` } },
    }),
  )

  await new GoogleGenAI({}).models.generateContent({
    model: "gemini-3.5-flash",
    contents: "Hazme un Excel con el presupuesto del evento",
    config: { tools: [mcpToTool(doconda)] }, // Gemini llama a las herramientas solo
  })
  ```
</Accordion>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.