console_tool() starts mcp-console serve and returns its send tool as
an ellmer::ToolDef. The server process and its persistent R, Python, and
DuckDB state live as long as the returned tool remains reachable.
Usage
console_tool(
...,
path = NULL,
version = NULL,
config = discover_console_config(path = path, version = version, project = project),
project = getwd()
)Arguments
- ...
Must be empty. Reserved for future use.
- path
NULL, or a path to anmcp-consoleexecutable.- version
NULL, or one publishedmcp-consoleversion, such as"0.0.2".- config
A
ConsoleConfig(). By default,discover_console_config()reads optional global/project files once and materializes their settings. PassConsoleConfig()to skip files and use built-in defaults: host reads, private temporary writes, and no worker networking. Resolver defaults are independent. A supplied config reads no files unless itsdiscoveryproperty explicitly requests it. ExplicitNULLis equivalent toConsoleConfig(). Use the samepath,version, andprojectwhen inspecting and launching a config.- 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.
Value
An ellmer::ToolDef to pass to an ellmer chat's
$register_tool() method.
Details
When the tool is garbage collected, it closes the server's input to request
shutdown and waits up to 15 seconds before forcibly stopping the server.
With sandboxing enabled, the sandbox manager owns cleanup of worker
descendants; the R wrapper's fallback targets only the server process.
With ConsoleConfig(sandbox = FALSE), worker descendants may survive
server shutdown.
See vignette("autonomous-report", package = "mcp.console") for an explicit
configuration, permission edits, inspection, and an ellmer launch.
Executable resolution
If
pathis supplied,console_tool()uses that executable directly.Otherwise, if
versionis supplied, it resolves that published version withreticulate::uv_run_tool()without consultingPATH.Otherwise, it uses
mcp-consolefromPATHwhen available and falls back to the latest published version throughreticulate::uv_run_tool().
path and version are mutually exclusive.
Examples
if (FALSE) { # \dontrun{
chat <- ellmer::chat_openai()
chat$register_tool(console_tool())
chat$chat(
"Tell me something interesting about mtcars. Use the console as a workbench."
)
console_tool(path = Sys.which("mcp-console"))
console_tool(version = "0.0.2")
} # }