Skip to content

SensitiveValues ​

Type
Class
Namespace
craft\mcp
Inherits
craft\mcp\SensitiveValues
Since
5.12.0

Keeps credentials out of MCP results.

Values under keys that look sensitive are redacted with craft\services\Security::redactIfSensitive(), environment variable references included. Clients can send a redacted value back to keep the saved value.

View source

Public Methods ​

MethodDescription
__construct()
redact()Redacts sensitive values within the given value.
redactYaml()Redacts sensitive values from YAML text, such as a project config diff.
restore()Swaps redacted values in supplied values for the saved values they stand in for.

__construct() ​

View source

Arguments ​

  • $security

redact() ​

Redacts sensitive values within the given value.

View source

Arguments ​

  • $value
  • $key (string) – The key or project config path the value is stored under.

redactYaml() ​

Redacts sensitive values from YAML text, such as a project config diff.

View source

Arguments ​

  • $yaml

restore() ​

Swaps redacted values in supplied values for the saved values they stand in for.

View source

Arguments ​

  • $supplied (array<array-key,mixed>)
  • $current (array<array-key,mixed>)
  • $path

Returns ​

array<array-key,mixed>

Throws ​

  • \Mcp\Exception\ToolCallException
    if a redacted value doesn’t stand in for a saved value.