Skip to content

[Bug]: (Claude Code) docs-researcher inherits the Agent tool and recursively spawned 100+ subagents — the run never terminated #2790

Description

@kotarotaniguchi0523

MCP Client

Claude Code

Context7 MCP Version

3.2.1

Bug Description

The Claude Code plugin's bundled agent plugins/claude/context7/agents/docs-researcher.md has no tools: field in its frontmatter. In Claude Code, omitting tools: makes the subagent inherit all tools, including the Agent/Task tool that spawns further subagents.

Because docs-researcher held that tool, it spawned subagents recursively (subagents spawning more subagents). The count grew past 100 and the run did not terminate on its own. It only stopped because I force-powered-off the machine. (As a result of the hard shutdown, the runaway session's transcript was not fully flushed to disk, so the recursion is only partially recoverable from logs — it was observed live.)

Steps to Reproduce

  1. Add the marketplace: claude plugin marketplace add upstash/context7
  2. Install the plugin: claude plugin install context7@context7-marketplace (this installs and enables the context7 Claude Code plugin)
  3. ask claude code to search library by using context7 and Invoke the docs-researcher agent for a documentation lookup.
  4. The agent, having inherited the Agent tool, begins spawning subagents, which in turn spawn further subagents.
  5. The subagent count climbs past 100 and the run does not stop on its own.

Expected Behavior

docs-researcher fetches documentation via the two Context7 tools and returns a single answer.
It should not be able to spawn subagents at all.

Actual Behavior

The agent recursively spawned subagents, the count exceeded 100, and the run never terminated on its own — I had to force-power-off the machine to stop it.

Error Messages / Logs

Transport Method

http

Node.js Version

v24.13.0

Operating System

Windows11, Ubuntu 24.04.4 LTS(WSL2)

Configuration

Additional Context

Root cause is the missing tools: allowlist. The fix is to restrict the agent to only the two
tools it uses, which removes the Agent/Task tool and makes recursive spawning structurally
impossible.

Diff for plugins/claude/context7/agents/docs-researcher.md:

 ---
 name: docs-researcher
 description: Lightweight agent for fetching library documentation without cluttering your main conversation context.
 model: sonnet
+tools:
+  - mcp__context7__resolve-library-id
+  - mcp__context7__query-docs
 ---

(Tool identifiers are the two Context7 MCP tools; adjust the prefix to match the plugin's MCP server namespacing if needed.) For comparison, other Claude Code plugins (e.g. feature-dev) already ship agents with explicit tools: allowlists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions