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
| Name | Required | Description | Default |
|---|---|---|---|
| bucket_name | Yes |
Implementation Reference
- src/tools/server.py:118-127 (handler)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
- src/tools/__init__.py:42-64 (registration)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, ]
- src/tools/__init__.py:31-39 (registration)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, )