Skip to main content
Glama

Fairquery Agent Trust & Data Safety

Restore placeholders with original values (free, on this Worker)

pii_restore_text
Read-onlyIdempotent

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. 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: Runs on this Fairquery-hosted Worker (Cloudflare), not on the caller's machine; inputs leave the client. This Worker's code is designed not to store inputs, results, or an Apify token. No further network call; the placeholder map is not forwarded. 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. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Goes well beyond the readOnly/idempotent annotations: it discloses that execution happens on a hosted Cloudflare Worker so inputs leave the client, that the Worker is designed not to store inputs/results/tokens, that no further network call occurs and the map isn't forwarded, plus latency, size caps (50 texts, 200k chars each, 10k map entries) and the INPUT_TOO_LARGE error. It also flags the sensitive nature of the output and warns not to send it 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.

Conciseness4/5

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

Strongly front-loaded with WHAT/WHEN/WHEN NOT/COST/RETURNS labels that make it scannable despite its length. It is dense and repeats a few facts already in the schema (size limits, example map), so it is a touch longer than strictly necessary, but no section is filler.

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 nested-object, security-sensitive tool it covers everything an agent needs: source of the map, reversibility limits, replacement semantics, pagination, error case, output shape (restored_document rows with output_text, replacements, unknown_placeholders) and a worked example — even though an output schema exists.

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?

Schema coverage is already 100%, yet the description adds real semantics: placeholderMap should be passed as meta.placeholder_map unchanged, keys are matched exactly/case-sensitively with longest-key-first in a single pass so restored values are never re-replaced, and it explains what unknown_placeholders means and why an LLM-rewritten placeholder won't restore. It also clarifies that limit/offset page whole documents (default 10), which the schema only partially conveys.

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?

Opens with a specific verb+resource: putting original values back into texts containing placeholders like [EMAIL_1]. It explicitly names the source of the map (pii_redact_text / pii_guard_documents) and its inverse siblings (pii_redact_text, pii_scan_text), so an agent can distinguish it from every other PII tool without opening a schema.

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?

Has explicit WHEN (after an LLM answered a sanitized prompt, before showing the user) and WHEN NOT (not for redacting or scanning; masked/hashed values are not reversible — only placeholder style is). It names the concrete preconditions (redactionStyle "placeholder", returnPlaceholderMap=true), leaving nothing to inference.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources