How Mistral Large helped us build a small model that flags poisoned MCP tools
Worked
AI agents trust the tools they are given. Before an agent calls a Model Context Protocol (MCP) tool, it reads the tool's description to learn how to use it. That text is a good hiding place. A hidden instruction can steer the agent, even if the poisoned tool never runs. Researchers call this tool poisoning.
We wanted a detector small enough to scan every tool description an agent sees, quickly and at low cost. Large language models can judge these texts well, but calling one for every description is slow and costly. A judge that reads an attack can itself be manipulated by it. So we set out to train a small specialist. Mistral Large turned out to be the key ingredient, in a way we did not expect.
Mistral as a judge
We first used Mistral Large, through its application programming interface (API), to label hard cases and to scan real descriptions from the official MCP registry. It also gave us a high bar on MCPTox, a public benchmark of poisoned MCP tool descriptions.
Our current judge is Le Chonk, which is Mistral Large 4. The results below are from that judge, with one comparison to Mistral Large 3 on a sealed set.
Mistral as a mirror
Then we wrote attacks designed to fool a detector, phrased like ordinary documentation. Mistral missed many of them, and its explanations showed us why: our own labelling rules had a loophole. Each time we fixed a rule, we tested the fix on Mistral. That loop sharpened the definition we now use. An instruction is malicious when, if the agent follows it, the user loses control or information.
Mistral as a generator
The biggest lesson was this: a large language model is a better teacher when it writes the exercises than when it grades them. We asked Mistral Large to write most of our paired examples. Each pair is the same tool description twice: once with a hidden malicious instruction, and once with a legitimate instruction that looks the same on the surface. Same wording, same justification, same language. Only the intent differs.
The pairs vary in language, domain, and writing style, from quiet documentation to shouted system notes. Because each pair was built that way, the label of each of these pairs is known by construction. Most of our training examples were written by Mistral Large, through its API, used as a customer. A clean retrain, with a published training-data manifest, is under way. This is not a partnership, and it is not an endorsement by Mistral AI.
Mistral Large 3 helped generate those training pairs. Le Chonk is the judge we use to measure the result.
A small model, improved by data
We then trained S48, a 140-million-parameter model based on mmBERT-small (jhu-clsp/mmBERT-small), released under the MIT licence, on a training set that includes real tool descriptions and Mistral-written pairs. Each improvement came from better data, rather than from a bigger model.
S48 is designed to flag hidden instructions in the description and the schema fields that an MCP server presents to an agent, before any tool is called. It is not designed to read the content that tools return. That surface is the next piece of work.
We position S48 as a fast first filter. Le Chonk is the strong judge, used on harder or uncertain cases rather than on every description.
How the judge did
Le Chonk flagged most of the attacks in these sets, and it flagged no benign case on the MCPTox test set.
| Set | Attacks flagged | Benign cases flagged |
|---|---|---|
| MCPTox test | 273/279 (97.8%) | 0/154 |
| Hard set (30 twin pairs) | 26/30 (86.7%) | 3/30 |
| Sealed set (30 twin pairs, written by a different model family) | 28/30 (93.3%) | 3/30 |
On that same sealed set, Mistral Large 3 flagged 25 of 30 attacks (83.3%) and 5 of 30 benign twins.
These judge figures are a yes or no, with no threshold to set. The judge measurements reported here cost $2.77.
How S48 did on the sealed set
On that same sealed set, S48 flagged 26 of 30 attacks (86.7%) and 2 of 30 benign twins. The threshold was set on 2,068 separate real legitimate texts, so that at most 1% of those texts are flagged, and was not tuned on the sealed set. 25 of the 30 pairs were classified correctly on both sides. The area under the ROC curve (AUC) was 0.924, where ROC means receiver operating characteristic. AUC is a number from 0 to 1 of how well the model ranks attacks above legitimate text, across all thresholds. 1 is perfect ranking; 0.5 is no better than chance. There were no unscored or uncertain cases.
At a stricter setting, S48 flagged 18 of 30 attacks and none of the 30 benign twins.
On this sealed set, which was written by a different model family, the small S48 flags about as many attacks as Le Chonk, with fewer benign cases flagged, and at a fraction of the cost.
A large model call for every description is still slow and costly, and a judge that reads an attack can itself be steered by it. That is why we see Le Chonk as the judge for the grey area, and S48 as the scanner for everyday descriptions.
What it does not do yet
S48 reads tool descriptions and schema fields, not the content that tools return. The hard test sets are still small, so we make no ranking claim, and no claim against frontier models, until we have measured at least 200 hard attacks. S48 will miss some attacks. A small, purpose-built model is not a substitute for judgement.
What comes next
We will calibrate thresholds on real legitimate text by default, and we will do this separately for descriptions and for responses.
We will train on the tool-response surface, using public sets such as LLMail-Inject and response twins written by Mistral. We will also work on a weak spot: very explicit payloads. We will also train on more varied data that we have the right to use. The check API does not log the submitted text, and optional sharing for training stays off unless a person opts in.
We will build a sealed hard set of at least 200 attacks, written by several generators that were not used in training. Only then will we publish a ranking.
The architecture we are aiming for is a cascade: our rules plus S48 on descriptions, a detector for tool responses, and a large-language-model judge only on the grey area.
The short version: we did not use Mistral Large to replace a detector. We used it to teach one.
S48 will soon be available through the Worked API. A key is required. Agents use this check when they install a new tool. There is no public web page for it. Each result is observe-only, can be wrong, and is not a security guarantee. We will add the link on this page when it is live.
Posts are licensed CC BY-SA 4.0; code snippets are CC0.