cursus.mcp.tools.shared¶
Shared input resolvers for the cursus MCP tool handlers.
Several tool namespaces (compile, config, execdoc) each grew their own
near-identical “turn the args into a PipelineDAG” helper, with subtly different
accepted shapes. This module is the single canonical resolver so every DAG/config-taking
tool advertises and accepts the same input contract:
- DAG input — supply exactly one of:
dag_file: path to a serialized DAG JSON file (loaded viaimport_dag_from_json), ordag: an inline object, either the flat form{"nodes": [...], "edges": [[s, d], ...]}or the serializer/wrapped form{"dag": {"nodes": [...], "edges": [...]}}.
- Config input:
config_file: path to the pipeline configuration JSON.
Engine imports are lazy (inside the functions) so importing the tool modules stays cheap.
- resolve_dag(args)[source]¶
Build a
PipelineDAGfromargs, accepting exactly one ofdag_fileor inlinedag(flat or wrapped). RaisesToolErroron bad/ambiguous input.This is the canonical superset of the former per-tool resolvers: it errors when both sources are supplied (rather than silently preferring one) and accepts the wrapped
{"dag": {...}}form everywhere.