The Best Search Interface Has No UI
For an agent, the search response is the interface. Design it around evidence, context budgets, reliable follow-up calls and errors the caller can act on.
A search endpoint returns ten hits in 40 milliseconds. Each hit contains its full source document, a vector, internal metadata and a score. The backend dashboard is green. The agent now has several thousand words to read before it can decide which document to open.
Most of that response was never meant to be read directly. A frontend would have selected a title, a link and two sentences. Remove the frontend, and that selection work doesn't disappear. It moves into the model's context window.
For an agent, the response payload is the search interface. Field selection, passage boundaries and error messages determine what the caller can understand and do next. They deserve the same care as the ranking function.
Treat context as a budget
Anthropic's tool-design guidance illustrates the effect with a response that takes 206 tokens in detailed mode and 72 in concise mode. The concise version omits identifiers needed for some follow-up calls. That trade-off is more instructive than the reduction: shrinking a response helps only if the caller can still finish its job.
For search, the default response should usually carry a stable identifier, a readable title, a source reference, selected attributes and enough evidence to decide whether to investigate. Preserve the identifier even in concise mode. A compact result that forces the agent to search again just to recover an ID has saved space in the wrong place.
Offer a page budget as well as a result count. Ten documents with three snippets each can exceed a budget that ten short passages fit comfortably. If the service accepts a token budget, specify the tokenizer used, or call it an estimate. Tokens aren't a universal unit across models and languages.
A narrow passage can omit a definition or exception. A full document can overwhelm a simple fact lookup. Make expansion possible: return a parent ID, section reference or source offsets, then provide a fetch operation. Chunking decisions and response design meet at that boundary.
Give each field a job
A result schema should make three things easy: identify the source, assess the evidence and request more. Here is an illustrative contract for an agent-facing search wrapper, not a WarpSearch API response or an MCP standard:
{
"results": [{
"id": "manual-ab120-r3",
"title": "AB-120 installation manual",
"source": "https://docs.example.com/ab120/revision-3",
"revision": "3",
"rank": 1,
"passage": "Disconnect power before removing the rear panel.",
"section": "Safety precautions",
"matched": {
"exact_fields": {"part_number": "AB-120"},
"retrievers": ["lexical", "vector"]
}
}],
"total": {"value": 42, "relation": "eq"},
"truncated": false,
"next_cursor": "opaque-continuation-token"
}
The passage is source text. The matched object describes retrieval behavior; it doesn't certify the passage's factual correctness. Keep those roles distinct. Preserve revision information so a later fetch can identify whether the underlying document changed.
Some details can be optional:
| Field | Purpose | When to include it |
|---|---|---|
| ID and source | Fetching and citation | Every hit |
| Passage and location | Inspecting evidence in context | Evidence-oriented searches |
| Rank | Ordering within the current result set | Every ranked hit |
| Score and score type | Debugging or score-aware decisions | When the caller understands their meaning |
| Match summary | Distinguishing exact, lexical and semantic matches | When the engine can report it reliably |
| Total and its relation | Distinguishing exact counts from lower bounds | When counts affect the next action |
A fusion score is not a probability that the document answers the question. A cosine score from one embedding model isn't directly comparable with another model's score. Returning either as confidence invites a conclusion the engine hasn't established.
MCP provides useful transport primitives. Its 2025-06-18 tools specification defines structuredContent and outputSchema, with a requirement that structured results conform when a schema is supplied. It also supports resource links. Those features carry a contract; the application still has to design one that serves the task.
Explain enough to guide the next query
A lexical hit on AB-120, a synonym match on “installation,” and a vector-only hit mean different things. A compact match summary can help an agent decide whether to accept a result, add a constraint or try different wording.
Keep the summary factual. Return matched fields or retriever contributions when available. Don't label a hit “all requirements satisfied” because its embedding was close. Required permissions and structured constraints should be enforced by the query service, independently of any explanatory text.
Snippets need similar discipline. Preserve a sentence's negation, its units and nearby qualifications. Deduplicate overlapping source spans before returning them, and avoid substituting a generated summary for a quotation without labeling the change. The caller needs to know whether it is reading evidence or an interpretation of evidence.
WarpSearch already offers field projection and highlighting with match summaries, including through its MCP search tool. These provide useful building blocks. The total-page token budget and unified matched contract illustrated here are design proposals for a wrapper, not a claim that every option exists in the service today.
Response design is also where counts can mislead. A facet over a vector candidate pool describes that pool. It doesn't necessarily describe every matching document in the collection. Name the scope, and distinguish an exact total from an estimate or lower bound. An agent deciding whether to narrow a query needs that distinction more than it needs another decimal place in the score.
Make continuation and failure explicit
Cursor pagination should state what remains stable between calls. If the cursor pins a snapshot, say so. If fresh writes can change the results, document that behavior. An opaque cursor is fine; an undocumented promise about consistency isn't.
Truncation also needs an explicit signal. Dropping the end of a result silently can remove the sentence that changes its meaning. Return which limit was reached and a supported next action, such as fetching a document section or requesting fewer results.
An invalid request should identify the field and expected type. A warming index should supply a retry delay. A zero-result search should remain a successful search with no hits, rather than being confused with a service failure. MCP's tool error mechanism distinguishes execution failures through isError; use the error body to make recovery possible.
Be careful with proposed “which filter removed everything” explanations. Producing them can require additional queries, and diagnostic counts must respect the same access controls as results. Return verified diagnostics or describe the constraints applied. Don't invent a cause from an empty list.
Evaluate the response as part of retrieval
The agent runtime can do some of this work. Anthropic's code-execution pattern for MCP shows how intermediate data can be filtered in code before reaching the model. That's useful when a tool's raw response is unavoidable. Engine-side projection and aggregation can also save transfer and processing before that data leaves the service.
Compare response formats on a fixed task set: full documents, traditional highlights, self-contained passages, and passages with compact match information. Keep the retriever and agent configuration fixed. Measure task success, citation correctness, input tokens and follow-up calls. A shorter initial response that produces three unnecessary fetches may lose the comparison.
Humans will still need search screens. For the agent consuming the API, though, the design review should begin with the response body. Open a real trace and read what the model received. That is the page your newest user sees.