claude-code - 💡(How to fix) Fix Agent tool not available at runtime for plugin-defined agent types despite tools: frontmatter declaration [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47898Fetched 2026-04-15 06:39:11
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
1
Timeline (top)
labeled ×4commented ×1cross-referenced ×1

Plugin-defined agent types that declare Agent in their tools: frontmatter do not receive the Agent tool at runtime when dispatched via subagent_type. The tool is listed in the system prompt's tool summary but is not actually available for the agent to call.

Root Cause

Plugin-defined agent types that declare Agent in their tools: frontmatter do not receive the Agent tool at runtime when dispatched via subagent_type. The tool is listed in the system prompt's tool summary but is not actually available for the agent to call.

Fix Action

Workaround

Dispatch managers as general-purpose agents with inlined instructions instead of using subagent_type:

Agent({
  description: "Research domain",
  model: "opus",
  prompt: "<full manager instructions inlined here>"
})

This works but defeats the purpose of plugin agent definitions.

Code Example

---
name: research-manager
tools: Read, Grep, Glob, Bash, Write, Agent, mcp__plugin_goodmem_goodmem__goodmem_memories_retrieve
model: opus
---

---

Agent({
  description: "Research domain",
  subagent_type: "deep-research:research-manager",
  prompt: "..."
})

---

Agent({
  subagent_type: "deep-research:data-collector",
  model: "sonnet",
  prompt: "..."
})

---

Agent({
  description: "Research domain",
  model: "opus",
  prompt: "<full manager instructions inlined here>"
})
RAW_BUFFERClick to expand / collapse

Description

Plugin-defined agent types that declare Agent in their tools: frontmatter do not receive the Agent tool at runtime when dispatched via subagent_type. The tool is listed in the system prompt's tool summary but is not actually available for the agent to call.

Reproduction

Plugin agent definition (agents/research-manager.md):

---
name: research-manager
tools: Read, Grep, Glob, Bash, Write, Agent, mcp__plugin_goodmem_goodmem__goodmem_memories_retrieve
model: opus
---

Dispatch from orchestrator:

Agent({
  description: "Research domain",
  subagent_type: "deep-research:research-manager",
  prompt: "..."
})

Expected behavior

The research-manager agent should have the Agent tool available and be able to dispatch sub-agents:

Agent({
  subagent_type: "deep-research:data-collector",
  model: "sonnet",
  prompt: "..."
})

Actual behavior

The agent reports: "Agent tool for data-collector dispatch was not available in my tool set"

The system prompt shows (Tools: Read, Grep, Glob, Bash, Write, Agent, ...) but the Agent tool is not callable at runtime. The agent falls back to using whatever tools it does have (goodmem, WebSearch if available) instead of dispatching sub-agents.

Evidence

Across 5+ dispatch attempts with the same plugin:

Attemptsubagent_type used?Agent tool declared?Agent tool available at runtime?Collectors dispatched?
1Yes (deep-research:research-manager)YesNo0 — "Agent/Task tool was not in this manager's available tool set"
2YesYesNo0 — used WebSearch directly instead
3YesYes (WebSearch removed to force delegation)No0 — used goodmem as substitute
4YesYesNo0 — "Agent tool for data-collector dispatch was not available"
5No (general-purpose)N/A (inherits all)YesN/A — general-purpose agents always have Agent tool

When dispatched as a general-purpose agent (no subagent_type), the Agent tool is available and works correctly. The issue is specific to plugin-defined agent types via subagent_type.

Workaround

Dispatch managers as general-purpose agents with inlined instructions instead of using subagent_type:

Agent({
  description: "Research domain",
  model: "opus",
  prompt: "<full manager instructions inlined here>"
})

This works but defeats the purpose of plugin agent definitions.

Environment

  • Claude Code version: latest (April 2026)
  • OS: macOS
  • Plugin location: ~/Claude/plugins/deep-research/
  • Agent definitions use standard .md frontmatter format in agents/ directory

Impact

This blocks any plugin architecture that relies on hierarchical agent dispatch (manager → worker pattern). The only workaround is abandoning subagent_type entirely and inlining all agent instructions in the prompt, which makes plugin agent definitions dead code.

extent analysis

TL;DR

The Agent tool is not available at runtime for plugin-defined agent types dispatched via subagent_type, despite being declared in the tools: frontmatter.

Guidance

  • Verify that the Agent tool is correctly declared in the plugin agent definition's tools: frontmatter, as shown in the research-manager.md example.
  • Check if the issue persists when dispatching the agent without using subagent_type, as the Agent tool is available in this case.
  • Consider using the provided workaround of dispatching managers as general-purpose agents with inlined instructions, although this may not be ideal for plugin architecture.
  • Review the plugin agent definition and dispatch code to ensure that there are no typos or inconsistencies in the subagent_type or tools: declarations.

Example

No code snippet is provided as the issue seems to be related to the plugin architecture and dispatch mechanism rather than a specific code error.

Notes

The issue appears to be specific to plugin-defined agent types dispatched via subagent_type and may be related to how the Agent tool is made available at runtime. Further investigation into the plugin architecture and dispatch mechanism may be necessary to resolve the issue.

Recommendation

Apply the workaround of dispatching managers as general-purpose agents with inlined instructions, as this is the only known solution that allows the Agent tool to be available at runtime, although it may not be ideal for plugin architecture.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The research-manager agent should have the Agent tool available and be able to dispatch sub-agents:

Agent({
  subagent_type: "deep-research:data-collector",
  model: "sonnet",
  prompt: "..."
})

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING