Skip to main content
To generate a DOCX (Word) file with the Gemini API, declare doconda.tools() as Gemini functions. When you ask for a document, Gemini calls create_document with format: "docx" and you get an editable Word file and its PDF, with their download links. The same works for a PowerPoint (pptx) or an Excel file (xlsx).

Steps

  1. Have your Gemini API key in the environment (GEMINI_API_KEY), or use Vertex AI (below).
  2. Put your Doconda API key (dashboard → API keys) in DOCONDA_API_KEY.
  3. Declare the tools and run the loop: while Gemini asks for functions, run them and hand back the result.
parametersJsonSchema (parameters_json_schema in Python) takes each tool’s JSON Schema as is. On Vertex AI it’s the same code: new GoogleGenAI({ vertexai: true, project: "my-project", location: "europe-west1" }) in TypeScript or genai.Client(vertexai=True, project="my-project", location="europe-west1") in Python, with the credentials from your Google Cloud environment.

What you get back

  • A truly editable Word file: the look lives in the document’s styles (Normal, Heading 1…), plus its PDF.
  • status: ready, ready_with_warnings, needs_review or failed (not charged).
  • Links expire after 5 minutes; the agent gets fresh ones with get_document.

FAQ

The same way: ask for a presentation (“Create a 5-slide presentation on our quarterly results”) and Gemini calls create_document with format: "pptx". You get a 16:9 .pptx with native charts and its PDF.
Yes, with mcpToTool from @google/genai (experimental) and the remote server https://api.eu.doconda.com/mcp. See Gemini.
Yes: the agent uploads the file with upload_file and calls edit_document, which changes only what you ask.
You pay per delivered document; failed ones are not charged. See pricing.

Keep reading