Skip to content

skill/mcp remove: normalize --agents aliases like the add paths - #563

Open
xsh310 wants to merge 1 commit into
xshen/skill-per-agent-removefrom
xshen/skill-remove-agents-normalize
Open

skill/mcp remove: normalize --agents aliases like the add paths#563
xsh310 wants to merge 1 commit into
xshen/skill-per-agent-removefrom
xshen/skill-remove-agents-normalize

Conversation

@xsh310

@xsh310 xsh310 commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

What

skill remove --agents and mcp remove --agents only lowercased the agent names before setup_mcp_clients' configured-client membership check. An alias like claude-code therefore failed with "not configured", even though skill add and mcp add accept it (they resolve aliases through normalize_tool). A user who added a scope with an alias could not remove it with the same name. mcp remove had the identical pre-existing gap.

How

  • Add normalize_agent / normalize_agents helpers in agents/__init__.py. normalize_agent is normalize_tool plus the MCP-only cursor agent (which has no model routing, so it is not a normalize_tool value); normalize_agents parses a comma-separated --agents value into canonical names.
  • Route all four skill/mcp --agents boundaries (add and remove) through normalize_agents, so add and remove resolve names identically. The add-path helper _configure_agents_for_mcp now uses normalize_agent in place of its inline a if a == "cursor" else normalize_tool(a).
  • Leave normalize_tool unchanged, so the launch/configure paths that must reject cursor as a model agent keep that behavior.
  • Behavior is identical for valid input; an invalid name now raises the clearer Unsupported tool '...' at parse time instead of a later "not configured".

Tests

  • test_agents_init.py: unit tests for normalize_agent (aliases, cursor, invalid raise) and normalize_agents (None, empty, dedupe, normalize).
  • test_cli.py: skill remove and mcp remove resolve claude-code / gemini-cli to {claude, gemini}; adds a first forwarding test for mcp remove --agents.
  • uv run pytest tests/test_agents_init.py tests/test_cli.py tests/test_mcp.py tests/test_lint.py passes (562); ruff check clean.

Stacking

Follow-up on top of #525 (xshen/skill-per-agent-remove), addressing Sunish's P2 review comment there about normalizing --agents aliases on the remove paths. Also fixes the identical pre-existing gap in mcp remove.

This pull request and its description were written by Isaac.


Stack created with GitHub Stacks CLIGive Feedback 💬

`skill remove --agents` and `mcp remove --agents` only lowercased the names
before setup_mcp_clients' configured-client membership check, so an alias like
`claude-code` errored as "not configured" even though `skill add`/`mcp add`
accept it (they resolve aliases via normalize_tool downstream). This makes a
user who added with an alias unable to remove with the same name.

Route every skill/mcp `--agents` value through a shared normalize_agents helper
so add and remove resolve names identically. normalize_agent folds in the
MCP-only `cursor` agent that the add helper previously special-cased inline.

Co-authored-by: Isaac <no-reply@databricks.com>
@xsh310
xsh310 marked this pull request as ready for review September 11, 2026 07:15
An error occurred while trying to automatically change base from xshen/skill-per-agent-remove to xshen/skill-remove September 11, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant