Designing MCP tools that require approval before writing data
An MCP tool is a function the model can call. That is a small sentence with a large consequence: the model can now reach a real system. I split tools into reads and writes, and a write does not land until a person has seen the preview. This is the contract I use on the MCP servers in daily use.
The contract is the permission
Each tool declares what it reads, what it would change, and which workspace it is allowed to see. A tool that can list matters should not also be able to update one, even if both hit the same table. Two tools, two contracts. The model can be wrong about which one it wanted. The server should not have to guess.
Inputs are validated before any preview is built. If the id is missing, or the shape is wrong, the tool returns the validation error and stops. I do not coerce a nearly-right argument into a write. A helpful coercion is how the wrong record gets edited.
type ToolContract = {
name: string
access: "read" | "write"
input: "validated before any preview"
write?: "returns a preview and waits"
}A preview is the proposed change, not a summary
The preview names the record id, the fields that would change, the current value, and the next value. It does not say "updated the diary" and leave the reviewer to trust the sentence. If several rows would change, the preview lists them. If the list is long, it still lists them, or the tool refuses and asks for a narrower input. A preview that hides rows is a write with extra steps.
The approval is attached to that preview. Approving means those ids and those values, not "the agent may write something like this." If the source row changed between the preview and the approval, the write fails and a new preview is required. I would rather reject a stale approval than apply it to a row that moved.
Reads stay reads
A read can still be dangerous. It can return more rows than the task needs, or a field the agent should not see. Scope is part of the tool: one workspace, the roles that workspace already enforces, and a limit. The tool does not add a second, quieter permission model beside the product's own.
Reads do not require the same approval click as writes. If they did, nobody would use the tool, and the agent would start asking for broader writes to avoid the click. The distinction has to be real: a read returns data, a write returns a preview and waits.
Failure should leave the record alone
If validation fails, nothing is written. If the approval is missing, nothing is written. If the write fails halfway through a single record, the tool reports the error and does not mark the call successful. I do not invent a compensating call from the model. Compensation is another write, and it needs its own preview.
The flight recorder, when it is in the path, stores the preview and the decision. That is the audit. The MCP response the model sees is smaller: approved, rejected, or failed, plus the error message. The model does not need the reviewer's notes to continue, and it should not be given a way to approve its own preview.
What this does not guarantee
An approval flow does not make the model correct. A person can approve a bad change. The point of the preview is that the person can see the change, not that the system has judged it. I also do not treat a tool description as a security boundary. The server checks the contract. The description is only how the model chooses the tool.
The preview should be produced by the same code that would perform the write, up to the point of the write. A separate summary path drifts. The summary can name a field the writer never touches, and a reviewer can approve the sentence while the write changes a different column. One function builds the diff. Approval stores the diff. The write applies that diff or refuses.