root_mcp.extended.tools.root_native module
MCP tool for executing native ROOT/PyROOT code.
- class root_mcp.extended.tools.root_native.RootNativeTools(config)[source]
Bases:
objectMCP tool handler for native ROOT/PyROOT code execution.
This tool is only registered when both: - config.features.enable_root is True - Native ROOT/PyROOT is detected as available
- Parameters:
config (Config) – Server configuration.
- run_rdataframe(file_path, tree_name, branch, bins, range_min, range_max, selection=None, weight=None, output_path=None, timeout=None)[source]
Compute a 1D histogram using RDataFrame.
This is a convenience wrapper around run_root_code that generates RDataFrame code from parameters, avoiding the need to write PyROOT boilerplate.
- Parameters:
file_path (str) – Path to the ROOT file.
tree_name (str) – Name of the TTree or RNTuple.
branch (str) – Branch to histogram.
bins (int) – Number of bins.
range_min (float) – Histogram range.
range_max (float) – Histogram range.
selection (str | None) – Optional cut expression (C++ syntax).
weight (str | None) – Optional weight column name.
output_path (str | None) – If provided, save histogram plot to this path.
timeout (int | None) – Execution timeout in seconds.
- Returns:
Structured result with histogram data.
- Return type:
- run_root_code(code, output_dir=None, timeout=None, input_files=None)[source]
Execute PyROOT/Python code and return structured results.
- Parameters:
- Returns:
Structured result with status, stdout, stderr, output_files, etc.
- Return type: