Design the Toolbox First
Why This Matters
Until now TestPilot only sees what you paste into the request. With tools it can fetch what it needs: the full history, the log around the error, the commit diff, existing tickets. Most agent problems turn out to be toolbox problems: a missing tool, two tools that do almost the same thing, or one tool that does far too much. Design the toolbox on paper before you write a loop.
Start from the questions
Ask a few experienced testers how they triage a failure and you will hear the same questions:
- Has this test failed before, and how often?
- What does the full log say around the error?
- What changed in the commit that broke it?
- Is there already a ticket for this?
- (Only when sure) File a ticket.
From questions to tools
| Question | Tool | Input | Output |
|---|---|---|---|
| Failed before? | get_test_history | test id, number of runs | list of statuses, failure rate |
| Full log? | read_log | run id, test id, lines around error | trimmed log lines, plus how many were omitted |
| What changed? | get_commit_diff | commit sha, optional path filter | changed files and a trimmed diff |
| Existing ticket? | search_issues | short query | up to 5 matches with id, title, status |
| File a ticket | create_issue | title, body, evidence, labels | ticket id |
Granularity
- One tool per question. Not one tool per database table (the model then has to join data itself), and not one
do_everythingtool (impossible to describe, impossible to permission). - Small, typed inputs.
testId: string,runs: number (max 50). Fewer ways to call it wrong. - Small, predictable outputs. Only the fields the model needs. A history tool that returns 200 fields per run wastes tokens and attention.
How many tools?
Tool selection gets less reliable as the toolbox grows: more descriptions to compare, more overlap, more tokens in every request. Some study guides quote an exact number where quality drops; treat any such number as a rule of thumb, not a specification. The design answer is the same either way: give each agent only the handful of tools its job needs (lesson 37), and split a large toolbox across specialists instead of handing one agent everything.
What stays out of the toolbox
Anything your code can do before the request: the failure rate of the current run, the list of failed tests, the trimmed error. Tools are for information the model may or may not need, depending on the failure. If every triage needs it, compute it up front and include it as evidence.
Read and write are different animals
Four of the five tools only read. create_issue changes the world. Lesson 26 treats them very differently; note the difference already on paper.
Exercise
Write the toolbox as a table in docs/toolbox.md: name, purpose in one sentence, input with types, output with an example, read or write. Ask a colleague to say which tool they would use for three failures from the fixture. If they hesitate, your toolbox needs work.
Compare with solution/lesson-31-mcp-server, which covers lessons 24–31 (see docs/exercises.md, module 4).