Generative AI & Agentic AIMCP and integration contracts

Design an approval-required write tool

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 2 min read
Technically reviewed by Ishaan Sharma
In this article (5 sections)

A write tool should not treat a generated call as authorization. Separate proposal, approval and execution, and invalidate approval when material arguments change.

Bind to a digest

The MCP contract lab hashes a synthetic ticket proposal.

python
from mcp_cases import write_approval_case

result = write_approval_case()
assert result["original_authorized"] is True
assert result["changed_authorized"] is False
assert result["external_write_executed"] is False
assert len(result["digest"]) == 64

Changing the summary produces a new digest and invalidates approval. The lab never creates a ticket.

Specify the full action

The proposal contains tool/version, target, material arguments, expected impact, evidence, idempotency key and expiry. The reviewer sees a human-readable diff and authenticates. The server records reviewer, role, time and digest.

At execution, revalidate identity, approval, preconditions and rate limits. Use least-privilege credentials and save a receipt. For high-impact actions, require stronger or multiple approvals.

Test races and retries

Cover changed inputs, expired/revoked approval, duplicate execution, cancellation and uncertain timeout. Retrieved content or another agent cannot approve the call.

The Generative & Agentic AI course connects approval-required MCP tools to durable agent state and audits.

Exercise

Implement a local write simulator with proposal digest, approval expiry and idempotency. Attempt four stale/tampered cases and prove one approved side effect.

Continue learning

This article is part of the MCP and integration contracts sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

Reference: NIST AI RMF playbook.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Generative & Agentic AI programme — 3 months. Add practical GenAI, retrieval and agent-building skills to your existing toolkit.

Explore Generative & Agentic AI
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.