Guide
Guard an MCP trading agent
Last updated 2 December 2026
An agent that trades on Robinhood Chain reads launchpad pages, stock-token news, social posts and tool replies, then calls a tool that moves value. This guide shows the two places where a gill belongs, using the same filter that runs in the lab.
filter.mjs). It is a heuristic filter, not a guarantee: keep spending limits in the wallet too.filter.mjs). It is a heuristic filter, not a guarantee: keep spending limits in the wallet too.The hosted API in one call
Send the text, where it came from and what the agent is about to do. The answer is open, narrow or closed, with every detector's vote and the hidden layers it unpacked.
const r = await fetch("https://api.gillsift.xyz/v1/filter", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ content: text, source: "mcp.output", action: "transfer" }),
});
const v = await r.json(); // { state, votes, strict, detectors, layers, receipt, filter }
if (!r.ok || v.state !== "open") stopTheTrade(v); // fail closed: errors stop trades too
Sources: x.post, token.metadata, email, web.page, mcp.output, erc8004.agent. Actions: post, read, swap, transfer, approve, sign. Also GET https://api.gillsift.xyz/v1/health and GET https://api.gillsift.xyz/v1/benchmark. The examples below use the open filter; swap judge(…) for this call to use the hosted API.
1 · Screen every tool reply
Whatever an MCP tool returns goes through the gill before the model sees it. A closed reply never reaches the model; it gets a short note instead.
import { judge } from "./filter.mjs";
async function callTool(name, args) {
const reply = await mcp.callTool(name, args); // e.g. get_news, get_token_page
const text = reply.content.map(c => c.text ?? "").join("\n");
const v = judge({ content: text, source: "mcp.output", action: "read" });
if (v.state === "closed") return { text: `[blocked by Gillsift: ${v.closes} detectors closed]` };
return { text, verdict: v.state }; // "narrow" stays visible but is marked
}
2 · Judge again right before a trade
Before any tool that buys, sells, approves or signs, judge everything the agent read in this turn with the action it is about to take. Money-moving actions are judged strictly, so a single doubt is enough to stop the trade.
const TRADE = { buy: "transfer", sell: "transfer", approve: "approve", sign_order: "sign" };
async function beforeTool(name, args, readThisTurn) {
const action = TRADE[name];
if (!action) return true; // not a value-moving tool
const v = judge({ content: readThisTurn.join("\n---\n"), source: "mcp.output", action });
if (v.state !== "open") {
log("trade stopped", name, v.state, v.detectors.filter(d => d.vote === "close").map(d => d.name));
return false; // narrow means read-only: no trade
}
return true;
}
Rules of thumb
- Fail closed. If the filter throws or times out, do not trade.
- Narrow is read-only. The agent may summarise the input but not move value because of it.
- Keep the raw text away from the model when the verdict is closed. Show a note, log the original for a human.
- Judge the action, not just the text. The same headline is fine for a summary and not fine for a sell order.
- Keep wallet limits. Per-trade and daily caps in the wallet are a second wall the filter cannot replace.
Try it first
The lab has two Robinhood Chain style attacks ready: a launchpad token page with an invisible buy order, and a stock-token headline with a sell order hidden in an HTML comment. Open the lab, or check the numbers on the public benchmark.
Gillsift is an independent project. It is not affiliated with, endorsed by or sponsored by Robinhood. Tool names above are examples, not a real Robinhood API.