[BUG] Agent tool accepts invalid subagent_type without validation error
Description
When the Agent tool is called with an unrecognized subagent_type value — for
example, a plugin skill name instead of a registered agent type — the tool fails
without a clear, actionable error message. There is no validation that tells the model
which subagent_type values are valid.
Steps to Reproduce
- Install a Claude Code plugin that contains both skills and agents.
- Invoke a skill via the
Skilltool to load its instructions. - The model, following the loaded skill instructions, passes the skill name as
subagent_type to the Agent tool:
\\\json\
{ "subagent_type": "my-plugin:some-skill", ... }
\\
- The call fails — but without an error that names which
subagent_typevalues are
actually registered.
Expected Behavior
The Agent tool should validate subagent_type at call time and, on an unrecognized
value, return a clear error listing valid agent types, e.g.:
Unknown subagent_type "my-plugin:some-skill". Registered agents for this plugin are: my-plugin:agent-one, my-plugin:agent-two.
Actual Behavior
The call fails ambiguously. The model has no signal to self-correct, and the user has
to diagnose why the agent wasn't invoked.
Why It Matters
Skills and agents are structurally different: skills are loaded inline via the Skill
tool; agents are subprocesses invoked via the Agent tool. A model that just loaded a
skill has its name in context and can reasonably but incorrectly pass it assubagent_type. Validation at the tool boundary would make this mistake self-correcting
without requiring documentation workarounds.
Environment
- Claude Code version: latest
- Plugin: custom plugin with mixed skills and agents
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗