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
- Put your Doconda API key (dashboard → API keys) in
DOCONDA_API_KEYand your model provider’s key in its usual variable (here,ANTHROPIC_API_KEY). - Install the dependencies:
npm install @mastra/core @doconda/sdk. - 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,xlsxorartifact. Word, PowerPoint and Excel files come with their PDF.status:readyorfailed. 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
Can I use it in a Mastra workflow step without an agent?
Can I use it in a Mastra workflow step without an agent?
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.Why does the tool call take minutes?
Why does the tool call take minutes?
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.Where should I run it?
Where should I run it?
On your server, never in the browser: the API key gives access to every document in its project.
How much does it cost?
How much does it cost?
Each document the agent makes is billed like an API call in the key’s project. See
pricing.