Skip to main content
Glama

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
NameRequiredDescriptionDefault
bucket_nameYes
scope_nameYes

Implementation Reference

  • 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]
  • 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)
  • Includes get_collections_in_scope in the ALL_TOOLS list used for registration.
    get_collections_in_scope,
  • Imports get_collections_in_scope from .server module for exposure.
    get_collections_in_scope,

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Couchbase-Ecosystem/mcp-server-couchbase'

If you have feedback or need assistance with the MCP directory API, please join our Discord server