aiida_mcp.plugins.workflow module

Generic describe and submit helpers shared by workflow (WorkChain) plugins.

Unlike calcjobs, WorkChains commonly build their input namespace via spec.expose_inputs(…) from other processes, producing deeply nested PortNamespace inputs rather than a flat set of ports. Generically flattening and describing that tree would be misleading (most of a WorkChain’s real inputs would appear as opaque, skipped namespaces), so describe_workflow only reports outputs and exit codes, not inputs. A WorkChain’s own submit_* tool and its hand-written docstring are the authoritative description of what it actually accepts to submit.

Some WorkChains (e.g. one that simply nests a calcjob’s own inputs under one extra namespace) still take inputs via a plain, JSON-shaped dict, just like a calcjob’s submit_calcjob; submit_workflow supports that case. Others build their own ProcessBuilder via a bespoke get_builder_from_protocol-style classmethod (e.g. one that orchestrates several other, heavier WorkChains); there is no generic helper for that case — wrap the classmethod directly.

aiida_mcp.plugins.workflow.describe_workflow(entry_point: str) → dict[str, Any]

Describe the plugin-specific outputs and exit codes of a WorkChain.

Outputs and exit codes inherited unchanged from the base WorkChain are left out.

Parameters:

entry_point (str) – The workflow entry point name, e.g. cif2j.wannier_tb2j.

Returns:

The workflow’s entry point, class, description, plugin-specific outputs and exit codes.

Return type:

dict[str, Any]

Raises:

ToolError – If entry_point is not installed.

aiida_mcp.plugins.workflow.submit_workflow(entry_point: str, inputs: dict[str, Any]) → ProcessNode

Validate inputs against the workflow spec, store the data nodes and submit.

Nothing is stored if validation fails. Inputs for an exposed namespace (e.g. from spec.expose_inputs(OtherProcess, namespace=”other”)) are given as a nested dict under that namespace’s key, exactly as they would be passed to submit/run directly; any orm.Data values nested inside such a dict are stored too.

Parameters:
  • entry_point (str) – The workflow entry point name, e.g. chemshell.opt.

  • inputs (dict[str, Any]) – The workflow’s inputs, including metadata (nested under any namespace that exposes it). Unstored orm.Data values, including ones nested inside namespace dicts, are stored before submission.

Returns:

The submitted process node.

Return type:

orm.ProcessNode

Raises:

ToolError – If entry_point is not installed, or inputs fails validation.

aiida_mcp.plugins.workflow.workflow_available(entry_point: str) → bool

Return whether a workflow entry point is installed.

Parameters:

entry_point (str) – The workflow entry point name, e.g. cif2j.wannier_tb2j.

Returns:

True if the entry point is installed.

Return type:

bool