Node
node
Adapt an :class:~axm.tools.base.AXMTool into a DAG python-node function.
This is the third consumer of the single axm.tools declaration: the same
tool that MCP exposes and the CLI auto-generates can be called directly from a
DAG node, with no HookAction and no subprocess. One entry point → MCP + CLI
+ node (see synchronisation_cmp_cli/README.md, révision axm-dag).
A DAG python node is a callable fn(payload) -> dict whose returned keys are
the node's writes. :func:tool_node builds such a callable around a tool:
- inputs — the node's
readsarrive inpayload; they map to the tool'sexecute(**kwargs)by name, or via an explicitargsrename map when the mem key differs from the parameter name; - outputs —
returnsmaps each write key to its source: the literal"text"(the tool'sToolResult.text) or a key insideToolResult.data; - failure — fail-fast: a tool returning
success=Falseraises :class:ToolNodeError. Guard preconditions with a conditional node (router /if_) so the tool is only invoked when it can succeed.
ToolNodeError
tool_node(name, *, args=None, returns=None)
Build a DAG python-node fn(payload) -> dict around an axm.tools tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The tool's |
required |
args
|
Mapping[str, str] | None
|
Optional |
None
|
returns
|
Mapping[str, str] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
Callable[[Mapping[str, object]], dict[str, object]]
|
A callable mapping the node's |
Raises:
| Type | Description |
|---|---|
ToolNodeError
|
At call time, if the tool is unknown or returns
|