Skip to main content
Glama

run_document_step

Destructive

Run ONE analysis step on one or more documents — the point being that a document that failed at one stage does not have to be put through all of them again. Required: step ('extract_text' | 'vision_ocr' | 'analyze' | 'split_rag' | 'vectorize' | 'graph_ingest'), and document_ids OR entity + entity_id. 'vision_ocr' sends the file itself to a vision model and is the expensive one — it is only offered for files WITHOUT a usable text layer (a scan, a photo PDF); on a text PDF use 'extract_text', which is free, exact, and better. Text from OCR is marked as such on the document, because a number read off an image can be misread and one read from a text layer cannot. Optional: force (default false; re-running a finished step is allowed but has to be asked for). Returns per document what happened, or why it was skipped. Nothing is written for a document the step cannot run on.

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": {
      "step": "<step>"
    },
    "name": "run_document_step"
  }
}

Input Schema

NameRequiredDescriptionDefault
stepYesStep to run: extract_text, vision_ocr, analyze, split_rag, vectorize or graph_ingest
forceNoRe-run the step even if already finished (default false)
entityNoRecord type whose documents to process, used with entity_id
entity_idNoID of the record
document_idsNoList of IDs (document)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changed
    • addedInput schema / properties / document_ids / description
      Added value: +"List of IDs (document)"
    • addedInput schema / properties / entity / description
      Added value: +"Record type whose documents to process, used with entity_id"
    • addedInput schema / properties / entity_id / description
      Added value: +"ID of the record"
    • addedInput schema / properties / force / description
      Added value: +"Re-run the step even if already finished (default false)"
    • addedInput schema / properties / step / description
      Added value: +"Step to run: extract_text, vision_ocr, analyze, split_rag, vectorize or graph_ingest"
  2. First observed

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations: it discloses relative cost ('vision_ocr' is the expensive one), that OCR text is marked as such on the document, that nothing is written for a document the step cannot run on, and that the response reports per-document outcomes or skip reasons. These mutation and partial-failure semantics are exactly what an agent needs and are not derivable from destructiveHint/idempotentHint alone.

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

Conciseness4/5

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

Front-loaded with the core action and the required inputs before the caveats, and nearly every sentence carries information an agent needs. It is a single dense paragraph, though, and could be structured into discrete clauses for faster scanning of the six step modes.

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?

With no output schema, the description correctly explains that results are reported per document along with skip reasons. It leaves out permission requirements and the exact failure/partial-success semantics across multiple document_ids, which matter for a destructive multi-document mutation.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: it ties each step value to behavior and cost, states the default for force, and presents document_ids as an OR-alternative to entity + entity_id. It does not explain ID format or what happens when both addressing modes are supplied.

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 (run ONE analysis step on documents) and immediately clarifies scope: a single step per call, so a document that failed at one stage need not be re-run through all of them. The six enumerated step names make it distinguishable from siblings like analyze_document or list_document_steps.

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?

Gives explicit when/when-not guidance for the highest-risk choice: 'vision_ocr' only for files WITHOUT a usable text layer, and 'extract_text' on text PDFs because it is free, exact, and better. It also explains that re-running a finished step requires force=true. It does not route between sibling tools (e.g., analyze_document), so it falls short of a 5.

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.