Wrapping
wrapping
Tool-call wrapping, tracing, and per-key locking runtime.
Builds the synchronous and async wrapper closures handed to FastMCP for each discovered tool: kwarg unwrapping, implicit-path warnings, external session tracing, ToolResult flattening, and per-key concurrency locking (active only in HTTP mode).
This module is a leaf — it imports only axm_mcp.concurrency at runtime.
Shared structural protocols (ToolEntry, ToolLike, PlainTool,
ToolResultLike) live in axm_mcp.discovery and are referenced here
under TYPE_CHECKING (annotations are strings via
from __future__ import annotations) plus string-literal cast targets,
keeping the runtime import edge one-directional (discovery -> wrapping).
log_external_step(tool_name, tool_args, success, result_str, duration_ms)
Instrumentation seam for non-protocol tool calls.
Currently a no-op. This is the hook point where an execution engine
can observe each MCP tool call (name, args, outcome, duration). The
legacy axm-engine tracing wiring was removed when engine was
deprecated; a future axm-loom-based tracer should re-attach here.
Any implementation MUST swallow its own errors — tracing must never
break tool execution.