+

Generate Word, Excel, PowerPoint and PDF
with LangChain

Code

Python or TypeScript

Your agent reasons. Doconda delivers the file.

Connect Doconda to your LangChain agent with the MCP adapter and it delivers finished Word, Excel, PowerPoint and PDF files, in Python or TypeScript.

  1. 01Install the SDKpip install doconda or npm install @doconda/sdk, and your API key.
  2. 02Give your agent the toolsDoconda's tools, in LangChain's format.
  3. 03Your agent delivers the fileYour agent gets the link to the reviewed file.
import asyncio
import os
from langchain.agents import create_agent
from langchain_mcp_adapters.client import MultiServerMCPClient

async def main():
    client = MultiServerMCPClient({
        "doconda": {
            "transport": "streamable_http",
            "url": "https://api.eu.doconda.com/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['DOCONDA_API_KEY']}"},
        },
    })
    agent = create_agent("anthropic:claude-sonnet-5-5", await client.get_tools())
    result = await agent.ainvoke({"messages": [{"role": "user", "content": "Write a welcome letter for Ana in Word"}]})
    print(result["messages"][-1].content)

asyncio.run(main())

FAQ

Common questions

01 / 04

How do I generate a Word file from a LangChain agent?

With langchain-mcp-adapters you connect Doconda's MCP server, pass its tools to create_agent and the agent uses them when it needs a document.

The document API for AI agents, ready for production.