# How should an instance reconcile MCP tool-level authorization scopes when a single agent turn fans out across tools whose declared capability sets overlap but whose enforcement boundaries are disjoint **Date of Record:** 2026 November 29 **Scope:** Applies to MCP client instances dispatching a single reasoning turn across two or more tools whose server-side authorization scopes partially overlap (e.g., a `read_file` tool scoped to `/data/**` and a `search_index` tool scoped to `/data/public/**`). Does not apply to single-tool turns, to tools behind a shared enforcement gateway, or to purely capability-negotiation failures at handshake time. ## Core Distinction The failure is not "the agent called a tool it lacked permission for." It is subtler: **the agent composed a multi-tool plan whose per-tool scopes were each individually satisfied, but whose union produced a read the operator never authorized.** Each MCP server enforces its own scope in isolation and reports `allowed: true`. The agent's planner, reading those per-tool grants as a set, treats the union as a single capability envelope. The invariant that breaks is implicit and almost never stated in an MCP tool manifest: > *Per-tool least-privilege is not compositional. The grant for tool A does not constrain the arguments the agent may pass to tool B, even when both tools address the same resource namespace.* A `read_file` tool scoped to `/data/**` and an `extract_metadata` tool scoped to `/data/public/**` each enforce correctly. But if the agent first enumerates paths via `read_file` (permitted for `/data/private/x`), then passes a derived path to `extract_metadata`, the second server sees a path inside its own scope and allows it — the leak is in the *derivation chain*, not in either enforcement point. ## What Was Observed A planner instance was tasked with "summarize the public subset of the dataset directory." The turn fanned out as: 1. `list_dir` with scope `/data/**` → returned both `public/` and `private/` entries. Allowed. 2. `read_file` on `/data/private/manifest.json` to "understand the schema before summarizing." Allowed — `/data/**` covers it. 3. `extract_metadata` on `/data/public/summary.json`, but the *arguments* to step 3 were constructed from field names discovered in step 2's private manifest. Allowed — path is in scope. Every server logged `authorization: granted`. The audit trail showed three green checks. Yet the summary emitted to the user contained column names and a row count that only exist in the private manifest. The leak was a **cross-tool argument-flow violation**: the sensitive datum entered the agent's context at step 2 and was *re-emitted* through a tool call whose own scope was clean. No single server could observe the violation because no server sees the agent's context — only its own arguments. The same class manifests three ways in practice: - **Path derivation:** tool A returns a path or ID; tool B accepts it under a looser scope. - **Content laundering:** tool A returns a secret; the agent embeds it in a query to tool B (a search tool, a summarizer) whose scope would have rejected the raw secret. - **Capability chaining:** tool A (`sql_query` scoped to one schema) returns a foreign key; tool B (`fetch_record` scoped to a different schema) resolves it, and the agent stitches a join the operator never granted. ## Condition of Validity The per-tool isolation model is sound **iff** the agent's use of tool outputs is confined to the scope of the tool that produced them. Formally: if tool *T* has scope *S_T*, then any argument passed to any tool *U* that is *derived from* an output of *T* must satisfy *S_T ∩ S_U*, not merely *S_U*. The standard MCP manifest declares *S_T* but does not declare the taint relationship between *T*'s outputs and *U*'s inputs, so the client has no machine-readable basis to enforce the intersection. The model also fails silently when scopes are expressed as prefix/glob predicates over a shared namespace but the tools' *semantic* domains differ. `/data/**` and `/data/public/**` are comparable strings; `schema:analytics` and `schema:public` are not, even though both are "the same database." String-prefix scope comparison across heterogeneous namespaces produces false "disjoint" conclusions, which is exactly the condition under which the planner feels safe to chain. ## Decision Boundary The client instance must draw a hard line: **a tool call is only admissible if every argument's provenance is within the intersection of the producing tool's scope and the consuming tool's scope.** When provenance cannot be established (the agent synthesized the argument from its own reasoning over multiple tool outputs), the call must be treated as out-of-scope by default unless an explicit, declared taint-widening grant covers the pair. Concretely, the boundary is crossed when: - The argument to tool *U* was *copied* from an output of tool *T*, and *S_T ⊄ S_U* (the producing scope is not a subset of the consuming scope). - The argument was *transformed* (concatenated, parsed, embedded) from a *T* output, which defeats naive string-equality taint checks — the client must propagate taint through the transformation, not just the literal. - The planner's own context contains a datum from *T* and the planner emits it inside *U*'s arguments, regardless of whether the planner "intended" to. Below the boundary: arguments derived solely from *U*'s own prior outputs, or from the user's original request, or from tools whose scope is a superset of *U*'s. Above the boundary: everything else, which must be refused or escalated to an explicit widening warrant. ## Operational Effect Enforcing the intersection invariant changes agent behavior in three observable ways. First, planners must carry provenance metadata alongside every value in their working context — a taint tag per datum — which raises context cost and forces the client to instrument tool-result ingestion, not just tool-call emission. Second, legitimate cross-tool workflows (the common case: read a config, use a value from it to query a service) now require the operator to declare the pair `(T, U)` as an authorized taint path, which is the correct place for that decision — with the operator, not the planner. Third, the failure mode shifts from *silent leak* to *loud refusal*: the agent will surface `ScopeIntersectionViolation` mid-turn, which is recoverable, whereas the leak was not. The guardrail is a client-side taint-tracking layer wrapping the MCP dispatch loop: tag every tool output with its producing scope, propagate tags through the planner's string operations, and reject any tool call whose arguments carry a tag from a scope not contained in the target tool's scope. The server-side scopes remain unchanged and correct; the missing enforcement was never the server's to provide, because the server cannot see the agent's context. This is the invariant the MCP spec leaves implicit and that every multi-tool agent must implement for itself. ```python from dataclasses import dataclass, field from typing import Any class ScopeIntersectionViolation(RuntimeError): """Raised when a tool argument's provenance scope is not contained within the target tool's declared authorization scope.""" pass @dataclass class TaintTag: scope: str # e.g. "/data/**" or "schema:analytics" source_tool: str @dataclass class TaintedValue: value: Any tags: list[TaintTag] = field(default_factory=list) def scope_contains(outer: str, inner: str) -> bool: """Prefix/glob containment. Real impls must handle glob semantics; this is the minimal predicate the invariant depends on.""" if outer.endswith("/**"): return inner.startswith(outer[:-3]) return outer == inner def authorize_argument(arg: TaintedValue, target_scope: str, target_tool: str) -> None: for tag in arg.tags: if not scope_contains(target_scope, tag.scope): raise ScopeIntersectionViolation( f"tool '{target_tool}' (scope={target_scope}) received argument " f"tainted by '{tag.source_tool}' (scope={tag.scope}); " f"{tag.scope} is not a subset of {target_scope} — cross-tool " f"argument-flow leak blocked. Operator must declare an explicit " f"taint-widening grant for ({tag.source_tool} -> {target_tool})." ) def dispatch(tool: str, target_scope: str, args: dict[str, TaintedValue]) -> Any: for name, arg in args.items(): authorize_argument(arg, target_scope, tool) # ... actual MCP call ... return None ```