[BUG] Task tool subagents fail to access MCP tools with complex prompts
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Body:
## Description
Subagents spawned via the Task tool have inconsistent access to MCP tools. Simple, direct prompts successfully access
MCP tools, but complex multi-step prompts result in the subagent claiming tools are unavailable - even though the same
tools work in the parent session.
## Environment
- Claude Code version: (run
claude --version) - OS: Windows 10/11 (MSYS_NT)
- MCP Server: Custom Python server using HTTP streamable transport at local URL
## mcp.json Configuration
```json
{
"mcpServers": {
"shared-memory": {
"url": "http://192.168.15.240:8080/mcp"
}
}
}
Workaround
Start subagent with simple prompt, then use resume parameter for complex work.
Possibly Related Issues
- #2169 - MCP resources not available for subagents
- #5465 - Task subagents fail to inherit permissions in MCP server mode
- #10708 - Tool names must be unique error with MCP servers
Additional Context
The parent Claude session has full MCP access and can call all memory_* tools successfully. The issue only manifests
in Task-spawned subagents with longer/complex prompts.
What Should Happen?
Expected Behavior
Subagents should have consistent access to MCP tools regardless of prompt complexity. The tools field is omitted, so
per documentation, all tools including MCP should be inherited.
Actual Behavior
- Simple prompts: MCP tools recognized and callable
- Complex prompts: Subagent claims MCP tools don't exist
- Resumed sessions: MCP tools work again
Error Messages/Logs
Steps to Reproduce
Case 1: Simple prompt - WORKS ✅
Task(
description="Test MCP access",
prompt="Call mcp__shared-memory__memory_start_session with project='nimbus', claude_instance='test'",
subagent_type="general-purpose"
)
Result: Successfully calls MCP tool, returns session ID and data.
Case 2: Complex prompt - FAILS ❌
Task(
description="Store schema in MCP",
prompt=`You are frames-team. Complete these steps:
- Call mcp__shared-memory__memory_start_session(project="nimbus", claude_instance="frames-team")
- Read C:\\path\\to\\file.java
- Call mcp__shared-memory__memory_store(session_id=..., title="...", content="...", memory_type="interface")
- Call mcp__shared-memory__memory_end_session(session_id=..., summary="...")`,
subagent_type="general-purpose"
)
Result: Subagent responds: "The MCP memory functions are not available in my current toolset" and attempts to use Bash
commands instead.
Case 3: Resume workaround - WORKS ✅
// First call - simple
result1 = Task(prompt="Call mcp__shared-memory__memory_start_session...", ...)
// Returns agentId
// Second call - resume with complex work
result2 = Task(prompt="Now complete steps 2-4...", resume=agentId, ...)
// Successfully uses MCP tools
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
4.5
Claude Code Version
2.0.72
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
- Model: claude-opus-4-5-20251101 (Opus 4.5)
- OS: Windows 10/11 (MSYS_NT)
- MCP Server: Custom Python server using HTTP streamable transport
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗