fix: remove invalid MCP tool refs and color frontmatter from agents#37
Conversation
Gemini CLI's agent schema rejects two patterns that were producing "Validation failed" errors at extension install / session start: 1. `mcp__<server>__<tool>` entries in the frontmatter `tools:` array — the schema only accepts built-in tool names. MCP tools stay usable at runtime via the configured MCP server regardless of being listed; removing them from the array just unblocks validation. Fixed in chief-of-staff.md (4 Slack entries) and docs-lookup.md (2 Context7 entries); the agent bodies still document how to invoke them. 2. `color:` key in frontmatter — not part of the Gemini CLI agent schema (appears to be a Claude Code carry-over). Removed from gan-evaluator, gan-generator, gan-planner, harness-optimizer, and loop-operator. Note: the previously observed `~/.gemini/commands/command-explain.toml` parse error is from a user-local file outside this repo and is not addressed here.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughRemoved MCP tool declarations from two agents and removed Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@agents/chief-of-staff.md`:
- Line 4: The frontmatter tools array no longer declares the Slack MCP tool(s)
but the agent body still calls Slack MCP actions; add the exact Slack MCP tool
identifier(s) used in the agent body to the frontmatter tools array (i.e.,
update the tools: ["read_file", "search_file_content", "list_directory",
"run_shell_command", "replace", "write_file"] to include the Slack MCP tool
name(s) referenced in the body such as the Slack/MCP identifier string present
in the agent text) so the agent can execute those Slack steps at runtime; ensure
the added identifier matches the token used in the body exactly.
In `@agents/docs-lookup.md`:
- Line 4: The frontmatter tools array currently contains only
["read_file","search_file_content"] but the docs-lookup agent body and the /docs
command expect Context7 MCP tools; update the frontmatter "tools" array in
docs-lookup.md to include the specific Context7 MCP tool identifiers used by the
agent (e.g., the Context7 resolve/query tool names referenced in the agent body
and commands/docs.toml) so the agent can call them at runtime; ensure the
"tools" list and any referenced symbols in the agent flow (the /docs command,
resolve/query calls) are consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 241aa60e-e8ed-4e49-ad3a-2fe5e69fc51c
📒 Files selected for processing (7)
agents/chief-of-staff.mdagents/docs-lookup.mdagents/gan-evaluator.mdagents/gan-generator.mdagents/gan-planner.mdagents/harness-optimizer.mdagents/loop-operator.md
💤 Files with no reviewable changes (5)
- agents/gan-evaluator.md
- agents/gan-planner.md
- agents/gan-generator.md
- agents/loop-operator.md
- agents/harness-optimizer.md
The previous rule told reviewers to flag agents whose body referenced MCP tools without declaring them in the frontmatter `tools:` array. That was backwards: Gemini CLI's agent schema actually rejects MCP tool entries in that array with "Invalid tool name" at load time (this is the exact failure fixed in this PR for chief-of-staff and docs-lookup). Rewrite the rule so CodeRabbit instead rejects MCP refs in the tools array and notes that MCP tools are auto-discovered from the configured MCP server at runtime. Also explicitly reject out-of-schema keys like `color` and `model` to cover the other half of this PR.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.coderabbit.yaml:
- Around line 40-54: Add an explicit requirement that the agent frontmatter must
include the tools key (i.e., require presence of frontmatter `tools`) so agents
lacking `tools` are treated as invalid; update the YAML text around the existing
Gemini CLI frontmatter rules to state "frontmatter MUST include `tools`"
alongside existing requirements for `name` and `description`, and clarify that
`tools` may only contain the allowed built-in tool names (read_file,
read_many_files, write_file, replace, glob, search_file_content, list_directory,
run_shell_command, save_memory, web_fetch, google_web_search) to prevent schema
misses at load time.
- Around line 40-54: The tool allowlist in .coderabbit.yaml is inconsistent with
.gemini/styleguide.md; pick one source of truth and align them: either restrict
the .coderabbit.yaml tools array to the three allowed tools from
.gemini/styleguide.md (read_file, run_shell_command, write_file) or update
.gemini/styleguide.md to enumerate the ten permitted Gemini CLI built-ins shown
in .coderabbit.yaml (read_file, read_many_files, write_file, replace, glob,
search_file_content, list_directory, run_shell_command, save_memory, web_fetch,
google_web_search); ensure no Claude-style names (e.g., search_files,
replace_in_file, Read, Edit) or MCP prefixes (mcp__...) are present and that
every agent frontmatter still includes required keys name and description.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 664b8253-2634-4bda-890e-08c93fc9eaeb
📒 Files selected for processing (1)
.coderabbit.yaml
- .gemini/styleguide.md: replace 3-example allowlist with the full set of valid Gemini CLI built-in tools, explicitly reject MCP and Claude-style tool names, and reject out-of-schema frontmatter keys (`model`, `color`) - .coderabbit.yaml: require `tools` in frontmatter (alongside `name` and `description`), and cross-reference the styleguide as the authoritative allowlist so the two stay aligned Addresses CodeRabbit feedback on PR #37 about missing `tools` presence requirement and the styleguide/coderabbit allowlist mismatch.
Gemini CLI's agent schema rejects two patterns that were producing "Validation failed" errors at extension install / session start:
mcp__<server>__<tool>entries in the frontmattertools:array — the schema only accepts built-in tool names. MCP tools stay usable at runtime via the configured MCP server regardless of being listed; removing them from the array just unblocks validation. Fixed in chief-of-staff.md (4 Slack entries) and docs-lookup.md (2 Context7 entries); the agent bodies still document how to invoke them.color:key in frontmatter — not part of the Gemini CLI agent schema (appears to be a Claude Code carry-over). Removed from gan-evaluator, gan-generator, gan-planner, harness-optimizer, and loop-operator.Note: the previously observed
~/.gemini/commands/command-explain.tomlparse error is from a user-local file outside this repo and is not addressed here.Summary by CodeRabbit
Refactor
Chores