Skip to content

Remove: all other tool groups, and just have read and write tools as … - #250

Merged
VirajAgarwal-couchbase merged 2 commits into
mainfrom
Maintenance-of-tools
Sep 2, 2026
Merged

Remove: all other tool groups, and just have read and write tools as …#250
VirajAgarwal-couchbase merged 2 commits into
mainfrom
Maintenance-of-tools

Conversation

@VirajAgarwal-couchbase

Copy link
Copy Markdown
Contributor

Remove all other tool groups, and just have read and write tools as the top tool collections

What does this change do?

Consolidates the tool registration structure in src/cb_mcp/tools/__init__.py down to exactly
two top-level collections — READ_ONLY_TOOLS and WRITE_TOOLS — instead of one read list plus
three separate write-tool family lists (KV_WRITE_TOOLS, COLLECTION_WRITE_TOOLS,
INDEX_WRITE_TOOLS). The three write families are merged into a single WRITE_TOOLS list (12
tools), with ALL_TOOLS, get_tools(), and __all__ updated accordingly. tool_registration.py
now builds its OAuth write_tool_names set directly from WRITE_TOOLS instead of concatenating
three lists. Tests in tests/unit/test_read_only_mode.py were updated to match (single
WRITE_TOOL_NAMES constant, len(WRITE_TOOLS) == 12 assertion) — total tool counts (22 read-only
/ 34 all) are unchanged.

No tool is added, removed, renamed, or moved between read and write. This is purely an
internal registration/orchestration simplification.

Why is this change needed?

The three-way write-tool split (KV / collection management / index) didn't reflect any real
branching in the code — prepare_tools_for_registration() immediately flattened all three back
into a single write_tool_names set for scope enforcement, and scope_enforcement.py's
required_scopes_for_tool only ever checks flat set membership, with no per-family logic
anywhere. The split was pure indirection left over from how tool families were added
incrementally; collapsing it to a single WRITE_TOOLS list matches how the code actually uses
it and removes three names to keep in sync every time a new write tool is added.

Evidence of Testing

Automated tests — commands run and results summary:

env-cmd -f .env -- uv run pytest tests/
→ 698 passed, 13 skipped in 918.42s (0:15:18)

Environments tested (both are required):

  • Couchbase Capella
  • Self-managed Couchbase Server ()

Manual verification: N/A — this change is internal to tool registration/orchestration (no
tool names, parameters, or behavior changed); the full test suite above (unit + integration +
accuracy, run against both self-managed and Capella) is the verification path for a change like
this. No new manual MCP-client exercise was performed since no user-facing tool surface changed.

Compatibility Considerations

None. No tool names, parameters, return shapes, CLI flags, or environment variables changed.
READ_ONLY_MODE behavior, OAuth scope requirements (couchbase-mcp:read / couchbase-mcp:write),
and tool annotations are all unchanged — only the internal Python collection names
(KV_WRITE_TOOLS/COLLECTION_WRITE_TOOLS/INDEX_WRITE_TOOLSWRITE_TOOLS) changed. No impact
on Capella vs. self-managed behavior or cb_mcp.core / managed MCP interfaces.

Checklist

  • Linked to an issue (required for new tools). The issue can be on JIRA (preferred for internal contributors) or GitHub.
  • Uses the Couchbase SDK (REST fallback justified in the description, if any) — N/A, no SDK-facing code changed
  • Works on both Capella and self-managed Couchbase Server
  • No changes to cb_mcp.core contracts / managed MCP interfaces (or discussed first)
  • Unit tests added/updated
  • Integration tests added/updated (for cluster-touching changes) — N/A, no cluster-facing behavior changed
  • Read-only mode and tool annotations handled (for new/changed tools) — unchanged, verified via TestGetToolsTruthTable/TestToolCounts
  • Evidence of testing included above
  • Docs updated (README, DOCKER.md) for user-facing changes — N/A, no tool-facing/doc-visible change (neither doc references the internal KV_WRITE_TOOLS/COLLECTION_WRITE_TOOLS/INDEX_WRITE_TOOLS names)
  • Lint and pre-commit pass

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR simplifies Couchbase MCP tool registration by consolidating the existing write-tool family lists into a single WRITE_TOOLS collection, leaving only two top-level groupings (READ_ONLY_TOOLS and WRITE_TOOLS) used across registration and tests.

Changes:

  • Replaces KV_WRITE_TOOLS/COLLECTION_WRITE_TOOLS/INDEX_WRITE_TOOLS with a unified WRITE_TOOLS list and updates ALL_TOOLS, get_tools(), and exports accordingly.
  • Updates tool registration to derive OAuth write_tool_names directly from WRITE_TOOLS.
  • Updates read-only-mode unit tests to validate the consolidated write tool grouping (counts and name sets unchanged).
File summaries
File Description
tests/unit/test_read_only_mode.py Updates tests to assert behavior/counts against consolidated WRITE_TOOLS.
src/cb_mcp/tools/__init__.py Consolidates write tool lists into WRITE_TOOLS and updates ALL_TOOLS, get_tools(), and __all__.
src/cb_mcp/tool_registration.py Builds OAuth write-scope name set from WRITE_TOOLS instead of concatenating multiple lists.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/cb_mcp/tools/__init__.py
@VirajAgarwal-couchbase
VirajAgarwal-couchbase merged commit f2004a3 into main Sep 2, 2026
17 checks passed
@VirajAgarwal-couchbase
VirajAgarwal-couchbase deleted the Maintenance-of-tools branch September 2, 2026 06:06
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.

4 participants