Your search tool should say no: building an MCP server for an unreliable caller A developer built CameoDB, a Rust search database with a built-in MCP server whose six read-only tools reject malformed queries instead of silently dropping unparseable clauses. When an agent submits a query with an unknown field such as 'platfrom', search_index returns isError: true with an explanation and points the caller to describe_index, rather than returning confident but wrong hits. The server also exposes validate_query, per-field type and tokenizer hints, field projection that cut search-result tokens by 91–96% on one index, and bearer-key or OAuth authentication scoped to allowed indexes. An agent with a search tool makes typos. It writes platfrom:hn instead of platform:hn , or it asks for a field that exists in one index and not the one it's querying. What happens next depends on the server. Many search engines drop the clause they can't read and answer the rest. The tool call succeeds, the agent gets a confident list of hits, and nothing tells it the hits answer a different question. For a human at a search box that's a minor annoyance, because you look at the results and notice. An agent doesn't notice. It reasons over what came back. I build CameoDB https://github.com/cameodb/cameodb , a search database full-text, key-value and documents in one Rust binary with an MCP server built in. This post is about the design choices in that MCP surface, made with that caller in mind. Here is a real call to search index with the typo from above, on an index of about 2,900 tech-community posts: {"index": "marketing", "query": "platfrom:hn AND title:mcp", "limit": 2} The response is isError: true : Query rejected: part of this query could not be interpreted and was dropped, so the results would not be the ones asked for. - unknown field 'platfrom' — the clause naming it was dropped, so this result set does not match what the query asked for Rewrite the query and retry. describe index lists the fields this index actually has, with the operators each field's type supports. No hits. The agent is told what was wrong and which tool shows the real fields. With platform spelled right, the same call returns 72 hits. The same rule covers a quieter trap: a field that only showed up in later writes, and so was never indexed. A search naming it is refused on the MCP surface rather than answered with nothing. If the agent wants to check first, validate query is a tool too. It returns the recognized and unknown fields, the clauses that would be discarded, and for each field its type and how it matches "Words in any case, English stemmed: running finds runs " , all before anything runs. An agent arrives knowing nothing about your data. Whatever it does is bounded by what it can read from list indexes and describe index , so those carry as much as possible: description you write, verbatim. The schema is the only place that says what the data query hint per type naming the operators that work on it, and a tokenizer hint saying how matching behaves. That's also what makes field projection usable. search index takes a fields list, and an agent that has read describe index can ask for three fields instead of whole documents. On one of our indexes that cut search-result tokens by 91–96% https://dev.to/gorancv/your-agent-doesnt-need-the-whole-document-cutting-search-result-tokens-by-91-96-gjh . The surface is six tools: list indexes , describe index , validate query , search index , search across indexes and get catalog stats . All six are reads and are annotated readOnlyHint: true . Ingestion happens through the HTTP API, outside the agent's reach. An MCP client authenticates with the same bearer key as the REST API, and the key's capabilities and allowed indexes apply unchanged. The tool catalogue itself is filtered to what the key may call, so the agent is never offered a tool it would be refused for. Clients that can't set headers claude.ai, ChatGPT, Claude Desktop connecting by URL sign in with OAuth instead. The token they receive acts as the user's key with read only, on /mcp only. MCP is served on the same HTTP listener as the REST API: POST /mcp for Streamable HTTP, plus the older HTTP+SSE transport for clients that haven't moved. There is no separate MCP process to deploy, version and keep in sync with the database. When the schema changes, the tools describe the new schema. A node whose callers don't need MCP turns it off with enabled = false under mcp . Connecting Claude Code to a local node: claude mcp add --transport http cameodb http://localhost:9480/mcp Setup for Claude Desktop, Cursor, Devin and the MCP Inspector is in the MCP client guide https://github.com/cameodb/cameodb/blob/main/crates/mcp/README.md . Teaching has a price. I measured the tool catalogue the server returns from tools/list : about 27 KB, roughly 6,800 tokens, loaded once per session. Most of it is search index 16 KB , because its description carries the query syntax reference: phrases, ranges, regex, IN lists and per-type operators. The alternative is an agent that guesses the syntax and retries, and every failed round trip also costs tokens and time. I'd still like that number smaller, and it's the next thing I'm looking at. CameoDB is a single binary: downloads https://cameodb.com/downloads.html , source and docs on GitHub https://github.com/cameodb/cameodb . The operator side of MCP mounting, securing, shaping an index for agents is in docs/MCP.md https://github.com/cameodb/cameodb/blob/main/docs/MCP.md . I'd like to hear how your agents fail with search tools. Silent wrong answers, retries, syntax guesses: what have you seen?