The stream decides, the agent explains: fraud decisions as an MCP tool
A customer asks why their card payment was blocked. A streaming scenario made that decision minutes ago, from a fraud score and a policy. This post shows how an AI agent gets that decision, with the signals behind it, as an MCP tool, without calling the model again and without a copy of the policy.
This is part two of two. Part one built the stream: a Nussknacker scenario that decides on every card payment with features and a fraud model from Snowflake.
The question that comes after the decision
In part one a scenario reads card payments from Kafka and approves each one, asks for extra verification, or blocks it. The decision comes from live aggregates per card, features from the Snowflake feature store, a score from a Snowflake model and a decision table that the fraud team owns.
Then somebody asks about it. A customer in a banking app, or a support agent on the phone: why was this payment blocked? More and more often an AI agent is the one answering.
There are two easy ways to give it an answer, and both are wrong.
- Let the agent work it out. It knows the payment was blocked and it can guess the rest. The explanation will read well, and nobody can tell whether it is the one that applied.
- Give the agent a tool that assesses the payment again. The tool calls the model, applies the policy and returns the result. Now the decision logic lives in two places. The fraud team changes a threshold in the stream, the copy behind the tool stays as it was, and the agent explains a decision that was never made.
In both cases the agent ends up deciding. The decision is already made; the agent only needs to be told what it was.
Keep the block, with everything it was made from
The change to the stream is one node. On the block route, next to the alert, the scenario also writes the payment to the Nussknacker Key-Value Store: one entry per card, in a namespace called blocked-payments, kept for 24 hours.

The entry holds what the decision was made from, at the moment it was made:
- The decision. The fraud score, the reason from the policy, and the minimum score of the policy row that matched.
- What the card just did. The number and the sum of its payments in the last ten minutes, and the countries of the last hour.
- What is known about the customer. Home country, average spend, usual hour, account age, chargebacks.
- What is known about the merchant. Category and fraud rate.
None of this is computed for the agent. These are the values that went into the model and the table a moment earlier; the node only keeps them. Each new block of a card replaces the one before, so the store holds the card's last block, not its history.
A scenario that only reads
The tool is a second scenario, a request-response one. It takes a card id, reads that card's entry and returns it.

If the card has an entry, the answer has three parts: the payment, the decision and the signals. If it has none, the answer says so: blocked: false, with a note that there was no blocked payment for this card in the last 24 hours.

It calls no model and holds no copy of the policy. It can't disagree with the stream, because all it returns is what the stream wrote.
Published as an MCP tool
Nussknacker publishes request-response scenarios as tools of an MCP server. In the MCP tab you name a server, describe it for the clients and pick its scenarios. Here the server is card-fraud and it has one tool, explain-card-block, whose input, a card id, comes from the scenario's schema.

The server carries two texts for its clients. The description: "Explains why a card was blocked, from the payment stream's last block of the card." And the instructions, which tell an agent to call the tool with the card id and to explain the blocked payment with its signals, in plain words for the card's owner.
There is no code to write and no separate service to run. An MCP client connects to the server's endpoint with a token issued in the same tab. The mechanics are the same as in serving real-time Kafka data to AI agents through MCP, which goes through them step by step.
The agent asks
For the demo, three payments of one card were sent to the stream: Poland, Germany and Great Britain, 45, 30 and 15 minutes before. The stream blocked the third. Then, in a terminal, Claude Code got the question: "Why was card CARD-C0009 blocked?"

It called the tool once and answered from the record:
- The model gave the payment a score of 97%, and the policy blocks from 85%.
- Three countries in one hour: Poland, Germany and Great Britain.
- A larger amount than usual: 90, where the owner normally spends about 25.
- A payment outside the home country.
It also listed what looked normal: an account almost eight years old with no chargebacks, a grocery merchant with a fraud rate of 0.3%, and no burst of quick payments.
Every number in that answer is a field the stream stored. The 85% is the minimum score of the row that matched, so if the fraud team lowers the threshold, as they do in part one, the next block is stored under the new policy and the agent quotes the new number. Nothing on the agent's side changes.
What the agent adds, and what it can't know
The most useful line in the answer is its caveat:
The tool gives the overall score and the signals, but not how much each signal counted. Calling the three-country pattern the main reason is my reading of the data, not something the model reported.
That is accurate. The stored record has the model's inputs and its output. It has no per-feature contributions, because the scenario doesn't compute any. If you need the agent to say which signal weighed most, that has to be produced where the decision is made, for example as explanation values returned with the score, and stored with the rest.
There is a smaller example of the same thing. The answer says "a £90 payment". The record has an amount of 90 and a country, and no currency. The pound sign is the agent's assumption.
The third one matters more. The stream blocked a payment. It did not block the card, and the record says nothing about the card's state now. Yet the answer ends with advice for the owner: confirm the payments with the bank "to unblock the card", or else the card "should stay blocked and be replaced". Nothing in the tool's answer supports that. We invited it ourselves: the question, the tool's name and the server's description all say that a card was blocked. If we built this again, the tool would be named after the payment.
A tool that returns facts narrows what an agent can get wrong. It does not remove the need to read what the agent says.
Why the split holds up
- One place for the logic. The model and the policy stay in the stream. The tool has neither.
- An answer you can check. What the agent said can be compared with the stored record, field by field.
- A narrow tool. The agent can read one card's last blocked payment. It cannot score a payment, change a decision or see the policy table.
What this demo does not do
- The store keeps one entry per card: its last blocked payment, for 24 hours. The tool is given only a card id, so a question about an earlier block is answered with the latest one, and neither the tool nor the agent can tell the difference. A longer retention would not change that, because each write replaces the entry. A history needs one record per decision and a way to ask for a specific one, for example by transaction id.
- The tool says what happened to a payment, not what state the card is in now.
- Approved and stepped-up payments are not stored, so the tool can't explain why a payment went through.
- The tool takes any card id. In a real deployment, whoever calls it has to be allowed to ask about that card, and that check belongs in front of the tool, not in the agent's instructions.
- The data is synthetic, as in part one.
Try it
You can try it on Nussknacker Cloud or request a self-managed version.
The Key-Value Store and MCP servers are part of Nussknacker; their setup is in the documentation of the Key-Value Store and of MCP servers. If the tool should also be able to ask the user something before it answers, MCP elicitation is the next step.
The visual Flink interface for real-time decision logic.
Enrich, decide, and act on every event.
Related posts
Snowflake knows, Nussknacker acts: real-time decisions with your Snowflake features and ML models
Use the Snowflake Online Feature Store and Model Registry in real-time decisions. A card fraud example with Kafka, live aggregates and a decision table.
Real-Time ML-Driven Recommendations Use Case
Snowplow tracks clicks in a Shopify store, Nussknacker scores them with an ML model in real time and sends the recommendations back to the shop.
SMS Pumping Fraud: Detecting Artificially Inflated Traffic
Fraudsters register an MVNO and pump SMS traffic through other operators. A Nussknacker scenario flags senders of 10,000+ messages to a few numbers in 8 hours.
