review
Show me the diff before merge
Problem
Your agent has generated a patch — a refactor, a dependency update, a schema change. Before it commits or opens a PR, you want to review the diff properly: syntax-highlighted, with the ability to leave inline comments and either approve or request changes.
The MCP call
import subprocess
diff = subprocess.check_output(
['git', 'diff', '--staged'],
text=True,
)
handle = request_review(
diff=diff,
title='Refactor: extract billing module',
base_ref='main',
head_ref='feat/billing-extract',
context_md='Extracted 3 functions. All tests pass. No behaviour change.',
require='approve',
ttl_minutes=1440, # 24 hours
)
print(f'Review at: {handle["web_url"]}')
result = await_decision(handle['review_id'], timeout_s=86400)
if result['outcome'] == 'approved':
subprocess.run(['git', 'commit', '-m', 'refactor: extract billing module'])
What you get back
You get a push notification with the review link. You open the syntax-highlighted diff, leave inline comments on any lines you want to discuss, add an overall remark, and click Approve or Request changes. The agent unblocks with the outcome.
Follow-up calls
After you request changes, the agent can amend the diff and call request_review again — include context_md='Addressed your comments on lines 24 and 31.' so you know what changed.
Notes
This is for agent-generated patches and local changes, not GitHub PRs. For GitHub PR reviews, use GitHub's native review interface.