cosmotron_mcp.replay¶
generate_replay_script ¶
Generate a self-contained Python replay script from this session's tool-call log.
Reads {session_dir}/tool_call_log.jsonl (written automatically as pipeline
tools execute) and emits a Python script that calls the same
cosmotron_mcp.tools functions in order — no MCP server required, run from
the repo root with python workspace/.../scripts/replay_YYYY-MM-DD.py.
This is a HUMAN reproducibility artefact, generated for someone to run
outside of an agent session. No agent ever executes it or invokes
python via bash to run it — that is exactly the raw-script escape hatch
every other tool in this server closes (run_analysis_script rejects
it outright). Calling this tool only writes the file; agents' own work
continues through the MCP tools as normal.
If the log does not yet exist (session predates this feature), falls back to a best-effort reconstruction from artefact_registry.json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
str
|
Session workspace directory. |
required |
output_name
|
str | None
|
Override the output filename (default:
|
None
|
Returns:
| Type | Description |
|---|---|
dict
|
|
dict
|
( |