lens-mcp

v1.1.1
io.github.mrhpython/lens-mcp Checked 3 days ago Published 3 months ago

Outside-in validation gate for AI-generated text; a separate model checks LLM output, fail-closed.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

validate_content Validate Content

Run the 10-lens validation gate on AI-generated content. Returns pass/fail, per-lens results, violation details, and a deterministic 0-10 score derived from violation counts (10 = clean, floors at 0; computed by the API tier layer, not by the LLM — the LLM-emitted 0-100 score was removed 2026-07-30). Requires SOULFIELD_API_KEY. Supports domains: general, finance, marketing, legal, seo, agency. WIRE CONTRACT (since 2026-08-10): each lens carries status (ran|skipped|error) and passed is null whenever no verdict was produced — parse passed===false as the violation signal, never !passed. HALT…

ParameterTypeDescription
text *stringThe AI-generated content to validate
contextstringAudience/purpose context for Relevance lens (Lens 9). Omit to skip Relevance silently.
domainstringDomain context for validation (default: general)

scrub_pii Scrub PII

Scan text for structured PII and secrets (emails, UK/US phone numbers, credit-card numbers, US SSNs, UK NI/UTR numbers, database connection strings, and common API-key/credential patterns) via the hosted Lens API. Returns scrubbed text with each match replaced by a generic [REDACTED] marker (the finding TYPE — email, phone_uk, ni_number, etc. — appears only in the findings list, not in the replacement), plus that findings list. It scrubs structured identifiers only: personal NAMES survive, so scrubbed output is not anonymized. Pattern-based server-side scan, no LLM call. Targets structured…

ParameterTypeDescription
text *stringThe text to scan for PII

lens_health Lens API Health Check

Check if the Soulfield Lens API service is running and responsive. Returns status and version. No auth required.

lens_catches_relevant Prior Catches (institutional defect memory)

Read the defect bank BEFORE validating: prior named defects for an artifact type, most-recurrent patterns first. This is the institutional memory that makes the gate improve over time — the recurring traps tell you where this class of artifact has failed before. Any pattern at threshold is marked [PROMOTE], meaning it recurs often enough to deserve a deterministic check. Runs the local lens-kit CLI, no LLM call. Omit artifact_type and pass all=true when the type has no history yet.

ParameterTypeDescription
allbooleanSurface every catch regardless of artifact type
artifact_typestringArtifact type to filter by, e.g. landing-copy, research-brief, content-pack
cwdstringWorking directory to run in. catches.jsonl is read from and written to here. Defaults to the server's cwd.
domainstringAlso filter by domain, e.g. marketing, finance, agency
formatstringblock = paste-ready surface (default); json = raw records
thresholdintegerRecurrence threshold for [PROMOTE] lines (default 3)

lens_catches_add Record a Catch (append to defect memory)

Append a NAMED DEFECT to the defect bank so it is caught next time. Record what was WRONG, the general pattern it is an instance of, and the forward rule that prevents it — doctrine REJECTS routine passes, so only log actual defects. Set self_catch=true when the defect was a failure of your own validation discipline. This is the write half of the improvement loop: enough recurrences of a pattern promote it to a deterministic check.

ParameterTypeDescription
artifact_type *stringArtifact type, e.g. landing-copy, research-brief
catch *stringWhat was WRONG (the specific defect found)
domain *stringDomain, e.g. marketing, finance, agency
pattern *stringThe general trap this is an instance of
rule *stringThe forward rule that prevents this next time
cwdstringWorking directory to run in. catches.jsonl is read from and written to here. Defaults to the server's cwd.
self_catchbooleanTrue if this was a failure of the validator's own discipline

lens_catches_stats Catch Recurrence Stats

Per-pattern recurrence counts across the defect bank. Any pattern at or above the threshold gets a PROMOTE-to-deterministic-check suggestion — that is the signal a recurring judgment call should become a cheap fixed check instead. Use this to decide what to harden next.

ParameterTypeDescription
cwdstringWorking directory to run in. catches.jsonl is read from and written to here. Defaults to the server's cwd.

lens_consistency_leaks Forbidden-String Leak Scan

Scan customer-facing files for deny-list terms (CASE-INSENSITIVE literal match — note lens_consistency_markers is case-SENSITIVE, they differ). Deterministic, no LLM. Exit 6 on a hit. Run this on EVERY customer-facing file before any irreversible publish: it is the check that catches a real client name, an internal codename or a banned absolute surviving into shipped copy. A credential scanner will not find these, because nothing here is a credential. IMPORTANT — a hit proves the STRING IS PRESENT, which is authoritative; it does not by itself prove a violation, because the match is NEGATI…

ParameterTypeDescription
files *arrayLocal file path(s) to scan
cwdstringWorking directory to run in. catches.jsonl is read from and written to here. Defaults to the server's cwd.
denyarrayExtra deny terms, added to the profile's consistency.deny
profilestringProfile YAML providing consistency.deny

lens_consistency_numbers Number Parity (summary vs body)

Check that every numeric literal in a summary actually appears in the body it summarizes. Deterministic, no LLM, exit 6 on a violation. Catches the invented figure — the number a summary asserts that its source never stated. TRIPWIRE, not an oracle: literal matching only, no semantic or derived arithmetic, so a legitimately computed total will flag. Review a hit, do not auto-trust it.

ParameterTypeDescription
body *stringThe body file the summary summarizes
summary *stringThe summary file (its numbers must appear in the body)
cwdstringWorking directory to run in. catches.jsonl is read from and written to here. Defaults to the server's cwd.

lens_consistency_markers Marker Parity (source vs rendered)

Check that evidence markers counted in a source artifact survive into every rendered output. Deterministic, no LLM, exit 6 on a violation. Catches the caveat, citation or hedge that gets dropped between formats — the source says 'as-of 2026-04' and the rendered deck quietly does not. Matching is CASE-SENSITIVE (unlike lens_consistency_leaks, which is case-insensitive), so pick markers whose casing is stable across source and render: 'TRIPWIRE' in the source will NOT match 'Tripwire' in the render and will read as dropped when nothing was. TRIPWIRE: a deliberate subset render also under-count…

ParameterTypeDescription
rendered *arrayRendered output file(s) to check against the source
source *stringThe source artifact (authoritative marker counts)
cwdstringWorking directory to run in. catches.jsonl is read from and written to here. Defaults to the server's cwd.
markersarrayExplicit marker strings (otherwise taken from the profile)
profilestringProfile YAML providing the marker set