Skip to main content
Glama

Compile Documents

compile_documents
Read-onlyIdempotent

Combine documents into a single manuscript using standard ordering, structured hierarchy, or AI optimization for specific targets.

Instructions

Compile the project's documents into a single continuous manuscript in the requested format and return the compiled text (large results are spooled to a file reference). In "standard" mode it joins documents in binder order; in "intelligent" mode it uses AI to optimize the output for a specific target such as an agent query or synopsis. To write a manuscript to disk in a publishing format (EPUB, etc.) use export_project instead. Requires an open project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modeNo"standard" (default) joins documents in order; "structured" compiles the Draft/Manuscript folder (like Scrivener) with the binder hierarchy as headings and a scene separator between documents, honoring each document's "Include in Compile" flag — deterministic, no AI; "intelligent" applies AI optimization toward targetOptimization.
formatNoOutput format of the compiled manuscript. Default "text".
separatorNoText inserted between documents in the standard-mode fallback. Default "\n\n---\n\n".
documentIdsNoOptional explicit list of document ids to compile, in order. Overrides rootFolderId when provided; most useful with mode "intelligent".
hierarchicalNoPreserve the binder folder hierarchy as headings. Default false.
includeNotesNoInclude each document's notes in the output. Default false.
rootFolderIdNoOptional binder folder id to compile only its descendants. Omit to compile all text documents.
includeTitlesNoFor mode "structured": emit each document title as a heading. Default true.
sceneSeparatorNoFor mode "structured": text placed between consecutive sibling documents (e.g. "#" or "* * *"). Default empty (a blank line).
includeExcludedNoFor mode "structured": include documents whose "Include in Compile" flag is off. Default false (excluded documents are omitted, matching Scrivener).
includeSynopsisNoInclude each document's synopsis in the output. Default false.
targetOptimizationNoFor mode "intelligent": what to optimize the compiled output for. Default "general".

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileNoFile reference the compiled text was spooled to. Present only when the result was too large to inline.
textNoThe compiled manuscript text. Present for small results; large results spool to a file instead.
formatYesFormat the manuscript was compiled to (text, markdown, or html).
sectionsYesNumber of documents compiled into the manuscript.
charCountYesCharacter count of the compiled manuscript.
wordCountYesWord count of the compiled manuscript.
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false. The description adds valuable context: large results are spooled to a file reference, and the two modes have different behaviors (deterministic vs AI-driven). This enriched behavioral understanding beyond annotations without contradiction.

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?

The description is exceptionally concise: three sentences covering purpose, modes, large result handling, alternative tool, and prerequisite. Every sentence adds value without redundancy or fluff.

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

Completeness4/5

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

Given the complexity (12 parameters, multiple modes, output schema exists), the description adequately covers key aspects: functionality, mode selection, result handling, and alternatives. It does not need to detail return values since an output schema is present. Minor omission: no mention of structured mode in description, but it's in the schema. Yet, the overall completeness is high.

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?

All 12 parameters have schema descriptions, providing 100% coverage. The tool description adds overall context about modes and fallback behavior but does not significantly augment individual parameter meanings. The baseline is 3, as the schema does the heavy lifting.

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?

The description clearly states the tool compiles documents into a single manuscript, specifies modes ('standard' and 'intelligent'), and distinguishes itself from the sibling 'export_project' by noting that export is for writing to disk in publishing formats. The verb 'compile' and resource 'documents' are specific, and the mention of large result spooling adds clarity.

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

Usage Guidelines4/5

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

The description provides clear guidance on when to use the tool (to compile documents) and when not to (for publishing formats, use export_project). It also notes the prerequisite of an open project. However, it does not explicitly mention exclusions for other siblings like get_compile_settings, but the context is sufficient for an AI agent.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/writerslogic/scrivener-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server