Skip to main content
Glama

Compile Documents

compile_documents
Read-onlyIdempotent

Merge project documents into a single manuscript in text, markdown, or HTML format. Standard mode joins in binder order; intelligent mode applies 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; "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.
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.
Behavior5/5

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

Adds important behavioral context beyond annotations: spooling for large results, mode behavior, and prerequisite. No contradiction with readOnlyHint or other annotations.

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?

Three sentences, front-loaded with core functionality and behavioral note. No redundant information.

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 9 parameters and output schema, the description covers the essential context: modes, spooling, alternative, prerequisite. Could briefly mention parameter relationships (e.g., documentIds overrides rootFolderId) but schema covers that.

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% with parameter descriptions. The tool description does not add additional meaning to parameters beyond what the schema provides.

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?

Clearly states the tool compiles documents into a single manuscript, distinguishes two modes (standard and intelligent), and notes that large results are spooled. Differentiates from sibling export_project.

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?

Provides explicit alternative (export_project for writing to disk) and prerequisite (open project). However, does not give guidance on when to choose standard vs intelligent mode beyond the description of their behaviors.

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