Skip to content
WebMCP Agents
Esc
↑↓navigate↵open⌘Jpreview
On this page

configureRedaction

Sets the page's (or the server process's) redaction rules; every library sink follows them from the next value on.

Sets the page’s redaction rules, or the process’s on a server. Every library sink follows them from the next value on: the devtools log and its “copy as code”, the chat’s tool card, URLs and console lines leaving the page, server logs. With React, <WebAgentsProvider redact> calls it for you.

Import

import { configureRedaction } from "@webmcp-agents/core/redact";

Example

import { configureRedaction } from "@webmcp-agents/core/redact";

configureRedaction({
  keys: (defaults) => [...defaults, "loyaltyId"],
  allowQuery: ["page", "sort"],
});

Options

configureRedaction(options).

Name Type Default Description
options RedactOptions | Redactor required The options of createRedactor, or a redactor you built. {} restores the defaults.

Returns

Nothing.

Notes

  • A second call replaces the first: options are not merged. To build on the current rules, pass getRedactor().extend({ … }).
  • A sink reads the rules when it writes, so a call made after a tool already ran applies to the next call, not to what was already logged.
  • The page and the server are separate: createChatHandler({ redact }) gives a handler its own rules, whatever the process configured.

See also

Was this page helpful?