Repository navigation
docs(mcp): laya_decide row must list min_confidence; every tool row must name every handler param - #985
Conversation
`docs/cli-mcp.md`'s `laya_decide` row listed `state, schema, optional model`, but the server registers `laya_decide_tool(state, schema, model="auto", min_confidence=None)` and the tool's own description spells out `min_confidence`. A caller who trusts the table hand-rolls the abstention check on `values`, never learning the tool already nulls an unsure field. The row now includes `min_confidence`. Adds `test_cli_mcp_page_tool_argument_rows`: for each single-shot MCP tool on the docs page (status, route, predict, shortlist, preset, decide), reads the third table cell and asserts every public parameter `inspect.signature` sees on the registered handler appears backticked in the cell. The pre-fix three-param `laya_decide` cell is banned by direct substring so the gate fails if the row reverts. Verified: `PYTHONDONTWRITEBYTECODE=1 python -B tests/test_mcp.py` -- 931 passed, 0 failed. Mutation harness `laya-bench/mutate_cli_mcp_tool_args.py` -- 6/6 CAUGHT: m1 pre-fix `laya_decide` cell, m2 drop `min_confidence` from it, m3 drop `task` from the `laya_route` cell, m4 drop `lang_guess` from `laya_shortlist`, m5 drop `min_confidence` from `laya_preset`, m6 rename `min_confidence` in the handler so the doc no longer names what `inspect.signature` reports. `ruff check laya/ --select=E9,F63,F7,F82,F401,F811 --line-length=120` -- all checks passed. `python -m compileall -q laya/ tests/` -- clean. Diff secret-scan: zero hits.
|
Merged in 0.3.29.
Your point about the "Main inputs" cell being a fourth copy of the shape, after the validator error message, each tool's registered description and the README, is the structural observation behind the whole batch. Four copies of one contract means three of them are wrong eventually. Reading the handler's own signature in the gate rather than asserting the corrected row is what makes this the last time. Merge note: this conflicted with #984, which rewrote the |
What
docs/cli-mcp.md'slaya_deciderow listed`state`, `schema`, optional `model`-- butlaya/mcp/server.py:501registerslaya_decide_tool(state, schema, model="auto", min_confidence=None), and the tool's owndescription spells out
min_confidence("a field whose answer falls below it comes back asnull in
values"). The row now namesmin_confidencetoo.Adds
test_cli_mcp_page_tool_argument_rowsintests/test_mcp.py. For each of the sixsingle-shot tools on the docs page (
status,route,predict,shortlist,preset,decide), the gate reads the third|-delimited table cell and asserts every public parameterinspect.signaturesees on the registered handler appears backticked in the cell. Thepre-fix
laya_decidecell is banned by direct substring so the check fails if the row reverts.Why
The MCP docs page is the fourth copy of the tool's parameter set, after the validator error
message, each tool's registered description, and the README.
test_batch_item_shape_as_documentedalready covers the per-request key shape on the batch rows and the tool descriptions; nothing in
the suite read the single-shot rows, so a whole control -- here, the abstention gate the tool
already runs on every field -- could fall off the table while the code accepted it and the
description mentioned it. A caller who trusts the docs table hand-rolls their own confidence
check on
values, never learning the tool already nulls an unsure field.How it was verified
Checklist
laya_deciderow + its gate)mainpython -B tests/test_mcp.py-- 931/0)unchanged -- this PR makes the table describe what the handler already accepts)
laya-bench/mutate_cli_mcp_tool_args.py, 6/6 CAUGHT