Skip to content

Supported Lightrun MCP tools🔗

Lightrun MCP exposes a set of MCP tools that AI assistants can invoke to inspect and reason about live application behavior. Each tool represents a specific, production-safe debugging capability provided by Lightrun and can be accessed programmatically through the Model Context Protocol.

For an overview of Lightrun MCP concepts and architecture, see the Lightrun MCP Overview.

The following sections describe the MCP tools currently exposed by Lightrun MCP. These tools are supported starting with Lightrun version 1.75 and enable AI assistants to perform production-safe runtime inspection and debugging operations.

Discover available runtime sources🔗

Tool name: lightrun__get_runtime_sources

This tool allows you to discover which applications, services, or runtime environments are currently available for live debugging with Lightrun.

Before inspecting runtime data or capturing snapshots, you must first select the runtime source where the inspection will occur. Lightrun exposes the available runtime sources based on your permissions, such as:

  • Running applications or services also referred to Lightrun Agents.
  • Groups of instances by agent pools or by tags.
  • Custom-defined source groupings.

This step helps you identify the correct runtime target before performing live inspection or debugging actions.

Inspect runtime expression values🔗

Tool name: lightrun__get_runtime_expression_values

This tool allows you to inspect variable values and expressions as they exist during live application execution, without stopping the application or redeploying code.

Using this tool, Lightrun captures the state of your application when execution reaches a specific line of code. This makes it possible to understand how data flows through your system in real time.

Use this capability to:

  • Investigate unexpected behavior in production or staging environments.
  • Understand variable values and function arguments at specific code locations.
  • Debug issues that are difficult or impossible to reproduce locally.
  • Inspect request/response data and application state during execution.
  • Troubleshoot performance or logic issues by examining runtime values.

The values are captured non-intrusively and only when the specified code path is executed, minimizing overhead while providing precise insights.

This approach enables live debugging without code changes, redeployment, or application interruption.

Sample prompts

  • Get the runtime values of userId and orderTotal at this line.
  • Inspect the arguments passed to this function during execution.
  • Retrieve the value of transaction.amount when the transaction.approved==false is met.

Retrieve runtime execution duration🔗

Compatibility

  • These tools are supported only for Java.
  • These tools are available starting with Lightrun version 1.78.

Measure execution duration (sampling)🔗

Tool name: lightrun__get_runtime_execution_duration

This tool allows you to measure the execution duration of a specific section of code during live application execution, without stopping the application or redeploying code.

Using this tool, Lightrun observes executions when the specified code path is reached and captures execution duration measurements over a defined sampling window. The tool returns aggregated statistics per agent, making it possible to understand how long code actually takes to run under real runtime conditions.

Use this capability to:

  • Investigate performance behavior in production or staging environments.
  • Measure execution duration of critical code paths.
  • Identify slow or inconsistent executions that are difficult to reproduce locally.
  • Compare execution duration across agents or runtime sources.
  • Troubleshoot performance issues using real execution data.

The measurements are captured non-intrusively and only when the specified code section is executed, minimizing overhead while providing precise insights.

This approach enables live performance inspection without code changes, redeployment, or application interruption.

Sample prompts

  • Measure the execution duration of this code section.
  • Get execution duration statistics when this method is executed.
  • Observe how long this logic takes to run at runtime.

Retrieve execution duration samples🔗

Tool name: lightrun__get_runtime_execution_duration_samples

This tool retrieves the detailed execution duration samples for a specific agent collected by a prior invocation of lightrun__get_runtime_execution_duration.

It returns the individual execution measurements underlying the aggregated statistics and does not trigger a new sampling process.

Use this tool to:

  • Inspect individual execution duration measurements for a specific agent.
  • Analyze execution variability and identify outliers after reviewing aggregated results.
  • Perform deeper investigation into slow or inconsistent executions.
  • Generate a report or a dashboard based on detailed execution duration measurements.

The samples are retrieved non-intrusively and without impacting application execution.

Sample prompts

  • Show the distribution of execution times of the code.
  • Compare the consistency of execution times of this code between these two services.
  • Create a report analyzing execution time of this code.
  • Inspect slow execution samples for this agent based on the aggregated statistics.

Retrieve runtime call stack🔗

Compatibility

This tool is available starting with Lightrun version 1.79.

Tool name: lightrun__get_runtime_callstack

This tool allows you to capture the call stack when execution reaches a specific line of code during live application execution, without stopping the application or redeploying code.

Using this tool, Lightrun observes when the specified code path is reached and captures the call stack at that moment, up to the top 20 stack frames. Each frame includes the code file, line number, and method name when available. This makes it possible to understand the execution path that led to a given line.

Use this capability to:

  • Investigate how execution reaches a specific code location in production or staging.
  • Understand the sequence of calls leading to an error or unexpected behavior.
  • Debug issues that depend on call path and are difficult to reproduce locally.
  • Analyze invocation patterns across different agents or runtime sources.

The call stacks are captured non-intrusively and only when the specified line is executed, within a configurable wait window and up to a maximum number of hits across agents.

This approach enables live call-stack inspection without code changes, redeployment, or application interruption.

Sample prompts

  • Capture the call stack when this line is executed.
  • Show me how execution reaches this method at runtime.
  • Get the call stacks for the first few hits when this code path runs.

Count runtime executions🔗

Compatibility

  • This tool is supported only for Java.
  • This tool is available starting with Lightrun version 1.80.

Tool name: lightrun__get_runtime_execution_count

This tool allows you to count how many times a specific line of code is executed during live application execution, without stopping the application or redeploying code.

Using this tool, Lightrun observes executions when the specified code path is reached over a defined sampling window and returns the execution count per agent. This makes it possible to understand how often code actually runs under real runtime conditions.

Use this capability to:

  • Investigate how frequently a code path is hit in production or staging.
  • Compare execution counts across agents or runtime sources.
  • Validate that critical code paths are invoked as expected.
  • Troubleshoot logic or flow issues using real execution counts.

The counts are captured non-intrusively and only when the specified line is executed, minimizing overhead while providing precise insights.

This approach enables live execution counting without code changes, redeployment, or application interruption.

Sample prompts

  • Count how many times this line is executed.
  • Get the execution count for this method across my agents.
  • Compare how often this code runs on each service.

Capture custom numeric metrics🔗

Compatibility

  • These tools are supported only for Java.
  • These tools are available starting with Lightrun version 1.79.

Capture numeric metric (sampling)🔗

Tool name: lightrun__get_runtime_numeric_metric

This tool allows you to capture the value of an integer expression each time a specific line of code is executed during live application execution, without stopping the application or redeploying code. The metric expression must evaluate to an integer so that statistics can be computed.

Using this tool, Lightrun evaluates the metric expression every time the specified code path is reached over a sampling window. The tool returns aggregated statistics per agent (count, min, max, average, and standard deviation) and a result set identifier you can use to retrieve the individual samples later.

Use this capability to:

  • Investigate the distribution of an integer value (e.g., request size, latency, count) at a code location.
  • Measure custom metrics in production or staging without redeploying.
  • Compare metric statistics across agents or runtime sources.
  • Troubleshoot issues using real distribution data.

The metrics are captured non-intrusively and only when the specified line is executed, minimizing overhead while providing precise insights.

This approach enables live custom metric inspection without code changes, redeployment, or application interruption.

Sample prompts

  • Capture the distribution of response.getSize() at this line.
  • Get min, max, and average of order.getTotal() when this method runs.
  • Measure the value of this expression each time the code runs.

Retrieve numeric metric samples🔗

Tool name: lightrun__get_runtime_numeric_metric_samples

This tool retrieves the detailed metric samples for a specific agent collected by a prior invocation of lightrun__get_runtime_numeric_metric.

It returns the individual measurements underlying the aggregated statistics and does not trigger a new sampling process. You can filter by value range or time and paginate through results.

Use this tool to:

  • Inspect individual metric values for a specific agent.
  • Analyze distribution and outliers after reviewing aggregated results.
  • Filter samples by value or timestamp for deeper investigation.
  • Generate reports or dashboards from detailed metric samples.

The samples are retrieved non-intrusively and without impacting application execution.

Sample prompts

  • Show the list of metric samples for this agent from the last capture.
  • Filter samples where the value is greater than 100.
  • Get the first page of metric samples sorted by time.

Next steps🔗


Last update: February 27, 2026