root_mcp.core.tools.discovery module

Discovery tools for ROOT files (list, inspect, etc.).

class root_mcp.core.tools.discovery.DiscoveryTools(config, file_manager, path_validator)[source]

Bases: object

Tools for discovering and inspecting ROOT files.

Parameters:
__init__(config, file_manager, path_validator)[source]

Initialize discovery tools.

Parameters:
  • config (Config) – Server configuration

  • file_manager (FileManager) – File manager instance

  • path_validator (PathValidator) – Path validator instance

inspect_file(path, include_histograms=True, include_trees=True)[source]

Inspect a ROOT file’s structure.

Parameters:
  • path (str) – File path

  • include_histograms (bool) – Include histogram metadata

  • include_trees (bool) – Include tree metadata

Returns:

File structure and metadata

Return type:

dict[str, Any]

list_branches(path, tree_name, pattern=None, limit=100, include_stats=False)[source]

List branches in a TTree or RNTuple.

Parameters:
  • path (str) – File path

  • tree_name (str) – Tree name

  • pattern (str | None) – Glob pattern to filter branches

  • limit (int) – Maximum branches to return

  • include_stats (bool) – Compute statistics (slower)

Returns:

Branch information

Return type:

dict[str, Any]

list_files(resource=None, pattern=None, limit=100)[source]

List ROOT files in a resource.

Parameters:
  • resource (str | None) – Resource ID (None = default)

  • pattern (str | None) – Glob pattern to filter files

  • limit (int) – Maximum files to return

Returns:

List of files with metadata

Return type:

dict[str, Any]