Improve tool wording
Small models often call the right tool with the wrong arguments ("Tokyo" instead of "Asia/Tokyo"), or pick the wrong tool when two sound alike. Usually the fix is wording: a clearer description, a parameter hint, an example. Improve finds that wording for you and proves it works on your tool tests before you change anything.
How it works
Section titled “How it works”- Baseline. Your tests run on the models you picked. If you just ran them in the Tests view, those results are reused.
- Diagnosis. Failures are grouped by tool and kind: wrong tool, missed call, wrong argument, called when it shouldn’t, answer.
- Proposals. A strong model (the proposer) reads the tools, the failing runs and the passing ones, and writes 1–3 alternative sets of changes, each with a reason. It may change descriptions, parameter descriptions and parameter examples. Never names, types or required fields: your server’s contract stays the same.
- Verify. Each proposal runs on every test, model and run, with the new wording swapped in on Moka’s side. Plus unseen prompts: paraphrases of your tests that the proposer never sees.
- Review. The best proposal is preselected, showing before → after per model, a word diff of each change, tokens and security notes. Keep, drop or edit each change.
Open Tests and click Improve. The proposer is preselected: your strongest configured model (a cloud model over a local one). Rewriting descriptions is hard for a 4B model, so pick a strong one if you have it.
Not overfitting to your tests
Section titled “Not overfitting to your tests”Wording can game the six prompts you wrote (“ALWAYS call this tool”) and get worse for real users. A proposal only wins if it passes all of these:
| Check | |
|---|---|
| Better overall | It passes more runs than the current wording |
| Unseen prompts | It does at least as well on the paraphrased prompts the proposer never saw |
| No regressions | A test that passed every run doesn’t now fail (one failure is allowed as noise with 3+ runs; none for “must not call” tests) |
| Security check | The new text is scanned like any server’s: no steering other tools, no hidden instructions. High or medium findings reject it |
| Tokens | A tool that grows by more than half is flagged |
With 1 run per test the scores are noisy; 3 runs give a fairer verdict.
Keep what works
Section titled “Keep what works”| Try it in Moka | Saves the kept changes as toolOverrides on the server in moka.json. Chats, tests and exports use the new wording; the server is unchanged. Settings → MCP shows Moka’s wording on each tool, with Undo |
| Copy changes | A Markdown summary (scores and diffs) for a pull request |
| Copy as code | Snippets for the TypeScript SDK (registerTool description and .describe()) and Python FastMCP (docstring and Field(description=…)). Built from the strings, not by a model |
"mcpServers": [{ "id": "my-server", "toolOverrides": { "get_time": { "description": "Get the current date and time in a timezone. Pass an IANA timezone name (Area/City), not a city name.", "params": { "timezone": { "description": "IANA timezone name", "examples": ["Asia/Tokyo", "Europe/Paris"] } } } }}]You can write toolOverrides by hand too. Only wording applies: descriptions, and descriptions and examples of parameters the tool already has.
From the command line
Section titled “From the command line”npx @mokalabs/sandbox improve moka.json --models qwen3-4b,llama3.2 --runs 3 --markdown changes.md Improve Default: 2 tests × 2 models × 3 runs Proposals by OpenAI (gpt-5) · up to ≈108 test runs
Diagnosis • Wrong argument: get_time got {"timezone":"Tokyo"}, expected {"timezone":"Asia/Tokyo"} (6 of 6 runs)
Review before 0/12 holdout 0/24 p1 12/12 holdout 24/24 ✓ winner p2 0/12 holdout 0/24 ✗ rejected Doesn't pass more often than the current wording.| Option | |
|---|---|
-m, --models, -w, --workspace, --runs, --tools | As for moka test |
--improver <id> | Model that writes the proposals (default: the strongest configured) |
--proposals <n> | Alternatives to try, 1–5 (default 2) |
--apply | Save the winner as toolOverrides in the config |
--markdown <file> | Write the winning changes as Markdown |
--json | Print every event as a JSON line |
It exits with 0 when a proposal wins (or nothing needed improving), and 1 when none beat the current wording.