Skip to content

[PIGS-978] Surface redaction labels in redact_pdf - #103

Open
IvanK-Nitro wants to merge 1 commit into
mainfrom
PIGS-978-redact-label
Open

[PIGS-978] Surface redaction labels in redact_pdf#103
IvanK-Nitro wants to merge 1 commit into
mainfrom
PIGS-978-redact-label

Conversation

@IvanK-Nitro

Copy link
Copy Markdown
Contributor

What

Adds an optional label to each entry in redact_pdf's redactions array, passed through to the platform.

PIGS-978

Why

The Platform API accepts an optional label per redaction mark and renders it onto the redaction box in the flattened output (left-aligned, trimmed to fit the box width). It is already supported end to end and documented in the public API docs.

redact_pdf never exposed it, so the capability was unreachable through the MCP server — a direct API caller could stamp a redaction with e.g. a withholding basis, while the same request through this server could not. This closes that gap; it is a passthrough, no new platform behaviour.

Changes

  • label added to the per-redaction schema, optional, capability-only description.
  • Redaction shape extracted into an exported Redaction interface. It was previously an inline type duplicated between redact_pdf and PlatformHandler.redactPdf, which is what made this a three-place change rather than one. label is typed string | undefined to satisfy exactOptionalPropertyTypes, matching the existing convention in DetectedFormField.
  • No change to the tool description, so manifest.json needs no update.

Deliberately not included

Redactions derived from a piiJsonFile are still sent without a label, so existing auto-redaction output is byte-identical. A test pins this.

Whether auto-detected PII should be labelled with its type (EMAIL, NAME, …) is a product decision, not a passthrough concern: it would make auto-redacted output self-documenting, but it would also change what every existing auto-redact call produces. Worth deciding separately — happy to follow up if wanted.

Testing

task check (format/types/lint) and task test pass — 189 passed, 1 pre-existing skip (+2 new tests):

  • a label supplied on one redaction and omitted on another reaches the platform exactly as given
  • redactions derived from piiJsonFile are sent with no label

Not exercised against the live API — this is a passthrough of a field the platform already accepts, and the existing redact tests mock at the handler boundary.

🤖 Generated with Claude Code

The Platform API accepts an optional label per redaction mark and renders it
onto the redaction box in the output. redact_pdf did not expose it, so the
capability was unreachable through the MCP server while direct API callers
had it.

Adds an optional `label` to each entry in `redactions`, passed through to the
platform unchanged. Extracts the redaction shape into an exported `Redaction`
interface, replacing the inline type that was duplicated between the tool and
the handler.

Labels are only applied to redactions the caller supplies. Redactions derived
from a piiJsonFile are still sent without one, so existing auto-redaction
output is byte-identical -- whether detected PII should be labelled with its
type is a product decision, not a passthrough concern.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant