Skip to main content
Glama

Lilia Editor

Rewrite the whole document

rewrite_document
DestructiveIdempotent

Replace the WHOLE document body in one step, from LaTeX (a fragment or a whole paper, \documentclass to \end{document}); Lilia reads it with its LaTeX import, and a whole paper's page setup comes with it. For rewrites only: for a small change use edit_block, to add a section use paste_content. Get the current LaTeX with get_latex. To put the old text back, give the reply's undo.versionId to restore_version.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "documentId": "<documentId>",
      "content": "<content>"
    },
    "name": "rewrite_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
titleNoOptional title, used only when the document has no title yet; to rename a document, use set_title.
formatNolatex (default). Advanced: lml, Lilia's internal block markup.
contentYesThe new body, in LaTeX.
documentIdYesThe document id.

Schema Changelog

Changes observed during successful MCP inspections.

No schema history has been recorded yet.

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=true and idempotentHint=true, and the description reinforces exactly what is destroyed (the whole body) and that page setup is carried over by the LaTeX import — context not present in the annotations. It also reveals that the reply carries an undo.versionId, giving the agent a recovery path. It stops short of stating any permission or size constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the mutation and its scope, then spends the remaining clauses on alternatives, prerequisite, and rollback. Every sentence carries actionable information and nothing is repeated from the name or title.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive whole-body replacement with no output schema, the definition covers scope, input format, siblings, prerequisite read, and undo. An agent has everything needed to invoke it safely and to recover from a bad rewrite.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so all four parameters are already documented, including the title caveat and the lml advanced format. The description adds some meaning for content by saying a fragment or a full \documentclass-to-\end{document} paper is accepted and that page setup is imported. That is useful but incremental over the schema's 'The new body, in LaTeX', so baseline-plus is the right level.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource with explicit scope: 'Replace the WHOLE document body in one step, from LaTeX'. It immediately distinguishes itself from edit_block (small change) and paste_content (add a section), so an agent can route correctly without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit when-to-use rule ('For rewrites only'), names the two alternatives for narrower cases, tells the agent to call get_latex first, and points to restore_version for rollback. Both the selection condition and the recovery condition are stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources