chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "pdf-viewer",
|
||||
"version": "0.2.0",
|
||||
"description": "View, annotate, and sign PDFs in a live interactive viewer. Mark up contracts, fill forms with visual feedback, stamp approvals, and place signatures — then download the annotated copy.",
|
||||
"author": {
|
||||
"name": "Anthropic"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"pdf": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "@modelcontextprotocol/server-pdf", "--stdio"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Connectors
|
||||
|
||||
## Local MCP Server
|
||||
|
||||
This plugin uses a **local MCP server** instead of a remote connector.
|
||||
The PDF server runs on your machine via `npx`.
|
||||
|
||||
| Category | Server | How it runs |
|
||||
|----------|--------|-------------|
|
||||
| PDF viewer & annotator | `@modelcontextprotocol/server-pdf` | Local stdio via `npx` (auto-installed) |
|
||||
|
||||
### Requirements
|
||||
- Node.js >= 18
|
||||
- Internet access for remote PDFs (arXiv, bioRxiv, etc.)
|
||||
- No API keys or authentication needed
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,57 @@
|
||||
# PDF Viewer Plugin
|
||||
|
||||
View, annotate, and sign PDFs in a live interactive viewer. Mark up
|
||||
contracts, fill forms with visual feedback, stamp approvals, and place
|
||||
signatures — then download the annotated copy.
|
||||
|
||||
## What It Does
|
||||
|
||||
- **Open PDFs** from local files or academic sources (arXiv, bioRxiv, etc.)
|
||||
- **Annotate collaboratively** — Claude proposes highlights, notes, and
|
||||
stamps section by section; you review each batch in the viewer
|
||||
- **Fill forms** — guided field-by-field completion with live preview
|
||||
- **Sign documents** — place signature/initials images on the page
|
||||
- **Stamp approvals** — APPROVED, DRAFT, CONFIDENTIAL, or any custom label
|
||||
- **Download** — export the annotated PDF from the viewer toolbar
|
||||
|
||||
## Commands
|
||||
|
||||
| Command | What it does |
|
||||
|---------|-------------|
|
||||
| `/pdf-viewer:open` | Open a PDF in the interactive viewer |
|
||||
| `/pdf-viewer:annotate` | Walk through the document, propose + apply markup, review together |
|
||||
| `/pdf-viewer:fill-form` | Fill PDF form fields interactively |
|
||||
| `/pdf-viewer:sign` | Place a signature or initials image on the page |
|
||||
|
||||
## When to use this vs. just reading a PDF
|
||||
|
||||
This plugin is for **interactive, visual workflows** — when you want to
|
||||
see the document, mark it up, and download an annotated copy.
|
||||
|
||||
If you just want Claude to **summarize or extract text** from a PDF,
|
||||
don't use this plugin. Claude can read PDF files natively and that's
|
||||
faster for pure ingestion.
|
||||
|
||||
## How It Works
|
||||
|
||||
This plugin uses a **local MCP server** (`@modelcontextprotocol/server-pdf`)
|
||||
that runs on your machine via `npx`. No API keys or remote services —
|
||||
the PDF server starts automatically when the plugin loads.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Node.js >= 18
|
||||
- Internet for remote PDFs (arXiv, etc.)
|
||||
|
||||
## Supported PDF Sources
|
||||
|
||||
- Local files (file paths in your working directory)
|
||||
- [arXiv](https://arxiv.org) — `/abs/` URLs auto-convert to PDF
|
||||
- Any direct HTTPS PDF URL (bioRxiv, Zenodo, OSF, etc. — use the PDF
|
||||
link, not the landing page)
|
||||
|
||||
## Signature Disclaimer
|
||||
|
||||
`/pdf-viewer:sign` places a **visual** signature image on the page. It is not
|
||||
a certified or cryptographic digital signature. For legally binding
|
||||
e-signatures, use a dedicated signing service.
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
description: Collaboratively annotate a PDF — propose markup, review together, iterate
|
||||
argument-hint: "[path-or-url]"
|
||||
---
|
||||
|
||||
> If you need to check which tools are connected, see [CONNECTORS.md](../CONNECTORS.md).
|
||||
|
||||
# Annotate PDF
|
||||
|
||||
Walk through a document with the user, proposing and applying
|
||||
annotations section by section. The user reviews each batch in the
|
||||
live viewer before you continue.
|
||||
|
||||
## Workflow (AI-driven default)
|
||||
|
||||
1. **Open** — `display_pdf` (or use existing `viewUUID` if already open)
|
||||
2. **Understand** — `interact` → `get_text` on the first page range
|
||||
(≤20 pages) to read content
|
||||
3. **Propose** — describe to the user what you plan to annotate:
|
||||
> "I'll highlight the termination clause on page 2, add a note
|
||||
> 'Review 30-day window' next to it, and stamp page 1 as DRAFT.
|
||||
> Sound good?"
|
||||
4. **Apply** — on approval, `interact` with batched commands:
|
||||
`add_annotations` + `get_screenshot` of the affected page
|
||||
5. **Review** — show the screenshot, ask for edits
|
||||
6. **Iterate** — move to the next section, repeat
|
||||
7. **Finish** — remind the user they can download the annotated PDF
|
||||
from the viewer toolbar
|
||||
|
||||
## Manual mode
|
||||
|
||||
If the user gives explicit instructions ("highlight paragraph 3",
|
||||
"stamp CONFIDENTIAL on every page"), skip the proposal step and
|
||||
execute directly. Still confirm with a screenshot.
|
||||
|
||||
## Annotation types available
|
||||
|
||||
- **Text markup:** `highlight_text` (auto-finds text — preferred),
|
||||
highlight, underline, strikethrough
|
||||
- **Comments:** note (sticky), freetext (visible on page)
|
||||
- **Shapes:** rectangle, circle, line
|
||||
- **Stamps:** any label — APPROVED, DRAFT, CONFIDENTIAL, REVIEWED
|
||||
- **Images:** signatures, initials, logos (see `/pdf-viewer:sign`)
|
||||
|
||||
## Tips
|
||||
|
||||
- Prefer `highlight_text` over manual `rects` for text — it finds
|
||||
coordinates automatically
|
||||
- Batch related annotations in one `interact` call
|
||||
- End each batch with `get_screenshot` so the user sees the result
|
||||
- Keep proposals small (3–5 annotations per batch) so review is easy
|
||||
@@ -0,0 +1,73 @@
|
||||
---
|
||||
description: Fill PDF form fields interactively with live visual feedback
|
||||
argument-hint: "[path-or-url]"
|
||||
---
|
||||
|
||||
> If you need to check which tools are connected, see [CONNECTORS.md](../CONNECTORS.md).
|
||||
|
||||
# Fill Form
|
||||
|
||||
Help the user complete a fillable PDF form in the live viewer. Unlike
|
||||
programmatic form tools, this gives the user **direct visual feedback**
|
||||
on every field as it's filled, with easy undo/edit in the viewer.
|
||||
|
||||
## Why use this instead of programmatic form filling
|
||||
|
||||
- **Visual confirmation** — the user sees each value land in the right
|
||||
box, not just a success message
|
||||
- **Unnamed/unlabeled fields** — many real-world PDFs have fields with
|
||||
machine names like `Text1`, `Field_7`, or no name at all. The label
|
||||
("Date of Birth", "SSN") is printed **next to** the field on the
|
||||
rendered page, not in the field metadata. Use `get_screenshot` to
|
||||
see what each field actually is, then fill by name.
|
||||
- **Easy correction** — the user can edit or clear any field directly
|
||||
in the viewer, or ask you to `fill_form` again with new values
|
||||
|
||||
## Two approaches
|
||||
|
||||
### User-driven (simple, well-labeled forms)
|
||||
|
||||
Call `display_pdf` with `elicit_form_inputs: true`. The server detects
|
||||
form fields and prompts the user to enter values **before** the viewer
|
||||
opens. The filled PDF is then displayed.
|
||||
|
||||
### AI-assisted (complex forms, unnamed fields, or when you have context)
|
||||
|
||||
1. `display_pdf` (without elicit) — inspect returned `formFields`
|
||||
(name, type, page, bounding box)
|
||||
2. If field names are cryptic (`Text1`, `Field_7`), use `interact` →
|
||||
`get_screenshot` of each page with fields. Look at the visual
|
||||
labels next to each bounding box to understand what each field is.
|
||||
3. For each field, either:
|
||||
- Infer the value from conversation context (name, date, email)
|
||||
- Ask the user, describing the field by its **visual** label
|
||||
("the 'Date of Birth' box on page 1")
|
||||
4. `interact` → `fill_form` with `fields: [{name, value}, ...]`
|
||||
5. `interact` → `get_screenshot` of each filled page
|
||||
6. Show the user, ask them to confirm or edit
|
||||
|
||||
## Example
|
||||
|
||||
> **User:** Help me fill out this W-9
|
||||
>
|
||||
> *You:* `display_pdf` → formFields: `f1_1`, `f1_2`, `f1_3`, `c1_1`, ...
|
||||
> (cryptic names)
|
||||
>
|
||||
> *You:* `interact` → `get_screenshot` page 1 → see `f1_1` is next to
|
||||
> "Name", `f1_2` is "Business name", `c1_1` is the "Individual" checkbox
|
||||
>
|
||||
> *You:* "I can see Name, Business name, Address, TIN, and tax
|
||||
> classification checkboxes. I'll fill Name and Date from what I
|
||||
> know — what's your TIN and business address?"
|
||||
>
|
||||
> *After answers:* `interact` → `fill_form` + `get_screenshot`
|
||||
>
|
||||
> *You:* "Here's the filled form [screenshot]. The signature line is
|
||||
> still blank — want to add your signature with `/pdf-viewer:sign`?"
|
||||
|
||||
## Notes
|
||||
|
||||
- Signature fields are usually separate — fill text first, then hand
|
||||
off to `/pdf-viewer:sign` for the image
|
||||
- Checkbox/radio values are `true`/`false` or the option string
|
||||
- The user can always drag & edit fields directly in the viewer
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
description: Open a PDF in the interactive viewer
|
||||
argument-hint: "[path-or-url]"
|
||||
---
|
||||
|
||||
> If you need to check which tools are connected, see [CONNECTORS.md](../CONNECTORS.md).
|
||||
|
||||
# Open PDF
|
||||
|
||||
Display a PDF document in the live viewer. Use this when the user wants
|
||||
to **see** a document — not just extract its text.
|
||||
|
||||
## Instructions
|
||||
|
||||
1. If the user provides a URL or file path, call `display_pdf` with it
|
||||
2. If no path given, call `list_pdfs` first to show available documents
|
||||
3. After displaying, offer next steps based on the document type:
|
||||
- **Contract / report** → "Want me to highlight key sections or add
|
||||
review notes?"
|
||||
- **Form** → "This has fillable fields — shall I help you fill it?"
|
||||
- **Academic paper** → "Shall I walk through and annotate the key
|
||||
findings?"
|
||||
|
||||
## Supported Sources
|
||||
|
||||
- Local files (paths or drag-and-drop into your working directory)
|
||||
- arXiv (`arxiv.org/abs/...` auto-converts to PDF URL)
|
||||
- Any direct HTTPS PDF URL (use the PDF link, not a landing page)
|
||||
|
||||
## When NOT to use this
|
||||
|
||||
If the user just wants a summary or text extraction, **do not** open
|
||||
the viewer — use Claude's native Read tool on the PDF path instead.
|
||||
The viewer is for interactive, visual workflows.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
description: Place a signature or initials image on a PDF
|
||||
argument-hint: "[path-or-url] [signature-image-path]"
|
||||
---
|
||||
|
||||
> If you need to check which tools are connected, see [CONNECTORS.md](../CONNECTORS.md).
|
||||
|
||||
# Sign PDF
|
||||
|
||||
Add a visual signature or initials to a document using an image
|
||||
annotation.
|
||||
|
||||
> **Disclaimer:** This places your signature **image** on the page. It
|
||||
> is **not** a certified or cryptographic digital signature. For
|
||||
> legally binding e-signatures, use a dedicated signing service.
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Get the signature image** — ask the user for a local file path
|
||||
(PNG/JPG) to their signature or initials. If they don't have one,
|
||||
suggest they create one and save it to a known path.
|
||||
|
||||
2. **Open the PDF** — `display_pdf` (or reuse existing `viewUUID`).
|
||||
Check the returned `formFields` for signature-type fields — they
|
||||
include page and bounding-box coordinates.
|
||||
|
||||
3. **Locate the target** — if there's a signature field, use its
|
||||
coordinates. Otherwise ask: "Which page, and where on the page?
|
||||
(e.g., bottom-right of page 3)"
|
||||
|
||||
4. **Place it** — `interact` → `add_annotations`:
|
||||
```json
|
||||
{"action": "add_annotations", "annotations": [
|
||||
{"id": "sig1", "type": "image", "page": 3,
|
||||
"imageUrl": "/path/to/signature.png",
|
||||
"x": 400, "y": 700, "width": 150}
|
||||
]}
|
||||
```
|
||||
Width/height auto-detected from the image if omitted.
|
||||
|
||||
5. **Verify** — follow with `get_screenshot` of that page. Show the
|
||||
user. Adjust position if needed via `update_annotations`.
|
||||
|
||||
6. **Initials on every page** — batch one `image` annotation per page
|
||||
in a single `add_annotations` call.
|
||||
|
||||
## Tips
|
||||
|
||||
- `imageUrl` accepts local file paths or HTTPS URLs (no data: URIs)
|
||||
- Users can also drag & drop the signature image directly onto the
|
||||
viewer
|
||||
- Coordinate origin is top-left; a typical bottom-right signature on
|
||||
US Letter is around `x: 400, y: 700`
|
||||
- Pair with `/pdf-viewer:fill-form` for complete form workflows
|
||||
@@ -0,0 +1,147 @@
|
||||
---
|
||||
name: view-pdf
|
||||
description: Interactive PDF viewer. Use when the user wants to open, show, or view a PDF and collaborate on it visually — annotate, highlight, stamp, fill form fields, place signature/initials, or review markup together. Not for summarization or text extraction (use native Read instead).
|
||||
---
|
||||
|
||||
# PDF Viewer — Interactive Document Workflows
|
||||
|
||||
You have access to a local PDF server that renders documents in a live
|
||||
viewer and lets you annotate, fill forms, and place signatures with
|
||||
real-time visual feedback.
|
||||
|
||||
## When to use this skill
|
||||
|
||||
**Use the PDF viewer when the user wants interactivity:**
|
||||
- "Show me this contract" / "Open this paper"
|
||||
- "Highlight the key terms and let me review"
|
||||
- "Help me fill out this form"
|
||||
- "Sign this on page 3" / "Add my initials to each page"
|
||||
- "Stamp this CONFIDENTIAL" / "Mark this as approved"
|
||||
- "Walk me through this document and annotate the important parts"
|
||||
|
||||
**Do NOT use the viewer for pure ingestion:**
|
||||
- "Summarize this PDF" → use the native Read tool directly
|
||||
- "What does page 5 say?" → use Read
|
||||
- "Extract the table from section 3" → use Read
|
||||
|
||||
The viewer's value is showing the user the document and collaborating
|
||||
on markup — not streaming text back to you.
|
||||
|
||||
## Tools
|
||||
|
||||
### `list_pdfs`
|
||||
List available local PDFs and allowed local directories. No arguments.
|
||||
|
||||
### `display_pdf`
|
||||
Open a PDF in the interactive viewer. **Call once per document.**
|
||||
- `url` — local file path or HTTPS URL
|
||||
- `page` — initial page (optional, default 1)
|
||||
- `elicit_form_inputs` — if `true`, prompts the user to fill form
|
||||
fields before displaying (use for interactive form-filling)
|
||||
|
||||
Returns a `viewUUID` — pass this to every `interact` call. Calling
|
||||
`display_pdf` again creates a **separate** viewer; interact calls with
|
||||
the new UUID won't reach the one the user is looking at.
|
||||
|
||||
Also returns `formFields` (name, type, page, bounding box) if the PDF
|
||||
has fillable fields — use these coordinates for signature placement.
|
||||
|
||||
### `interact`
|
||||
All follow-up actions after `display_pdf`. Pass `viewUUID` plus one or
|
||||
more commands. **Batch multiple commands in one call** via the
|
||||
`commands` array — they run sequentially. End batches with
|
||||
`get_screenshot` to verify changes visually.
|
||||
|
||||
**Annotation actions:**
|
||||
- `add_annotations` — add markup (see types below)
|
||||
- `update_annotations` — modify existing (id + type required)
|
||||
- `remove_annotations` — delete by id array
|
||||
- `highlight_text` — auto-find text by query and highlight it
|
||||
(preferred over manual rects for text markup)
|
||||
|
||||
**Navigation actions:**
|
||||
- `navigate` (page), `search` (query), `find` (query, silent),
|
||||
`search_navigate` (matchIndex), `zoom` (scale 0.5–3.0)
|
||||
|
||||
**Extraction actions:**
|
||||
- `get_text` — extract text from page ranges (max 20 pages). Use for
|
||||
reading content to decide what to annotate, NOT for summarization.
|
||||
- `get_screenshot` — capture a page as an image (verify your annotations)
|
||||
|
||||
**Form action:**
|
||||
- `fill_form` — fill named fields: `fields: [{name, value}, ...]`
|
||||
|
||||
## Annotation Types
|
||||
|
||||
All annotations need `id` (unique string), `type`, `page` (1-indexed).
|
||||
Coordinates are PDF points (1/72 inch), origin **top-left**, Y increases
|
||||
downward. US Letter is 612×792pt.
|
||||
|
||||
| Type | Key properties | Use for |
|
||||
|------|----------------|---------|
|
||||
| `highlight` | `rects`, `color?`, `content?` | Mark important text |
|
||||
| `underline` | `rects`, `color?` | Emphasize terms |
|
||||
| `strikethrough` | `rects`, `color?` | Mark deletions |
|
||||
| `note` | `x`, `y`, `content`, `color?` | Sticky-note comments |
|
||||
| `freetext` | `x`, `y`, `content`, `fontSize?` | Visible text on page |
|
||||
| `rectangle` | `x`, `y`, `width`, `height`, `color?`, `fillColor?` | Box regions |
|
||||
| `circle` | `x`, `y`, `width`, `height`, `color?`, `fillColor?` | Circle regions |
|
||||
| `line` | `x1`, `y1`, `x2`, `y2`, `color?` | Draw lines/arrows |
|
||||
| `stamp` | `x`, `y`, `label`, `color?`, `rotation?` | APPROVED, DRAFT, CONFIDENTIAL, etc. |
|
||||
| `image` | `imageUrl`, `x?`, `y?`, `width?`, `height?` | **Signatures, initials**, logos |
|
||||
|
||||
**Image annotations** accept a local file path or HTTPS URL (no data:
|
||||
URIs). Dimensions auto-detected if omitted. Users can also drag & drop
|
||||
images directly onto the viewer.
|
||||
|
||||
## Interactive Workflows
|
||||
|
||||
### Collaborative annotation (AI-driven)
|
||||
1. `display_pdf` to open the document
|
||||
2. `interact` → `get_text` on relevant page range to understand content
|
||||
3. Propose a batch of annotations to the user (describe what you'll mark)
|
||||
4. On approval, `interact` → `add_annotations` + `get_screenshot`
|
||||
5. Show the user, ask for edits, iterate
|
||||
6. When done, remind them they can download the annotated PDF from the
|
||||
viewer toolbar
|
||||
|
||||
### Form filling (visual, not programmatic)
|
||||
Unlike headless form tools, this gives the user **live visual
|
||||
feedback** and handles forms with cryptic/unnamed fields where the
|
||||
label is printed on the page rather than in field metadata.
|
||||
|
||||
1. `display_pdf` — inspect returned `formFields` (name, type, page,
|
||||
bounding box)
|
||||
2. If field names are cryptic (`Text1`, `Field_7`), `get_screenshot`
|
||||
the pages and match bounding boxes to visual labels
|
||||
3. Ask the user for values using the **visual** labels, or infer from
|
||||
context
|
||||
4. `interact` → `fill_form`, then `get_screenshot` to show the result
|
||||
5. User confirms or edits directly in the viewer
|
||||
|
||||
For simple well-labeled forms, `display_pdf` with
|
||||
`elicit_form_inputs: true` prompts the user upfront instead.
|
||||
|
||||
### Signing (visual, not certified)
|
||||
1. Ask for the signature/initials image path
|
||||
2. `display_pdf`, check `formFields` for signature-type fields or ask
|
||||
which page/position
|
||||
3. `interact` → `add_annotations` with `type: "image"` at the target
|
||||
coordinates
|
||||
4. `get_screenshot` to confirm placement
|
||||
|
||||
**Disclaimer:** This places a visual signature image. It is **not** a
|
||||
certified or cryptographic digital signature.
|
||||
|
||||
## Supported Sources
|
||||
|
||||
- Local files (paths under client MCP roots)
|
||||
- arXiv (`/abs/` URLs auto-convert to PDF)
|
||||
- Any direct HTTPS PDF URL (bioRxiv, Zenodo, OSF, etc. — use the
|
||||
direct PDF link, not the landing page)
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- **Summarization / text extraction** — use native Read instead
|
||||
- **Certified digital signatures** — image stamping only
|
||||
- **PDF creation** — this works on existing PDFs only
|
||||
Reference in New Issue
Block a user