# libtmux_mcp.middleware.AuditMiddleware

- **Module:** libtmux_mcp.middleware
- **Package:** libtmux-mcp
- **Language:** Python
- **Kind:** class
- **Source:** https://github.com/tmux-python/libtmux-mcp/blob/4daddc0dfca96c43bf521d818bf91564e1434760/src/libtmux_mcp/middleware.py#L661
- **Page:** https://libtmux.org/en/py/latest/mcp/reference/libtmux_mcp-middleware-auditmiddleware/

Emit a structured log record per tool invocation.

Records carry: tool name, outcome (ok/error), duration in ms,
error type on failure, the fastmcp client_id / request_id when
available, and a redacted argument summary. The logger name is
``libtmux_mcp.audit`` by default so operators can route it
independently (e.g. to a JSON file) without touching the module
``libtmux_mcp`` logger.

## Members

- `__init__` (method)
- `on_call_tool` (method): Wrap the tool call with a timer and emit one audit record.
