Skip to content

fix: remove invalid MCP tool refs and color frontmatter from agents#37

Merged
Jamkris merged 3 commits into
mainfrom
fix/agent-validation-errors
Apr 22, 2026
Merged

fix: remove invalid MCP tool refs and color frontmatter from agents#37
Jamkris merged 3 commits into
mainfrom
fix/agent-validation-errors

Conversation

@Jamkris

@Jamkris Jamkris commented Apr 22, 2026

Copy link
Copy Markdown
Owner

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.

Summary by CodeRabbit

  • Refactor

    • Removed messaging and external doc lookup integrations from several agents; retained local file and system utilities.
    • Cleared non-functional visual metadata (color fields) from multiple agents for UI/validation consistency.
  • Chores

    • Tightened agent frontmatter validation to restrict declared tools to the allowlist and disallow unsupported metadata keys.

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.
@coderabbitai

coderabbitai Bot commented Apr 22, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3c46beff-36a4-465f-bb9f-4b497adb66c5

📥 Commits

Reviewing files that changed from the base of the PR and between 4352425 and f38eae5.

📒 Files selected for processing (2)
  • .coderabbit.yaml
  • .gemini/styleguide.md

Walkthrough

Removed MCP tool declarations from two agents and removed color frontmatter fields from several agent files; updated validator/styleguide to require name, description, and an allowlisted set of Gemini CLI built-in tools while forbidding MCP/tool-like and extraneous frontmatter keys. No agent logic or workflows changed.

Changes

Cohort / File(s) Summary
MCP Tool Removals
agents/chief-of-staff.md, agents/docs-lookup.md
Removed MCP tool entries: Slack-related MCP tools removed from chief-of-staff; Context7 MCP tools removed from docs-lookup. Retained local file/system utilities only.
Color Metadata Removals
agents/gan-evaluator.md, agents/gan-generator.md, agents/gan-planner.md, agents/harness-optimizer.md, agents/loop-operator.md
Removed color frontmatter fields only; no other frontmatter or content edits.
Validator / Policy
.coderabbit.yaml, .gemini/styleguide.md
Tightened frontmatter validation and styleguide: require name and description; restrict tools: to a fixed allowlist of Gemini CLI built-ins; forbid explicit MCP tool names and disallowed keys like model and color.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

agents, docs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: removing invalid MCP tool references and color frontmatter from agent configuration files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/agent-validation-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5616627 and 18fcab5.

📒 Files selected for processing (7)
  • agents/chief-of-staff.md
  • agents/docs-lookup.md
  • agents/gan-evaluator.md
  • agents/gan-generator.md
  • agents/gan-planner.md
  • agents/harness-optimizer.md
  • agents/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

Comment thread agents/chief-of-staff.md
Comment thread agents/docs-lookup.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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 18fcab5 and 4352425.

📒 Files selected for processing (1)
  • .coderabbit.yaml

Comment thread .coderabbit.yaml Outdated
- .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.
@Jamkris Jamkris merged commit b4a8b4e into main Apr 22, 2026
8 checks passed
@Jamkris Jamkris added the 🐞 Bug Something isn't working label Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant