Skip to contents

Read global and project settings once, apply explicit overrides, and return an ordinary ConsoleConfig() that can be inspected, edited, and passed to console_tools(). Supplying that object never reads configuration files again.

Usage

load_console_config(
  project = getwd(),
  global_file = file.path(Sys.getenv("MCP_CONSOLE_HOME", unset = "~/.agents/console"),
    "config.yaml"),
  project_file = file.path(project, ".agents", "console", "config.yaml"),
  overrides = NULL,
  path = NULL,
  version = NULL
)

Arguments

project

Existing directory to use as the child process's working directory, defaulting to getwd(). Relative config and runtime paths use this directory; the caller's working directory is unchanged.

global_file

Global YAML or JSON path. Defaults to config.yaml under MCP_CONSOLE_HOME, or ~/.agents/console/config.yaml when unset.

project_file

Project YAML or JSON path. Defaults to file.path(project, ".agents", "console", "config.yaml"). An explicitly supplied relative path is relative to project.

overrides

NULL, a ConsoleConfig(), or a named mapping applied after the files.

path

NULL, or a path to an mcp-console executable.

version

NULL, or one published mcp-console version, such as "0.0.2".

Value

A ConsoleConfig() with the loaded settings and configuration defaults.

Details

The default locations are optional. An explicitly supplied non-NULL path must exist. Malformed, unreadable, and non-file sources are errors in either case. Set either path to NULL to skip it. Relative filenames and configured paths use project; ~ follows Console's launch-home convention, not R's R_USER.

The loader fills configuration defaults without starting interpreters or preparing runtime packages. Generated tool descriptions and schema metadata are excluded from the editable configuration. Authored tool settings, including empty descriptions and text equal to a generated default, remain explicit. Tool presentation is generated from the final configuration at launch.

Explicit worker/resolver permissions and Python selections replace their corresponding inherited nodes. Other mappings merge recursively. The calling R installation is a low-priority default; file settings and overrides can select another executable. A file's r: null or r.executable: null clears that preference and retains native R discovery when the loaded object is edited, exported with as.list(), reloaded, or launched.

File loading does not capture inherited environment variables or install a dependency lock. inherit_environment controls worker/resolver inheritance, independently of configuration-file discovery.

Examples

if (FALSE) { # \dontrun{
config <- load_console_config()
config@sandbox@filesystem <- list(read_write = "./reports")
tools <- console_tools(config = config)

# Read one required file without the global settings.
config <- load_console_config(global_file = NULL, project_file = "report.yaml")
} # }