Skip to main content
Glama

get_scopes_in_bucket

Retrieve all scope names from a specified Couchbase bucket to organize and access data collections within the database.

Instructions

Get the names of all scopes in the given bucket.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYes

Implementation Reference

  • The core handler function that implements the logic to retrieve all scope names from a specified Couchbase bucket using the cluster connection and bucket collections API.
    def get_scopes_in_bucket(ctx: Context, bucket_name: str) -> list[str]:
        """Get the names of all scopes in the given bucket."""
        cluster = get_cluster_connection(ctx)
        bucket = connect_to_bucket(cluster, bucket_name)
        try:
            scopes = bucket.collections().get_all_scopes()
            return [scope.name for scope in scopes]
        except Exception as e:
            logger.error(f"Error getting scopes in the bucket {bucket_name}: {e}")
            raise
  • The tool function is included in the ALL_TOOLS list, which is used for registering all available MCP tools with the server.
    ALL_TOOLS = [
        get_buckets_in_cluster,
        get_server_configuration_status,
        test_cluster_connection,
        get_scopes_and_collections_in_bucket,
        get_collections_in_scope,
        get_scopes_in_bucket,
        get_document_by_id,
        upsert_document_by_id,
        delete_document_by_id,
        get_schema_for_collection,
        run_sql_plus_plus_query,
        get_index_advisor_recommendations,
        list_indexes,
        get_cluster_health_and_services,
        get_queries_not_selective,
        get_queries_not_using_covering_index,
        get_queries_using_primary_index,
        get_queries_with_large_result_count,
        get_queries_with_largest_response_sizes,
        get_longest_running_queries,
        get_most_frequent_queries,
    ]
  • Import of the get_scopes_in_bucket handler from the server module into the tools package for exposure and registration.
    from .server import (
        get_buckets_in_cluster,
        get_cluster_health_and_services,
        get_collections_in_scope,
        get_scopes_and_collections_in_bucket,
        get_scopes_in_bucket,
        get_server_configuration_status,
        test_cluster_connection,
    )

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