Repository navigation
Description
What happens
On tip f9c35b5 (after #1306), MCP algorithm_spec and plan already rewrite next into host tool language (#1296 / #1298 / #1303 / #1305). MCP demo still returns the CLI demo --json list untouched.
After a successful demo(algorithm="gepa"), next is:
agentdescent show <run_id>
agentdescent apply <run_id> --dry-run
agentdescent algorithms run gepa <your-skill-dir> <your-cases.jsonl> --model <model> [--base-url <url>] --rounds 1 --workers 1 --out spec.json
agentdescent plan spec.json --probe
agentdescent evolve spec.json --max-calls <N>
agentdescent doctor
tests/test_mcp.py currently pins the algorithms run line. A host that followed algorithm_spec or plan next would call those tools; a host that followed this demo next is told to run CLI verbs it may not have (algorithms run, init, plan --probe, evolve), instead of show, apply(..., dry_run=true), and algorithm_spec (whose own next already names plan(..., probe=true) and a capped start).
The same leftover shows up when demo refuses a real-model-only card: the error still says to run agentdescent algorithms run … --model <model> [--base-url <url>] and agentdescent algorithms show.
This is the same leftover-surface class as #1296 / #1299 / #1303 / #1305, now for MCP demo.
Repro
Fresh clone of ThinkFlowLab/agentdescent at f9c35b5e38106ff7818a4500e30e0a920cc61517. pip install -e ".[mcp]". Isolated AGENTDESCENT_HOME. No network is required: the packaged offline demo needs no provider key.
from agentdescent.mcp import Tools
r = Tools(None).demo(algorithm="gepa")
# r["ok"] is True, r["run_id"] exists
# r["next"] contains "agentdescent algorithms run gepa …"
# and "agentdescent plan spec.json --probe"
# and "agentdescent evolve spec.json --max-calls <N>"A default demo() (no algorithm) likewise names agentdescent init and the CLI plan/evolve lines. By contrast, a successful algorithm_spec already returns an MCP plan(..., probe=true) then capped start next, not a CLI command.
Expected
- After MCP
demofinishes a run,nextshould be a short list in tool language, for example:call show with this run_id;call apply with this run_id and dry_run=true to preview the write; then, when an algorithm was named,to run this card on the user's data, call algorithm_spec with the name, their path and cases, and model and base_url (never guess those), plus rounds=1 and workers=1; if that refuses, follow its next and do not start; otherwise follow its next. When no algorithm was named, the last step should send the host throughlist_algorithmsand then that samealgorithm_speccall (there is no MCPinittool). It must not sayagentdescent show,algorithms run,init,plan, orevolve. - When MCP
demorefuses a real-model-only card, the error should namealgorithm_spec(anddescribe_algorithmfor parameters) withmodel/base_url, and must not sayagentdescent algorithms runoralgorithms show. No model name is guessed. - The CLI
demo/demo --jsonnextlist, and the CLI live-model refusal, stay on the CLI verbs (including--model/--base-url). MCPalgorithm_spec/plannext lines are unchanged. - The tool still does not start a real run or probe.
applyis only named withdry_run=true.
Suggested fix
- In
agentdescent/mcp.py(Tools.demo), after the shareddemo_payloadreturns, rewritenextinto the MCP list above. On aSpecErrorwhose message tells the host to runagentdescent algorithms run, rewrite that sentence into tool language. Do not changedemo_payload(those strings are still correct for the CLI). - Pin this in
tests/test_mcp.py(replace the current CLIalgorithms runpins on the MCP path; keep the CLI pins intests/test_demo.py). - Mention the tool-language
nextin thedemotool description. changelog.d/<n>-mcp-demo-next.md.
Acceptance
- MCP
demo(algorithm="gepa")(and evoskill) returnsok: trueand anextlist that namesshow,applywithdry_run=true, andalgorithm_spec, with noagentdescentCLI verbs and nostart/evolve/init. - MCP
demo()with no algorithm nameslist_algorithmsthenalgorithm_specin that last step, notinit. - MCP
demoon a real-model-only card returnsok: falseand an error that namesalgorithm_spec/describe_algorithm, notagentdescent algorithms run/show. - CLI
demo --jsonnextstill starts withagentdescent showand still namesalgorithms runorinit,plan --probe, andevolve --max-calls. pytest -q -o addopts='' tests/test_mcp.py tests/test_demo.py tests/test_mcp_algorithm_spec.py tests/test_mcp_plan_probe.py tests/test_first_run_caps.pypasses, including the new pins.
Activity