dlt._workspace.mcp.context
with_mcp_tool_telemetry
def with_mcp_tool_telemetry(**extra_props: Any) -> Callable[[TFun], TFun]
Telemetry decorator for MCP tool functions.
Emits an anonymous mcp_tool_{name} telemetry event after each tool
invocation. Before executing the tool the decorator fully reloads the
runtime context from disk (workspace marker, profile pin, secrets /
config files) so that every MCP call sees the latest on-disk state.
Reload and execution are serialized under a module-level lock.
agent_info is None when the session metadata is not available
(e.g. during tests that call tool functions directly).
Arguments:
**extra_props- literal key-value pairs added to the telemetry event properties.
Returns:
A decorator that wraps the tool function with telemetry tracking and context reload.