Repeat the chain every day: manual → CLI → MCP/API
Goal
Take a chain you have proved by hand in the browser and make it run again with less clicking, step by step, without pretending it is more automatic than it is.
The scenario. Every Monday the front desk scans the week's delivery notes into a folder. For three weeks you have run Merge, Remove first page, OCR, Compress in the browser. It works, takes 15 minutes, and you are tired of it.
Starting state
- A chain that already works by hand (see design your own), with a two or three page test file you know the right answer for.
- A decision about where the files may go (see Which channel when).
The ladder
Web app (manual) → CLI plugins (local script) → MCP (an AI assistant runs it) → REST API (your program runs it)
prove the chain repeat on your machine conversational, cloud embed, cloud
Do not skip rungs. Each one reuses what the one below taught you: the order of steps and the option values.
Rung 1: manual, written down
- Write the chain with option values (one line per step). The recipes in this chapter are written this way.
- Count the time and note which steps need your eyes (for example, checking a scan's language). Those steps are the hardest to automate.
Rung 2: CLI plugins (local, scriptable)
Read the CLI chapter first. Facts it verifies:
- Each plugin does one operation, needs the .NET 10 runtime, a licence file
documentize.licnext to the dll (without it, evaluation mode), and on Linux extra packages (libgdiplus, fontconfig, fonts). - Plugins do not take file paths as flags. They read an input folder and write an output folder:
$PLUGIN_INPUT_DIR/<task-id>/and$PLUGIN_OUTPUT_DIR/<task-id>/. Always pass your own--task-id. - The commands the chapter documents, with their flags:
dotnet Documentize.Merge.dll --task-id j1(files are merged in filename order)dotnet Documentize.RemovePages.dll --task-id j4 --remove-range 1,3dotnet Documentize.OcrSearchable.dll --task-id j5 --language eng(needs Tesseract locally)dotnet Documentize.Compress.dll --task-id j2 --compress-type 1dotnet Documentize.Rotate.dll --task-id j3 --angle 90
- Chaining has no pipe: one step's output folder is copied into the next step's input folder. The chapter's
step()function does this.
Your Monday chain, built from those pieces (my assembly of the chapter's example; check the output file names on your machine):
set -e
export PLUGIN_INPUT_DIR=$HOME/dmz/in PLUGIN_OUTPUT_DIR=$HOME/dmz/out
step() { prev=$1; next=$2; plugin=$3; shift 3
mkdir -p "$PLUGIN_INPUT_DIR/$next"
cp "$PLUGIN_OUTPUT_DIR/$prev"/*.pdf "$PLUGIN_INPUT_DIR/$next/"
dotnet "Documentize.$plugin.dll" --task-id "$next" "$@"; }
dotnet Documentize.Merge.dll --task-id w1 # scans already in $PLUGIN_INPUT_DIR/w1
step w1 w2 RemovePages --remove-range 1
step w2 w3 OcrSearchable --language eng
step w3 w4 Compress --compress-type 1
Order follows the recipes: pages first, text next, compress last. To run it on a schedule, call the script from your system scheduler. Tools for that are your operating system's, not Documentize's; the book has not verified any built-in scheduler.
Honest caveats: plugins run on your machine, so files do not leave it; but there is a licence file and, per the chapter, first-run checks and an internet connection for activation (verify per plugin). Catalogue pages may show a different command style than the readmes; the zip's readme wins. Plugins that call AI need a connection to the AI service (the Resume plugin says so).
Rung 3: MCP (an assistant runs the chain)
Read MCP. Endpoint https://api.documentize.app/mcp, optional dmk_ key as a Bearer header. The tools named there include MergeDocuments, RemovePages, MakeSearchable, CompressDocument, ExtractFormData, AddToc, GenerateAbstract and more, plus ProcessBatch, WaitForTasks and GetTaskStatus.
- You say it in words: "Merge these three file URLs, remove page 1, make it searchable, compress it." The assistant calls the tools, waits for each task, and passes each result link to the next.
- For 20 or more files the chapter says to use ProcessBatch (one operation, up to 200 files per call) then WaitForTasks.
- Do not guess tool parameters; ask the assistant to list them. The server is the source of truth.
- Not every app has a tool: for example Collage and Ask PDF are noted as having no MCP tool.
- Caveats: files go to the cloud; anonymous runs have a tiny daily allowance (documented as 2 operations; verify), free accounts 5 (verify). One chain of four steps is four operations.
Rung 4: REST API (your program runs it)
Read REST API. The pattern is submit (POST multipart), poll process_status/{id} (203 still working, 200 done with links, 204 waiting, 500 failed), download, optionally delete.
- Use it to embed the chain in an application.
- Big caveat from the chapter: there is no separate public reference; endpoint details are "what the service does today", the JSON field names are not fixed, and whether
dmk_keys work on every route is not documented. Verify against a live response, and consider self-hosting if you build a product. - Long free-plan jobs may stop with a continuation; handle it (the chapter lists the routes).
Which rung?
- One person, same chain weekly, files may stay local: CLI.
- You want to say it in words, small batches: MCP.
- Another system triggers it: API or self-host.
- Confidential data: CLI or self-host, not MCP or the cloud API.
- Anything involving judgement (checking a scan language, AI summaries): keep a human step.
Check it worked
Run the automated chain on your test file and compare it with the manual result: page count, selectable text, size. Do this again after any update to a plugin.
What can go wrong
- The plugin cannot find my file. It reads the task's input folder, not a path flag.
- "Usage error" (exit code 2). A flag is wrong; exit 1 means the task ran and failed (stderr has details).
- A later step runs on the wrong file. Your copy command grabbed an old output; use a fresh task-id per run.
- Quota refusals over MCP (
quota_exceeded): you are out for today. - The chain differs from the browser. Check the how-to guide for that app (library); if guide and book differ, trust the guide.
Why this order
Manual first proves the chain and its option values. CLI repeats it locally with the same values. MCP and API add reach but move your files to the cloud and bring quotas, so they are chosen deliberately, not by default.