get_collections_in_scope
Retrieve all collection names within a specified Couchbase scope and bucket to manage database organization and access.
Instructions
Get the names of all collections in the given scope and bucket.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucket_name | Yes | ||
| scope_name | Yes |
Implementation Reference
- src/tools/server.py:130-140 (handler)The handler function that executes the tool logic. It runs a query on system:all_keyspaces to fetch distinct collection names for the given bucket and scope.def get_collections_in_scope( ctx: Context, bucket_name: str, scope_name: str ) -> list[str]: """Get the names of all collections in the given scope and bucket.""" # Get the collections in the scope using system:all_keyspaces collection query = "SELECT DISTINCT(name) as collection_name FROM system:all_keyspaces where `bucket`=$bucket_name and `scope`=$scope_name" results = run_cluster_query( ctx, query, bucket_name=bucket_name, scope_name=scope_name ) return [result["collection_name"] for result in results]
- src/mcp_server.py:175-177 (registration)Registers the get_collections_in_scope tool (along with others) by adding each tool from ALL_TOOLS to the FastMCP server instance.# Register all tools for tool in ALL_TOOLS: mcp.add_tool(tool)
- src/tools/__init__.py:47-47 (helper)Includes get_collections_in_scope in the ALL_TOOLS list used for registration.get_collections_in_scope,
- src/tools/__init__.py:34-34 (helper)Imports get_collections_in_scope from .server module for exposure.get_collections_in_scope,