# docs_ai_rewrite

> Rewrite part of a Doc with AppliFlo's AI and replace it in the Doc, as selecting text and choosing Rewrite in the editor does. text is the exact words to rewrite, copied from the Doc as get_doc shows it (may span paragraphs); mode plainer, firmer, shorter, longer or grammar, or custom with an instruction.

Tool of the AppliFlo MCP server at `https://appliflo.com/api/mcp`. Kind: destructive: it emails people or cancels a send, so clients ask you first.

Rewrite part of a Doc with AppliFlo's AI and replace it in the Doc, as selecting text and choosing Rewrite in the editor does. text is the exact words to rewrite, copied from the Doc as get_doc shows it (may span paragraphs); mode plainer, firmer, shorter, longer or grammar, or custom with an instruction. Variables, fill-in boxes and signatures in it keep their settings. Saves the Doc and returns its new revision, the new text and checks. Spends the workspace's AI writing allowance (Starter and Business plans); refused like the app (ai_disabled, ai_plan, ai_rate_limited, ai_budget_reached). To only explain text use docs_ai_explain; to find what needs fixing use docs_ai_review.

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `doc_id` | string | yes | The Doc's id (from list_docs or get_doc). Up to 80 characters |
| `text` | string | yes | The exact text to rewrite, copied from the Doc (a review finding's text works). Up to 12000 characters |
| `mode` | string | yes | How to rewrite it; custom needs an instruction. One of: plainer, firmer, shorter, longer, grammar, custom |
| `instruction` | string | no | For custom: how to rewrite it, in the person's words (or a review finding's fix). Up to 1000 characters |
| `revision` | integer | no | The Doc's revision as you last read it (get_doc). Checked before any AI is spent: if the Doc has changed since, you get 409 revision_conflict with the current revision and nothing is spent or written. The tool holds the Doc's edit lock from that check until it has saved, so nobody can change it in between. Leave out to work on the Doc as it is now. At least 0 |
