Skip to content

Commit ed2c856

Browse files
nhortonclaude
andcommitted
fix(reviewer): enumerate MCP tools explicitly instead of wildcards
The reviewer subagent's `tools:` frontmatter used `mcp__deepwork-dev__*` and `mcp__plugin_deepwork_deepwork__*` wildcards. Runtime observation (PR #390 e2e merge-queue run): the wildcards are accepted at parse time but do not reliably match deferred MCP tools when the subagent tries to invoke them — the runtime responds with `Error: No such tool available: mcp__deepwork-dev__mark_review_as_passed` even though the parent agent could call other tools from the same MCP server. Replace the wildcards with the single MCP tool the reviewer actually uses (`mark_review_as_passed`) under both prefixes. Also add a root `.deepreview` rule `agent_tools_fully_qualified` that flags any Claude Code agent definition file (`**/agents/*.md`) whose `tools:` frontmatter contains a wildcard, so the same footgun cannot regress. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7332b2d commit ed2c856

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

.deepreview

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,52 @@ update_learning_agents_architecture:
287287
additional_context:
288288
unchanged_matching_files: true
289289

290+
agent_tools_fully_qualified:
291+
description: "Claude Code agent definition files must list every tool by fully-qualified name, never by wildcard."
292+
match:
293+
include:
294+
- "**/agents/*.md"
295+
review:
296+
strategy: individual
297+
instructions: |
298+
This file defines a Claude Code subagent (the YAML frontmatter at the
299+
top of the file configures the agent's name, description, model, and
300+
tool grants). Check the `tools:` frontmatter field.
301+
302+
Rule: every tool entry MUST be a fully-qualified tool name. Wildcard
303+
or glob patterns (any entry containing `*`, `?`, `[`, or ending in
304+
`__*`) are non-conforming.
305+
306+
Rationale: wildcard patterns in subagent `tools:` frontmatter do not
307+
reliably match deferred MCP tools at runtime. Observed failure mode:
308+
a frontmatter entry like `mcp__deepwork-dev__*` is accepted at parse
309+
time, but when the subagent tries to invoke
310+
`mcp__deepwork-dev__mark_review_as_passed` the runtime responds with
311+
`Error: No such tool available`. Enumerating each MCP tool by its
312+
full name (e.g., `mcp__deepwork-dev__mark_review_as_passed`) avoids
313+
this failure mode and also documents the exact tool surface the
314+
agent relies on. This caught us in the e2e merge-queue run that
315+
failed PR #390.
316+
317+
This rule does NOT apply to files that are not Claude Code agent
318+
definitions — if the file has no YAML frontmatter with name/tools
319+
fields (e.g., it is a context-injection document or a skill body
320+
that happens to live under an `agents/` path), this review passes
321+
vacuously.
322+
323+
Check for:
324+
- Any entry in `tools:` containing `*`, `?`, or `[...]` glob syntax.
325+
- Any entry ending in `__*` (the common MCP-wildcard form).
326+
- Any quoted glob pattern such as `"mcp__<server>__*"`.
327+
328+
Output Format:
329+
- PASS: `tools:` field is missing, empty, or every entry is a
330+
fully-qualified name.
331+
- FAIL: list each wildcard entry with its line number and the
332+
fully-qualified tool names it should be replaced with (if
333+
determinable from the agent's body; otherwise flag the need for
334+
enumeration).
335+
290336
shell_code_review:
291337
description: "Review shell scripts for correctness, safety, and project conventions."
292338
match:

plugins/claude/agents/reviewer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ tools:
88
- Grep
99
- Glob
1010
- Bash
11-
- "mcp__plugin_deepwork_deepwork__*"
12-
- "mcp__deepwork-dev__*"
11+
- mcp__plugin_deepwork_deepwork__mark_review_as_passed
12+
- mcp__deepwork-dev__mark_review_as_passed
1313
---
1414

1515
You are a DeepWork review agent. Your only job is to execute one review task and report the result.

0 commit comments

Comments
 (0)