Skip to main content
Wrap each tool from doconda.tools() with Mastra’s createTool and pass them to your Agent. When the user asks for a document, the agent calls create_document and replies with links to the Word, PowerPoint, Excel or PDF file.

Give a Mastra agent document tools

  1. Put your Doconda API key (dashboard → API keys) in DOCONDA_API_KEY and your model provider’s key in its usual variable (here, ANTHROPIC_API_KEY).
  2. Install the dependencies: npm install @mastra/core @doconda/sdk.
  3. Create the agent with the tools:
createTool takes each tool’s JSON Schema as is, with no Zod conversion. model uses Mastra’s provider/model format, so any provider works. To use MCP instead of the SDK, connect MCPClient from @mastra/mcp to https://api.eu.doconda.com/mcp and pass await mcp.listTools() as tools. Those tools arrive prefixed with the server name (doconda_create_document, …).

What you get back

doconda.tools() gives the agent 8 tools: create_document, upload_file, convert_file, edit_document, list_documents, get_document, get_report and read_artifact_data. Each create_document call returns this summary to the model:
  • format: docx, pdf, pptx, xlsx or artifact. Word, PowerPoint and Excel files come with their PDF.
  • status: ready or failed. A failed document isn’t charged.
  • Links expire after 5 minutes; the agent gets fresh ones with get_document.
  • Errors come back as a result ({ "error": "insufficient_balance", "message": "…" }), so the agent can tell the user.

FAQ

Yes. Call doconda.documents.create({ format: "docx", content: { markdown } }) with the previous step’s text. From your own Markdown it costs €0.20 at the default level instead of €0.50 from a prompt.
create_document waits until the file is ready: about a minute at fast, a few minutes at standard. With quality: "auto" Doconda picks the level the request needs. See quality levels.
On your server, never in the browser: the API key gives access to every document in its project.
Each document the agent makes is billed like an API call in the key’s project. See pricing.
For the full setup, including the MCP client, see Mastra.