[Bug] Subagents unable to write files and call MCP tools silently
Bug Description
Bug Report: Subagents Cannot Write Files or Call MCP Tools (Silent Failures)
Summary
Subagents spawned via the Task tool have lost the ability to write files and call MCP tools. These failures are silent - the subagent believes the operation succeeded, but nothing actually happens. The main conversation agent can perform these operations successfully.
Environment
OS: macOS (Darwin 24.6.0)
Claude Code Version: 2.0.68
Date Issue Started: December 12-13, 2025 (overnight)
Reproduction Steps
Issue 1: Write Tool Silent Failure
Start a conversation with Claude Code
Spawn a background subagent:
Task tool with:
- subagent_type: "general-purpose"
- run_in_background: true
- prompt: "Create a file at ./test-subagent-write.md with the content 'Hello World'"
Wait for subagent to complete
Check if file exists: ls -la ./test-subagent-write.md
Expected: File is created
Actual: File does NOT exist, but subagent reports success
Issue 2: MCP Tool Call Failure
Create a subagent with MCP tools in its tools list:
tools:
- Read
- mcp__some-server__some_tool
Spawn the subagent via Task tool
Instruct it to call the MCP tool
Expected: MCP tool is called
Actual: Subagent fails to call MCP tool (may skip it or error)
Workaround
For Write tool: Have subagents return content to main agent, which then writes files.
For MCP tools: No known workaround - must use main agent directly.
Additional Notes
This appears to be a regression - both features worked before December 12-13, 2025
Failures are silent making debugging extremely difficult
Affects both run_in_background: true and potentially foreground subagents
May be related to sandboxing/permission changes in a recent Claude Code update
Environment Info
- Platform: darwin
- Terminal: ghostty
- Version: 2.0.68
- Feedback ID: fe203b0c-8eee-4427-9ec0-4a00cbf9b2a2
13 Comments
Seeing the same issue. Synchronous agents work fine. Asynchronous (background) agents cannot call MCP tools, even when they are explicitly defined as available in the agents definition, and available in the parent. I have had to resort to using synchronous agents only.
A. Subagents Write bug:
B. MCP tool usage via subagents:
YOU HAVE DIRECT ACCESS TO MCP TOOLS
Direct MCP Tool Calls
mcp__context7__resolve-library-id(libraryName="pandas")
IMPORTANT: PREREQUISITE: YOUR claude.json will need to have the configuration for the MCP SERVER (API KEY, TYPE, URL, etc.)
I had this problem with one of my agents and it was because Claude put complex code-fenced, unescaped, markdown into the agent file. I think the subagent barfed on it when it started up. It couldn't read or write but it thought it could and it hallucinated the contents of files based on their names.
I fixed it by using nested markdown.
Before:
````markdown
example code in a code-fenced block
And/or bad frontmatter -- had to fix that as well
Have you guys revised this after the v.2.1.0?
Not yet. Just using the Workarounds (A + B)..
How do we tag someone at Anthropic for visibility - this really breaks background subagents. The bash workaround doesn't cover many use cases.
The Workaround That Works for Me
I've been experiencing the same issue with subagents not being able to write files or call MCP tools. After extensive testing, I found a workaround that completely solves both problems.
Environment:
---
Root Cause I Discovered
When I had the
tools:field in my agent.md YAML frontmatter:/agentsinterface couldn't expand the tool listThrough systematic testing, I discovered:
tools:field → Explicit mode → MCP tools unavailable ❌tools:field → Implicit mode → All tools available ✅---
My Workaround Solution
Why This Works (The Technical Explanation)
Claude Code has two tool access modes:
tools:field exists in agent.md):tools:fieldmcp__jira__jira_getin thetools:field, Claude Code doesn't see/load those MCP toolstools:field acts as a runtime restriction that locks the tool registry to only non-MCP toolstools:field is absent):The key insight: The
tools:field isn't just documentation - it's a runtime enforcement mechanism that creates a sandboxed tool environment. But this sandboxing breaks MCP tool access for subagents (likely a bug in how MCP connections are passed to subprocesses).By removing the
tools:field, we opt out of the sandboxing and get full tool access.Three-Part Fix
tools:field from agent.md → Switches to implicit mode → MCP tools accessibleallowed-tools:in SKILL.md frontmatter → Documents which tools agent should use (for permissions bypass)Architecture
---
Implementation Steps
Step 1: Update agent.md
Before:
After:
Step 2: Update SKILL.md Frontmatter
Ensure
allowed-tools:is complete:Step 3: Add Tool Gate to SKILL.md Body
Add after frontmatter, before main procedure:
Step 4: Restart Claude Code
Changes to agent.md require Claude Code restart to take effect.
---
My Test Results
Here's what I tested to confirm this works:
| Agent | Test | Tool | In allowed-tools? | Result |
|-------|------|------|------------------|--------|
| Integrator | 1 |
mcp__jira__jira_get| ✅ Yes | ✅ Called successfully || Integrator | 2 |
Edit| ❌ No | ✅ BLOCKED with TOOL_REQUEST || Strategist | 1 |
mcp__fliplet-knowledge__search_fliplet_docs| ✅ Yes | ✅ Called successfully || Analyst | 1 |
mcp__jira__jira_get| ✅ Yes | ✅ Called successfully || Analyst | 2 |
Bash| ❌ No | ✅ BLOCKED with TOOL_REQUEST || Analyst | 3 |
Write(file creation) | ✅ Yes | ✅ File created successfully |Key Findings
---
How It Works
Implicit Mode vs Explicit Mode
| Mode | Trigger | Tool Availability | MCP Works? | Write Works? |
|------|---------|------------------|------------|--------------|
| Explicit |
tools:field present | Only listed tools | ❌ No | ❌ No || Implicit |
tools:field absent | All available tools | ✅ Yes | ✅ Yes |Tool Gate Mechanism
The Tool Gate is procedural enforcement, not runtime restriction:
allowed-tools:): Bypasses permission promptsFlow:
---
Benefits
allowed-tools:in SKILL.md)---
Limitations
---
Rollout Checklist
For each agent:
tools:field from.claude/agents/<agent>.mdallowed-tools:in.claude/skills/<agent>/SKILL.mdis complete---
Example: Complete Integrator Setup
.claude/agents/integrator.md.claude/skills/integrator/SKILL.md---
TL;DR
The Fix:
tools:field from.claude/agents/<agent>.mdfilesallowed-tools:in.claude/skills/<agent>/SKILL.mdfrontmatterWhy it works:
tools:field = implicit mode = all tools available (including MCP!)Tested successfully with:
Hope this helps anyone else hitting this issue! Happy to answer questions.
---
When Claude Code Fixes the Issue
Once the official fix is released:
tools:back to agent.md (copying from SKILL.mdallowed-tools:)The workaround is non-destructive and can coexist with future fixes.
Additional context: orchestrator perspective in multi-agent workflows
I'm hitting this same issue from the orchestrator side, using a multi-agent workflow where a parent Claude instance spawns Developer and Reviewer subagents via the Task tool.
What I observe
Tasktool (subagent_type: "general-purpose")WriteorBashcall"error - tool result missing due to internal error"to the orchestratorEvidence of duplicates
In a single session orchestrating 4 sequential steps with Developer + Reviewer agents, the system-reminder task notifications showed:
| Task ID | Description | Status |
|---------|-------------|--------|
|
ac14376| Developer implements step 01 | completed ||
abce028| Developer implements step 02 | completed ||
ad3604b| Developer implements step 02 | completed ||
af0ac3c| Reviewer reviews step 02 | completed ||
a81f48c| Reviewer reviews step 02 | completed ||
a17ffd5| Developer commits step 02 | completed |Two Developer agents and two Reviewer agents for the same step. Both pairs ran concurrently and wrote to the same files, producing duplicate content that required a fixup commit.
Escape key interaction
Hitting Escape during the apparent hang seems to free blocked agents — suggesting the subagent is stuck on a permission prompt that has no UI path to the user. Escape likely cancels or denies the prompt, allowing the agent to continue (with the tool call denied).
Impact in orchestrated workflows
In a single-agent workflow, this is annoying but manageable. In a multi-agent orchestration managing 15-20 agent spawns across a flight:
Workaround
Same as described in this issue — have the orchestrator write files directly instead of subagents. But this defeats the purpose of the separation between orchestrator and executor roles.
Environment
Related
It would be REALLY nice if this bug got fixed by Anthropic. This is a huge issue. I should be able to designate that an agent can use
WRITEorBASHand regardless that it's a background agent, it should be able to use those tools.I am facing the same issue now, subagents that run in background is not able to use the Write tool. When I checked the logs this is what I see "Permission to use Write has been denied....". However the same subagent works well when run_in_background is false.
Any leads will be really helpful for me. Thank you!!!
I am facing the same issue now, subagents that run in background is not able to use the Write tool. When I checked the logs this is what I see "Permission to use Write has been denied....". However the same subagent works well when run_in_background is false.
Any leads will be really helpful for me. Thank you!!!
Similar issue (Claude Code CLI v2.1.81 on macOS):