Skip to main content
Version: devel

dlt._workspace.mcp.context

with_mcp_tool_telemetry

def with_mcp_tool_telemetry(**extra_props: Any) -> Callable[[TFun], TFun]

View source on GitHub

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.

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.