Finding a tool that sounds right is not the same as knowing which system owns the data or what must happen first. I built a small ontology-aware MCP router to test whether making those relationships explicit improves routing.
Suppose someone asks for the latest invoice for a customer. A CRM server can resolve the customer by name; a billing server can list invoices, but expects the customer ID returned by CRM. A lexical retriever can find both tools. It does not, by itself, represent that one result supplies a required argument to the other.
An ontology-backed router can attach domain concepts and actions to capabilities, state that invoices belong to customers, and define a workflow that resolves the customer before calling billing. Preconditions and postconditions can check that the lookup succeeded and that the returned invoices belong to the resolved customer.
That is a different layer from ordinary semantic search. It is also broader than text-to-SQL: database semantics can ground questions in tables and metrics, while MCP routing may need to connect actions, entities, identities, and constraints across independent servers. Neither an ontology nor MCP itself makes those systems interoperable automatically.
The prototype is a local Python MCP gateway with two mock servers: CRM and billing. It discovers their tool schemas at startup, ranks capabilities with BM25 plus configured ontology matches, and can expose a guarded workflow that resolves a customer before fetching invoices. The mapping is hand-authored JSON. The router does not generate an ontology or call an LLM to choose tools.
The workflow is deliberately read-only. It validates arguments and available output schemas, checks configured preconditions and postconditions, and carries the CRM result as provenance for the billing call. Those are useful engineering properties, but they are separate from the question of whether ontology improves routing accuracy.
I compared three rankers on 12 in-scope paraphrases and three out-of-scope requests over only two capabilities. BM25 got 9 of 12 in-scope requests right at rank one. Adding the ontology scores raised that to 11 of 12. But it also returned a candidate for two of the three out-of-scope requests, including routing “delete an account” to a read-only billing tool. The pilot report contains the per-request outcomes.
I added an optional action-match gate: an action-bearing capability is omitted unless a configured action or alias matches the request. In this fixture, it kept top-one accuracy at 11 of 12 and reduced out-of-scope candidate returns from two to zero. It also abstained on “which account is this person,” a valid lookup request with no clear action word. Its mean reciprocal rank fell from 0.958 to 0.917.
That is a useful debugging result, not a benchmark win. The sample is tiny, and the prompt vocabulary overlaps the hand-written mappings. The gate shows the safety/coverage tradeoff clearly: requiring an action can remove concept-only false routes while rejecting requests whose action is implied.
I reproduced BM25 on the public MCP Semantic Tool Routing Benchmark: 318 of 505 queries at rank one, or 62.97%, with 81.98% Recall@3 and 0.739 MRR.
Then I ran a fixed taxonomy ablation on the same BM25 scores. It added 2.5 points for each exact taxonomy class or type token-set match and 1.5 for an exact operation-ID token-set match. The result was 325 of 505 at rank one, or 64.36%: seven more correct answers, a 1.39-point increase. Twelve queries changed from wrong to right; five changed from right to wrong. The exact paired McNemar p-value was 0.143. A 2,000-replicate bootstrap clustered by operation gave a 95% interval from −0.40 to +3.17 percentage points.
That interval includes no improvement. The result is inconclusive, not evidence that ontology wins. It is also only a metadata ablation, not the router's full concept/action/relation/workflow model. The benchmark has a synthetic catalog; its query authors had access to the registry, and it has no out-of-scope labels or workflow-execution checks. The downloadable per-query benchmark report records the measured outcomes; the benchmark source is the reproducible public input. The prototype and analysis scripts are not in a public repository yet, so these reports do not make the full experiment independently executable.
I also ran a lexical probe on ETOM, a benchmark with levels that include single-tool tasks, equivalent tools, sequences, cross-server graphs, and infeasible tasks. On its 2,375-tool catalog, BM25 selected a correct top tool for 734 of 781 Level 1 requests (93.98%). Yet it returned a tool for all 91 Level 5 infeasible requests.
A separate threshold experiment selected a maximum-score cutoff on development data and measured it on repeated grouped holdouts. The mean out-of-scope false-route rate fell to 1.54%, with mean in-scope success of 92.92%. That is an exploratory result: ETOM's baseline was already inspected, each test fold had only 20–34 infeasible examples, Level 1 and Level 5 have different task distributions, and the score cutoff belongs to that catalog. It is not enabled in the router and says nothing about ontology's incremental effect. A compact ETOM threshold report contains the fold-level aggregate metrics and caveats.
This is why I keep retrieval, abstention, workflow correctness, and ontology contribution as separate measurements. ToolRet studies large-scale tool retrieval; ETOM includes orchestration and equivalence labels. Neither result can substitute for a controlled comparison of this router's ontology layer.
The local fault-injection suite exercises one valid CRM-to-billing workflow and nine failure cases, including a missing customer, an empty invoice list, invalid CRM output, and an invoice returned for the wrong customer. Twelve unit cases pass, including action-gate behavior and configuration validation.
These tests show that configured checks reject the injected failures in this fixture. They do not establish production reliability, server honesty, transaction safety, or a routing improvement. In the wrong-customer case, the router detects the issue after the read call; it cannot undo that call.
The next test needs requests written by people who did not see the ontology aliases or router outputs, with related scenarios kept together in the split. Each request should have independently reviewed labels for acceptable tools, equivalent choices, workflow dependencies, expected state, and valid abstention.
I would compare all-tools exposure, BM25, BM25 plus dense retrieval, and the same hybrid retriever with a frozen ontology. The primary outcome should be mechanically scored task completion on deterministic mock servers, alongside wrong calls, invalid arguments, abstentions, latency, and cost. A development set can tune thresholds; a separate frozen test set must measure them. A second catalog or author group should replicate any positive result.
The project now has a confirmatory evaluation plan and a human task-collection kit. Until an independent set is collected and the paired test is run, the honest conclusion is that ontology routing may help with explicit cross-system relationships and constraints, but this prototype has not shown a general advantage over retrieval.
For the broader tool-selection problem, see Tool Selection at Scale: What Top-K RAG Leaves Out, the site's MCP 101 guide, and the modern AI coding agent stack. The useful next step is not a larger ontology. It is a test that can prove the ontology added value beyond a strong retriever.