Option C Tools
Loading...
Searching...
No Matches
oct.mcp.safety.SafetyGate Class Reference

Public Member Functions

None __init__ (self, McpConfig config)
SafetyDecision check (self, str tool_name, ToolSpec spec, dict args)

Protected Attributes

 _config = config

Detailed Description

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.

Definition at line 182 of file safety.py.

Constructor & Destructor Documentation

◆ __init__()

None oct.mcp.safety.SafetyGate.__init__ ( self,
McpConfig config )

Definition at line 200 of file safety.py.

Member Function Documentation

◆ check()

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.

Here is the call graph for this function:

Member Data Documentation

◆ _config

oct.mcp.safety.SafetyGate._config = config
protected

Definition at line 202 of file safety.py.


The documentation for this class was generated from the following file:
  • G:/PythonApps/Option_C/oct/oct/mcp/safety.py