Executes a single Marea command inside an isolated task and returns its captured output.
Designed for use from the MCP server: each tools/call is
realised by:
- Stopping any currently running
Marea.Service. - Spawning a
Taskwhose group leader is swapped for aStringIOso all command output is captured. - Setting the per-process stop mode to
:raise, soMarea.Lib.stop/1raisesMarea.Stopinstead of halting the VM. - Invoking
Marea.main_inline/1with the synthesized argv. - If the command returned a deferred
{:exec, cmd}, running the shell command inline (still inside the capture). - Returning
{captured_output, status}to the caller.
Argv synthesis
The MCP arguments map is translated to argv using the leaf's
option/flag spec (see Marea.Mcp.Tools.specs_for/2):
- each option present in the map becomes
[long, to_string(v)], - each flag that is
truebecomes[long], - unknown keys are rejected up-front to keep behaviour predictable across clients.
Subcommand path is prepended verbatim, dasherised via
Marea.Lib.to_dashes/1 to match how Optimus matches subcommand
names.
Summary
Functions
Builds argv for the given tool path + arguments and executes it.
Runs an already-built argv list and returns {output, status}.
Types
@type status() :: :ok | {:error, String.t()}
Outcome of a single tool invocation.
Functions
Builds argv for the given tool path + arguments and executes it.
Returns {captured_output, status}.
Runs an already-built argv list and returns {output, status}.
Public so the marea mcp call debugging subcommand can reuse
the same execution path without going through argv synthesis.