Skip to main content
Glama
fairquery

fairquery-agent-trust-mcp

Official

Restore placeholders with original values (free, local)

pii_restore_text
Read-onlyIdempotent

Restores original PII values in sanitized texts or LLM answers by replacing placeholders with originals from a redaction placeholder map, so users can view completed responses.

Instructions

WHAT: Put the original values back into texts (typically an LLM answer) that contain placeholders such as [EMAIL_1], using the placeholder map from pii_redact_text or pii_guard_documents. Runs 100% on your machine. WHEN: After an LLM or third party answered a prompt you sanitized with pii_redact_text (redactionStyle "placeholder", returnPlaceholderMap=true), before showing the answer to the user. WHEN NOT: To redact (pii_redact_text) or find PII (pii_scan_text). Masked and hashed values cannot be restored; only placeholder style is reversible. COST: Free; no token. RETURNS: One "restored_document" row per text with output_text, replacements and unknown_placeholders. Errors: INPUT_TOO_LARGE. BEHAVIOR: No network calls; the map never leaves your machine; milliseconds. Max 50 texts, 200,000 chars each, 500,000 total; map up to 10,000 entries. PARAMETERS: placeholderMap: pass meta.placeholder_map unchanged; every key is replaced wherever it occurs exactly (case-sensitive, longest key first, one pass, so a restored value is never replaced again). unknown_placeholders lists [TYPE_N]-shaped tokens left in the text that the map does not contain (the LLM invented or altered them); they stay as they are. A placeholder the LLM rewrote (e.g. "EMAIL_1" without brackets) is not restored. The output contains the ORIGINAL sensitive values: show it to the user, do not send it back to the LLM. limit/offset page whole documents (default 10 per page). EXAMPLE: {"texts":["I will email [EMAIL_1] today."],"placeholderMap":{"[EMAIL_1]":"jane@acme.com"}} -> output_text "I will email jane@acme.com today.", replacements 1.

Input Schema

NameRequiredDescriptionDefault
limitNoOptional page size: items to return, integer 1-50 (default 10). Example: 10
textsYesRequired. 1-50 documents (prompt, chat message, log, file content), each <= 200,000 chars, total <= 500,000 chars. Example: ["Mail jane@acme.com, key AKIAIOSFODNN7EXAMPLE"]
offsetNoOptional zero-based number of items to skip, integer 0-1000000 (default 0); pass nextOffset from the previous response, e.g. 100
placeholderMapYesRequired. Object placeholder -> original value, as returned in meta.placeholder_map by pii_redact_text (or placeholder_map by pii_guard_documents); keys 1-200 chars, values <= 10,000 chars, <= 10,000 entries. Example: {"[EMAIL_1]":"jane@acme.com","[PHONE_1]":"+14155550100"}

Output Schema

NameRequiredDescriptionDefault
metaNoTool-specific context (summary counts, cost notes, ...)
countYesNumber of items in this page
itemsYesResult rows for this page
totalYesTotal items before paging
offsetYesOffset of the first item in this page
hasMoreYesTrue if more items exist after this page
nextOffsetYesOffset to pass for the next page, or null

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.1.0

TDQS

A5/5.0
Behavior5/5

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

Annotations already declare readOnlyHint/idempotentHint/non-destructive/no-open-world, but the description adds substantial context beyond them: it runs 100% locally with no network and the map never leaves the machine, states hard input limits (50 texts, 200k chars each, 500k total, 10k map entries), and warns that the output contains ORIGINAL sensitive values so it must be shown to the user and not sent back to the LLM.

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

Conciseness5/5

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

Although long, it is densely labeled (WHAT/WHEN/WHEN NOT/COST/RETURNS/BEHAVIOR/PARAMETERS/EXAMPLE) and front-loaded, so an agent can skim to the needed section. A few limits are restated from the schema, but every sentence carries actionable information and the concrete JSON example seals the call format.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation-of-text tool with a nested object parameter, the definition covers purpose, prerequisites, cost, return shape, error code (INPUT_TOO_LARGE), safety constraints, parameter edge cases and limits. An output schema exists, yet the RETURNS line still usefully names the fields (output_text, replacements, unknown_placeholders).

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

Parameters5/5

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

Although schema coverage is already 100%, the description adds semantics the schema cannot convey: placeholderMap keys are replaced exactly, case-sensitively, longest key first, in one pass so a restored value is never re-replaced; and unknown_placeholders lists [TYPE_N]-shaped tokens the map lacks and that stay untouched. It also clarifies limit/offset page whole documents.

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?

The WHAT line states a specific verb (restore) and resource (original values / placeholders in texts), and explicitly says it consumes the placeholder map from pii_redact_text or pii_guard_documents. It is immediately distinguishable from siblings like pii_redact_text and pii_scan_text, which are called out in the WHEN NOT line.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The WHEN line gives the exact prerequisite workflow (after a sanitized prompt was answered, before showing to the user) and WHEN NOT names the two alternative tools plus the key exclusion that masked/hashed values are not reversible (only placeholder style is). Nothing about tool selection is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.