> ## 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.

# Mastra

> Genera Word, PowerPoint, Excel y PDF desde un agente de Mastra.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
npm install @mastra/core @doconda/sdk
```

## Con las herramientas del SDK

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import { Agent } from "@mastra/core/agent"
import { createTool } from "@mastra/core/tools"
import { Doconda } from "@doconda/sdk"

const doconda = new Doconda()
const tools = Object.fromEntries(
  doconda.tools().map((t) => [
    t.name,
    createTool({ id: t.name, description: t.description, inputSchema: t.inputSchema, execute: (input) => t.run(input as Record<string, unknown>) }),
  ]),
)

const agent = new Agent({
  id: "documentos",
  name: "Documentos",
  instructions: "Creas, revisas y editas documentos con Doconda.",
  model: "anthropic/claude-sonnet-5-5", // o cualquier otro proveedor
  tools,
})

const { text } = await agent.generate("Crea una presentación de 5 diapositivas sobre nuestros resultados del trimestre")
```

`createTool` acepta el JSON Schema de cada herramienta tal cual, sin pasarlo a Zod. `model` usa el formato
`proveedor/modelo` de Mastra, que lee la clave del proveedor de tu entorno (`ANTHROPIC_API_KEY`).

## Con el cliente MCP

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
npm install @mastra/mcp
```

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import { MCPClient } from "@mastra/mcp"

const mcp = new MCPClient({
  servers: {
    doconda: {
      url: new URL("https://api.eu.doconda.com/mcp"),
      requestInit: { headers: { Authorization: `Bearer ${process.env.DOCONDA_API_KEY}` } },
    },
    // o en local: { command: "npx", args: ["-y", "@doconda/mcp"], env: { DOCONDA_API_KEY: "…" } }
  },
})

const agent = new Agent({ id: "documentos", name: "Documentos", instructions: "…", model, tools: await mcp.listTools() })
const { text } = await agent.generate("Redacta una carta de bienvenida para Ana en Word")
await mcp.disconnect()
```

Las herramientas llegan con el nombre del servidor delante (`doconda_create_document`, …).


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