Skip to content
Agent Engineering / Tool Use

Give each sub-agent only the tools and MCP servers its role needs

  • BP-0062
  • v1.0.0
  • draft
  • guideline
  • role: orchestrator
  • role: implementer
  • stage: plan
  • stage: build
  • updated 2026-11-24
  • reviewed 2026-11-24
  • next review 2027-05-24

A sub-agent with every tool its parent has is a second copy of the parent’s blast radius, running with less oversight. In Claude Code, for example, a sub-agent with no tools list inherits the built-in and MCP tools of the main conversation (minus a few interactive ones). The fix is the same in any framework: decide per role what the agent may touch, and configure it.

  1. MUST give every sub-agent definition an explicit tool allowlist. Do not rely on inheritance.

  2. SHOULD start from a role matrix and widen only with a reason:

    Role Tools MCP Not
    Explorer / researcher Read, search, read-only shell or web fetch Code index, docs search Edit, write, deploy, send
    Implementer Read, edit, write, run tests and build Code index; issue tracker read Deploy, push to protected branches, send messages
    Reviewer Read, search, run tests Code index Edit (it reports; the implementer fixes)
    Operator (rare) Narrow, named commands or wrapper scripts Only the server for the system it operates Anything else; always with approval
  3. MUST keep tools with side effects outside the workspace (deploy, send, pay, delete, write to production systems) to the roles that need them, behind approval (BP-0032).

  1. MUST attach MCP servers to the sub-agents that need them, not to everything: allow one server’s tools by name, and withhold all MCP tools from roles that need none.
  2. SHOULD define a server only on the sub-agent that uses it when the main conversation does not need it. In Claude Code an inline server is connected when that sub-agent starts and disconnected when it finishes, keeping it out of the main conversation’s context.
  3. SHOULD give a sub-agent’s MCP server narrower credentials than the parent’s where the server supports it (a read-only token for an explorer’s issue-tracker server, for example) (BP-0023).
  4. SHOULD prefer a narrow wrapper script to a broad MCP server when the sub-agent needs only a few operations (BP-0055).
  1. MUST NOT rely on a sub-agent’s own permission mode for safety. In Claude Code, when the main conversation runs in bypass, accept-edits or auto mode, the sub-agent runs in that mode and its own setting is ignored. Use tool allowlists, deny rules and hooks, which apply regardless (BP-0021).
  2. SHOULD scope guardrail hooks to the sub-agent that needs them (for example, block writes outside its worktree).
  3. SHOULD limit spawning: remove the agent-spawning tool from workers that should not delegate, and keep nesting shallow. Claude Code allows three levels below the main conversation by default and can be set lower.
  4. SHOULD cap turns per sub-agent, and give writing sub-agents their own worktree (BP-0035).
  5. SHOULD control skills explicitly: preloading a skill is not the same as limiting access; remove the skill tool from roles that must not use skills.
  1. MUST keep sub-agent definitions in version control and review tool-list changes like permission changes.
  2. SHOULD test the limits: ask each sub-agent to do something outside its role (edit a file, call an unlisted server) and confirm it cannot.

Defining sub-agents or agent roles in any framework; adding an MCP server; reviewing an orchestrator-worker setup (BP-0042).

Claude Code sub-agent definitions (.claude/agents/*.md):

---
# author: Stephen Eaton
name: explorer
description: Read-only codebase and issue search. Returns paths and short findings.
tools: Read, Grep, Glob, mcp__codeindex__*
disallowedTools: Agent, Skill
model: haiku
effort: low
maxTurns: 20
---
---
# author: Stephen Eaton
name: implementer
description: Implements one planned unit test-first in its own worktree.
tools: Read, Grep, Glob, Edit, Write, Bash
disallowedTools: Agent, mcp__*
isolation: worktree
model: sonnet
effort: medium
---
---
# author: Stephen Eaton
name: ui-checker
description: Drives the app in a browser and captures screenshots against the approved mockup.
tools: Read, mcp__playwright__*
mcpServers:
- playwright: # inline: only this sub-agent connects to it
type: stdio
command: npx
args: ["-y", "@playwright/mcp@latest"]
---

Claude Code applies disallowedTools first, then resolves tools against what is left; a tool in both is removed.

  • Sub-agents with no tool list, inheriting every MCP server the parent has.
  • A reviewer that can edit the code it reviews.
  • Every MCP server configured globally “in case a sub-agent needs it”.
  • Counting on a sub-agent’s permissionMode while the parent runs in bypass mode.
  • Workers spawning workers spawning workers.
  • Explicit tool allowlist on every sub-agent; role matrix written down
  • Side-effect tools only where needed, with approval
  • MCP servers attached per sub-agent; narrower credentials where possible
  • Enforcement via tool lists, deny rules and hooks, not the sub-agent’s permission mode
  • Spawning depth and turns limited; writers isolated
  • Definitions versioned and reviewed; limits tested