aeat.entrypoints.mcp._dispatch module

Map MCP tool calls to aeat CLI invocations.

Pure name and argv mapping: an MCP tool name round-trips to its registry command key, and a command key plus operator-supplied arguments project onto the CLI argv the server runs. The actual invocation lives in the server shell; this module is deterministic and unit-tested.

The live serving path builds its argv from the command’s per-verb input schema via cli_argv_for() (named arguments in, resolved CLI path out); tool_request_argv() remains the pure (command_key, cli_tokens) -> argv mapper the determinism-replay eval uses to reconstruct a recorded raw-token call.

is_exposable_command(command_key)[source]

Return True when a registry command key should surface as an MCP tool.

Return type:

bool

Parameters:

command_key (str)

tool_name_for_command(command_key)[source]

Render a registry command key as a namespaced MCP tool name.

modelo.work.calculate becomes aeat_modelo_work_calculate. Declared short forms shrink the few command keys that would otherwise overflow the client-prefixed name budget (P4), e.g. modelo.review_package.verify.signature becomes aeat_modelo_rpkg_verify_signature.

Return type:

str

Parameters:

command_key (str)

prefixed_tool_name_length(command_key)[source]

Return the length of a command’s tool name including the client prefix.

Return type:

int

Parameters:

command_key (str)

command_key_for_tool(tool_name, *, command_keys)[source]

Reverse a tool name to its registry command key.

Segment-internal underscores (iva_wallet) make a naive _ -> . inverse ambiguous, so the reverse is resolved against the known command-key set: the unique key whose forward mapping equals tool_name.

Return type:

str | None

Parameters:
tool_request_argv(command_key, args)[source]

Build the CLI argv for a recorded raw-token tool call.

--format json is a root option (it precedes the command path), so the machine envelope is always requested. The pre-resolved args tokens are appended after the command path. The live serving path instead builds its argv from the per-verb schema via cli_argv_for(); this mapper serves the determinism-replay eval, which records raw CLI-token calls.

Return type:

list[str]

Parameters: