|
Option C Tools
|
Public Member Functions | |
| None | __init__ (self, McpConfig config) |
| SafetyDecision | check (self, str tool_name, ToolSpec spec, dict args) |
Protected Attributes | |
| _config = config | |
HITL + dry-run enforcement gate for write tools.
One instance is created per MCP server session (in ``server.py``)
and stored in :class:`~oct.mcp.server.ServerState`.
The gate is **stateless** — each :meth:`check` call is independent.
There is no in-memory pending-confirmation queue. This eliminates
the T-08 replay-window attack surface.
Parameters
----------
config
Active :class:`~oct.mcp.config.McpConfig`. The gate reads
``config.dry_run_default_for_writes`` to decide the fallback
dry-run behaviour.
| None oct.mcp.safety.SafetyGate.__init__ | ( | self, | |
| McpConfig | config ) |
| SafetyDecision oct.mcp.safety.SafetyGate.check | ( | self, | |
| str | tool_name, | ||
| ToolSpec | spec, | ||
| dict | args ) |
Evaluate the HITL gate and dry-run rules for *tool_name*.
Parameters
----------
tool_name
MCP tool name (e.g. ``"oct_format"``).
spec
:class:`~oct.mcp.policy.ToolSpec` for *tool_name*.
args
Validated args dict (``model.model_dump()``).
Returns
-------
:class:`SafetyDecision` — never raises.
Definition at line 207 of file safety.py.