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.
Public Methods ​
| Method | Description |
|---|---|
| __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() ​
Arguments ​
$security
redact() ​
Redacts sensitive values within the given value.
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.
Arguments ​
$yaml
restore() ​
Swaps redacted values in supplied values for the saved values they stand in for.
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.