Route MCP tool calls through shared approval handling (#38108)

## What changed

- Represent MCP tool calls as approval actions and route them through the
  session-level approval flow for permission hooks, reviewer selection,
  rejection handling, and resolution telemetry.
- Preserve MCP-specific user prompts, session and persistent approval choices,
  and the approval policy and reviewer captured for the tool call.

## Testing

- Add coverage for permission hooks resolving MCP calls before user or
  automatic review, persistence choices, captured policy routing, and MCP turn
  metadata with strict automatic review enabled.

GitOrigin-RevId: 8e134b3d17a19dc62b3b56076d2cd05a54c9f638
This commit is contained in:
Dylan Hurd authored and copyberry committed 2026-08-12 03:00:47 +00:00
1 parent eb9dceba1a
commit 2230d64464
7 files changed
+618 -130

No files matched your search

+3 -2
View File
@@ -166,6 +166,7 @@ impl McpHandler {
session,
step_context,
call_id,
tool_name,
payload,
..
} = invocation;
@@ -185,9 +186,9 @@ impl McpHandler {
Arc::clone(&session),
&step_context,
call_id.clone(),
self.tool_info.server_name.clone(),
self.tool_info.tool.name.to_string(),
&self.tool_info,
self.hook_tool_name(),
tool_name,
payload,
)
.await;