handinloop-mcp-server
v0.5.0Human-in-the-loop document extraction: submit a doc, get validated fields and an audit trail.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
handinloop_list_task_types List HandInLoop Task Types
List the document extraction task types the HandInLoop human-in-the-loop platform supports. Call this first to discover valid 'task_type' values for handinloop_submit_extraction_job, and to see which fields each task type returns. Returns: { task_types: [{ id, name, description, output_fields[], hidden? }] }. A type marked hidden: true is retired: do not choose it for new work.
handinloop_propose_fields Propose Extraction Fields
Ask HandInLoop to propose the fields worth extracting from a document — the "what should I extract?" assist. Given a document (and an optional goal), the model suggests a field set you can then pass as 'fields' to handinloop_submit_extraction_job for a custom, human-verified extraction. Synchronous: returns immediately, no job, no human review. Args: - document_url OR document_base64: the document (PDF/image). Exactly one required. - file_name (optional) - goal (optional): focus, e.g. "accounts payable" Returns: { fields: [{ name, description }] }
| Parameter | Type | Description |
|---|---|---|
document_base64 | string | Base64-encoded document content (alternative to document_url) |
document_url | string | Publicly fetchable URL of the document (PDF or image) |
file_name | string | Original filename, e.g. 'do-123.pdf' |
goal | string | Optional focus, e.g. 'accounts payable' |
handinloop_save_task_type Save a Reusable Task Type
Save a named custom field set as a reusable task type (#103 Phase B). Once saved, submit against it by passing its returned id as 'task_type' to handinloop_submit_extraction_job — no need to re-send the fields each time. Saved types also appear in handinloop_list_task_types. Saving an existing id updates it. Needs an API key with the 'workflows' scope (#951), which no key has unless an organisation admin or engineer ticked it when making the key: a saved type changes what every later job of the account extracts. Without it the call fails with the missing scope named; ask a person to issue…
| Parameter | Type | Description |
|---|---|---|
fields * | array | The field set to save (at least one) |
description | string | Optional description of the type |
gate | object | Fields a person must sign off on every document of this type; {} clears |
id | string | Stable handle; derived from name if omitted |
name | string | Human name, e.g. 'Delivery Order' |
prompt_template | string | Instructions to the extraction model for every document of this type; "" clears |
handinloop_get_task_type Read a Saved Task Type
Read one of your saved task types (#583), including its prompt_template, gate and review_policy, which handinloop_list_task_types does not show. Args: - id: the saved task type's id. Returns { id, name, description, output_fields, prompt_template?, gate?, review_policy? }. A built-in type, or an id you have not saved, is not found.
| Parameter | Type | Description |
|---|---|---|
id * | string | The saved task type's id |
handinloop_estimate_cost Estimate What Documents Will Cost
Price a batch of documents BEFORE submitting it (#788). No side effect: nothing is stored, charged, or counted against the free tier. A document costs ceil(pages x the task type's credits_per_page x its line-item multiplier), at least one credit; the multiplier applies when the task type declares a line-item table. The submit charges with the same function, so charged_credits is what the batch costs when every document succeeds and it is submitted in this order this month. A document HandInLoop fails to process (system_error, including after its retries) costs nothing. Args: - task_type: a…
| Parameter | Type | Description |
|---|---|---|
documents * | array | |
fields | array | Custom extraction fields. Provide task_type OR fields. |
task_type | string | Task type id, e.g. 'invoice'. Provide this OR fields. |
handinloop_submit_extraction_job Submit Extraction Job
Submit a document to HandInLoop for extraction with human-in-the-loop validation. AI reads the document and scores every field for confidence first; low-confidence fields are reviewed and corrected by your own team, in a review screen built for it, before delivery. Every decision is signed and recorded. The result is validated data with per-field confidence and a complete audit trail. ASYNC: returns immediately with a job_id and status 'queued'. Human turnaround is minutes to hours in production — poll handinloop_get_job_status (respect estimated_seconds_remaining), then call handinloop_ge…
| Parameter | Type | Description |
|---|---|---|
callback_url | string | https endpoint the result + signed proof is POSTed to on completion (submit and walk away) |
document_base64 | string | Base64-encoded document content (alternative to document_url) |
document_url | string | Publicly fetchable URL of the document (PDF or image) |
expected | object | Freight-invoice audit (#157): your agreed values keyed by field name (e.g. { ocean_freight: 1800, container_count: 5 }). Extracted fields that don't match are flagged as discrepancies (overcharge/unde… |
fields | array | Custom extraction: define the fields to extract instead of a built-in task_type. Provide task_type OR fields. |
file_name | string | Original filename, e.g. 'inv-04187.pdf' |
instructions | string | Free-form note passed to the human reviewer |
task_type | string | Built-in task type id from handinloop_list_task_types, e.g. 'invoice'. Provide this OR fields. |
tolerances | object | Freight-invoice audit per-field tolerance (#157): allowed slack keyed by field name, an absolute amount ('50') or a percentage of the expected value ('5%') — e.g. { ocean_freight: '50', documentatio… |
verify | object | Verified-Answer Loop trust gate (#155): forces human review, never skips it |
handinloop_get_job_status Get Job Status
Check the status of a previously submitted extraction job. Statuses: 'queued' (waiting for a worker) -> 'in_review' (being processed: the worker extracting and checking it, then a person if it needs one) -> 'completed' (result ready) | 'rejected' (invalid document). Use estimated_seconds_remaining to pick a sensible polling interval; for scheduled routines, checking on the next run is usually enough. Args: - job_id: id returned by handinloop_submit_extraction_job Returns: { job_id, task_type, status, submitted_at, finished_at?, estimated_seconds_remaining? }
| Parameter | Type | Description |
|---|---|---|
job_id * | string | Job id returned by handinloop_submit_extraction_job |
handinloop_get_job_result Get Job Result
Fetch the validated extraction result for a completed job. Only call once handinloop_get_job_status reports status 'completed' (calling earlier returns an error with the remaining time). Returns: { job_id, task_type, status, fields: [{ name, value, confidence (0..1), human_verified }], line_items?: [...], // for invoice-like documents audit_trail: [{ at, actor: system|ai|human, action }], discrepancies?: [{ field, expected, actual, delta, kind }], // freight audit (#157) proof?: { // the signed Proof Object (#147) job_id, task_type, status, is…
| Parameter | Type | Description |
|---|---|---|
job_id * | string | Job id returned by handinloop_submit_extraction_job |
handinloop_submit_pilot_batch Submit a Pilot Batch
Submit a batch of documents to an existing HandInLoop pilot run — the agent/API intake for a Shadow-Pilot (#257). A pilot run groups a client's documents for a side-by-side accuracy/turnaround/savings report. Create the run in the portal (app.handinloop.com/pilots) or have a human create it, then pass its 'pilot_run_id' here; every document is stamped with it and joins the run's status board and report. All documents use the run's task type — you don't repeat it. ASYNC and per-document: each document becomes its own extraction job (returns a job_id). One bad document (unfetchable URL, et…
| Parameter | Type | Description |
|---|---|---|
documents * | array | The documents to submit (1..200); each becomes its own extraction job |
pilot_run_id * | string | The pilot run to submit into (created in the portal; must be yours) |
verification_gate | object | Trust bar applied to the whole batch (#258): set the run's verification gate before submitting, so every document inherits it. Only ever makes review stricter — it never skips human review. Persists… |
handinloop_get_pilot_run Get Pilot Run Status
Get a pilot run's live status board — its per-document status and run-level counts (#252). Use after handinloop_submit_pilot_batch to watch the batch clear: documents move queued -> in_review -> completed | rejected. The run is done when counts.completed + counts.rejected == counts.total. in_review covers two stages: the worker still extracting and checking a document, then a person reviewing it. counts.awaiting_human is how many of the in_review documents a person has; the rest (in_review - awaiting_human) are still with the worker. Args: - pilot_run_id: the run to check (must belong t…
| Parameter | Type | Description |
|---|---|---|
pilot_run_id * | string | The pilot run to check (must be yours) |