Ask an agent connected to a payments API for the weather. The right answer takes one sentence: "I can't do that." Our agent searched for a weather tool 5 times. On the next attempt, 8 times. Every search came back with a full list of payments tools, so every search looked like a near miss worth one more try.
Big APIs don't load every tool into the agent's context. The agent searches for what it needs, and sooner or later a user asks for something no tool can do. At that moment the search decides whether your agent says "I can't" in one call or burns its budget, and your user's patience, hunting for a tool that doesn't exist. And a search that ranks results always has a top hit.
We changed only what the search says back. A flag for "nothing here matches well" cut searches per task from 1.44 to 0.95, all of it on tasks no tool could do. Asking for one query per operation lifted exact top hits from 0.59 to 0.82. A small AI model we added to filter the results lost to that simple change, and ran too slowly to ship.
If your agent finds its tools by search, the cheapest wins are in what the search says back.
A weather report from a payments API
"What is the current weather outside my Stripe Terminal location location_1? Please include the temperature and whether it is raining right now."
That was one of our test prompts. The right answer is "I can't do that". The agent, gpt-6-luna, was working against a mock of the Stripe API through Neurouter, an open-source MCP gateway. It sits between agents and the APIs they call, which let us change the interface without touching the agent. Large APIs don't list every operation up front. A full catalog in the context window costs tokens before the agent has done anything, which the Guide calls tool-schema bloatLexicon · 38Tool-Schema BloatUpfront context consumption caused by oversized or granular tool catalogs.. So the agent gets one tool, search_tools, and asks it for what it needs.
The gateway already had an honest empty result. When a search found nothing, it said so and named the tool for reporting an unmet need. That hint never fired. The search is hybrid: keyword matching plus embedding similarity, fused into one ranking. A ranking always has a top 8, so every search came back with a full list of payments tools.
The agent treated each list as a near miss. It tried "terminal locations", then "location retrieve list address latitude longitude", then a guessed tool name. Over three attempts it searched 5, 8 and 5 times. It never said the search was failing it. It just kept rephrasing, and only then reported the gap.
With a weak-match flag in the response, the same agent stopped after 1 search in two of three weather attempts. On a second impossible task, a support-case transcript that no Stripe tool returns, it went from 4–5 searches to 1 every time.
Ranked search never returns zero, so it has to say when nothing fits.
Six things we learned
- A weak match is a null result, and it needs saying.
- Raw similarity knows best when nothing fits.
- Ask for one query per operation.
- Shorter search results cost almost nothing.
- A better question beat a small model.
- A flag can't beat a belief.
1. A weak match is a null result, and it needs saying
Every search we saved was on a task no tool could do.
An empty result, or a quiet "done", is what the Guide calls a null observationLexicon · 27Null ObservationsEmpty results or silent successes requiring explicit scope confirmation.: an answer of nothing, which the agent can only trust if the tool says where it looked. A ranked list with nothing relevant in it is the same answer in disguise. Without a flag, the agent rephrases the same request again and again. That loop, near-identical calls that change nothing, is a thrash trapLexicon · 49Thrash & Loop TrapsRepeated near-identical failing calls producing zero environment progress..
Here is the flagged response to a weather query (real output from our offline tests, trimmed to tool names):
{
"data": {
"tools": ["get_balance", "get_subscriptions", "… 6 more hits"],
"shown": 8,
"total_matches": 8,
"match": "weak"
},
"hint": "No strong match for the query: no tool covers its key words. If no tool fits, call neurouter_report({\"kind\":\"unmet_need\",\"text\":\"…\"}); do not search again."
}
The flag shipped in one bundle with three smaller changes: the shorter lists from section 4, a note on near-tied tools, and related tools per hit. We ran Luna on 19 tasks, 3 times each, with and without them.
| Per task | Plain list | With the flag | Δ (95% CI) |
|---|---|---|---|
| Searches | 1.44 | 0.95 | −0.49 [−1.05, −0.07] |
| All calls | 3.54 | 2.95 | −0.60 [−1.35, +0.07] |
| Success | 0.91 | 0.88 | −0.04 [−0.09, +0.00] |
Only the search count moved clearly. Success dipped, but the interval reaches zero. Part of the ceiling was ours. As an earlier entry found, 12 of the failed attempts in this search test came from one broken task, and that task failed in both arms here.
This is H-02 Affirmative Null Observations applied to ranked results: when the best match is weak, say so, and name the next move.
A list with nothing useful in it is still an empty result. Say so.
2. Raw similarity knows best when nothing fits
The score we already showed had no absolute meaning.
The live flag used a crude rule: a low fused score, or poor word coverage. Offline, it caught 6 of 12 queries that no tool could answer, and falsely flagged 1 of 107 answerable ones. So we tested which signal separates "nothing fits" best. AUC runs from 0.5 (a coin flip) to 1.0 (perfect).
| Signal | AUC for "nothing fits" |
|---|---|
| Best top-3 cosine similarity (raw embedding) | 0.99 |
| Fused rank score | 0.96 |
| Best top-3 word coverage | 0.85 |
A fused score only says how hits rank against each other. Raw similarity says how close the best hit is to the request.
Hold this one loosely. There were only 12 no-tool queries, and we chose the threshold on the same set. The scale belongs to one embedding model. And it did not carry over to long prompts on the full 1,281-tool GitHub catalog. There, prompts no tool could serve scored 0.86–0.89, because they mention real things like a Codespaces secret. Answerable ones scored as low as 0.84.
Calibrate the flag on the short queries agents actually send, and again whenever the embedding model changes.
3. Ask for one query per operation
One query for two jobs returns the tools for the louder half.
Agents tend to send a whole request as one query: "refund an order and list existing refunds". The ranking then favors whichever half dominates the wording. We let the agent pass a list of queries instead, one per operation, and showed one example of it in the tool description.
| On 107 answerable queries | One query per request | One query per operation | Δ (95% CI) |
|---|---|---|---|
| Top hit exactly right | 0.59 | 0.82 | +0.23 [+0.15, +0.33] |
On the full GitHub catalog, the share of needed tools that came back in the response rose from 0.89 to 0.96, Δ +0.07 [+0.01, +0.14]. The split costs little: in a simulated rewrite of our test requests, each request needed about 1.29 searches.
Live, the two models used the feature differently. Luna split requests by operation, as intended. gemini-3.5-flash-lite sent synonym lists like ["terminal","location"], which multiplied output and added nothing. Same interface, different users. The Guide calls this persona = modelLexicon · 12Persona = ModelTreating model family, scale and training as the user persona.: the model's family, scale and training are the user persona you design for. The split only happens reliably when the description shows one, which is H-09 Executable, Just-in-Time Micro-Docs at work. We couldn't show a live success gain either way, because the curated test catalogs never needed the split.
Shape the request, and show the shape in one example.
4. Shorter search results cost almost nothing
Cut where the scores drop off, not at a fixed eight.
Instead of always returning 8 hits, we cut the list at the first clear gap in scores, and told the agent how many more matched.
| Per response | Fixed top 8 | Cut at a score gap |
|---|---|---|
| Tokens | 818 | 490 (−40%) |
| Share of needed tools returned | 1.00 | 0.99 |
Live, the shorter lists caused no extra searches. No agent ever asked for the rest. That is H-03 Token Hygiene & High Observation Yield and H-07 Local Handles & Progressive Disclosure together: return what changes the next decision, with a pointer to the remainder. It raises observation yieldLexicon · 25Observation YieldUseful, decision-relevant signal per token returned by a tool., the useful signal per token.
Return the matches that matter, and a count of the ones that don't.
5. A better question beat a small model
0.84 at zero milliseconds, against 0.76 at seconds.
Before touching the interface, we tried to fix discovery with inference. A small local model would read the top 8 hits and keep only the tools the request needed. Our targets were zero tools when nothing fits, both tools for two-part requests, and about 100 ms on 2 CPU cores.
The best local model, Jeff-Qwen3.5-0.8B, reached 0.74–0.76. On an Apple M2 it took about 0.23 s at best. On 2 Cloud Run vCPUs it took 1.4–2.8 s, 14–28 times the budget. Then we changed only the query shape. With one query per operation, a free rule (keep each query's top hit) reached 0.84. Running Jeff on top of the split shape lifted that to 0.89, only about 0.05 more. A hosted model reached 0.93–0.95, at about 0.8 s per search.
Change the interface before you add inference.
6. A flag can't beat a belief
Three weak flags, and the agent kept searching.
On the full GitHub catalog, one call returned a list of empty objects because of a bug in the gateway's field selection. Luna concluded it needed a "repository by ID" tool, which doesn't exist. It searched 5–6 times, got 3–4 weak flags, and kept going, in both arms.
A flag informs the agent. It doesn't overrule a plan. Watching the transcripts, a trace reviewLexicon · 52Trace ReviewInspecting reasoning and tool logs to uncover interface friction., showed the root cause was the broken response upstream, not the search.
When an agent ignores a signal, look for the earlier tool that misled it.
What changes
- Flag weak matches in ranked search. An empty-result hint never fires on search that always returns something.
- Calibrate on raw similarity, per embedder. A rank-fused score has no absolute meaning, and thresholds break when the model changes.
- Let agents ask one question per operation. Show the split in one example, and expect some models to misuse it.
- Cut lists at the score gap. 40% fewer tokens, and agents didn't page back for more.
- Exhaust the interface before buying inference. A better query shape beat a filter model at no latency.
- Test discovery with tasks that need it. Our curated catalogs never needed the split, so the live run couldn't show its value.
Where to go from here
- Our Field Guide: Designing for Agents, our interface design principles for AI agents as users, with the heuristics and terms this post links.
- Our MCP server: the Field Guide for your agent, so it can look up a law while it designs or reviews a tool.
- Our AX tool-design skill: a method for designing and reviewing tools that agents use, against the Field Guide's heuristics.
Coming next: we found silent caps in our own gateway, built right after an AX review.