Detect fillable fields in a flat PDF
pdf_detect_fieldsDetects drawn blanks like lines, boxes, underscores, and checkboxes in flat PDFs, returning named form fields with confidence scores for review and later filling.
Instructions
Detect fillable form fields in a flat PDF (one with no form fields; pdf_inspect lists none): finds blanks drawn on the page as lines, boxes, underscores and checkboxes and returns a text or checkbox field for each, named from the nearest printed label, with a confidence from 0 to 1. Each entry has type, name, page, x, y, width, height in PDF points from the bottom-left of the page as the viewer sees it, the frame pdf_add_fields and pdf_edit use. The entries can be reviewed (wrong ones dropped, others renamed or adjusted) and passed to pdf_add_fields as fields (label and confidence are ignored there), and pdf_fill then fills the result; pdf_add_fields with detect true does detection and adding in one call. Only drawn blanks are found: not a blank area with no line or box, a scanned image, or shaded cells with no outline. Results are suggestions: confidence scores are estimates, low-confidence entries can be wrong, and some detections are table cells or rules that are not blanks. Pages are read with min_confidence (default 0.4; 0.6 gives fewer but surer fields) and max_pages (default 40, at most 100). Zero fields is a normal answer with a note. At most 200 fields per call; the pages argument describes continuing a large form. Read-only: the source is never modified.
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": {
"pdf_path": "<pdf_path>"
},
"name": "pdf_detect_fields"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pages | No | Pages to analyse, 1-based: "1-3,5,8-". Default: all pages (up to max_pages). Large forms: a call stops at its time and work limit, so while truncated is true the returned fields can be added with pdf_add_fields, after which pdf_detect_fields run on the resulting PDF with pages set to next_pages (exactly the pages not done, including a page cut at 200 fields; a sparse selection stays sparse) continues until truncated is false. Sending the original PDF again repeats the same names and is not supported. pages_skipped lists pages not analysed: reason too_complex (more drawn shapes or text than the per-page limits; sending them again gives the same answer) or deadline (the call stopped first; they are in next_pages). | |
| password | No | Password to open the input, only needed for a user-password PDF (owner-locked files with an empty user password open without it). | |
| pdf_path | Yes | PDF source: a path to a .pdf file inside the allowed directories (PDFOPS_ROOT, default the working directory), an https:// URL, or a data:application/pdf;base64,… URI. A URL or data URI works when this server runs remotely (Smithery, hosted gateways), where local paths do not exist. | |
| max_pages | No | Analyse at most this many pages. Default 40. At most 100. | |
| min_confidence | No | Drop fields below this confidence. Default 0.4 (drops only the weakest candidates, such as unlabelled shapes); 0.6 gives slightly higher precision and about a quarter fewer checkboxes. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Present when no fields were found or pages were skipped | |
| count | Yes | Fields returned | |
| pages | Yes | ||
| fields | Yes | ||
| next_page | Yes | First page not returned, or null when finished | |
| truncated | Yes | The answer is incomplete (more pages than max_pages, more than 200 fields, or the call stopped at its limit): a further call on the PDF with the returned fields added and pages set to next_pages continues from there, and each call again covers at most max_pages pages. False means no page is left to continue; a page listed in pages_skipped as too_complex was not analysed and is never continued | |
| next_pages | Yes | Page spec of exactly the pages not done (including a page cut at 200 fields), or null when finished | |
| pages_skipped | No | Pages not analysed: too_complex (more drawn shapes or text than the per-page limits; sending them again gives the same answer) or deadline (the call stopped first; they are in next_pages) |