Skip to main content
Glama

delete_document_by_id

Remove a specific document from a Couchbase database by providing its unique identifier, bucket, scope, and collection details.

Instructions

Delete a document by its ID. Returns True on success, False on failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bucket_nameYes
scope_nameYes
collection_nameYes
document_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core implementation of the delete_document_by_id tool. Deletes the document from Couchbase using the provided bucket, scope, collection, and ID. Returns True on success, False otherwise.
    def delete_document_by_id(
        ctx: Context,
        bucket_name: str,
        scope_name: str,
        collection_name: str,
        document_id: str,
    ) -> bool:
        """Delete a document by its ID.
        Returns True on success, False on failure."""
        cluster = get_cluster_connection(ctx)
        bucket = connect_to_bucket(cluster, bucket_name)
        try:
            collection = bucket.scope(scope_name).collection(collection_name)
            collection.remove(document_id)
            logger.info(f"Successfully deleted document {document_id}")
            return True
        except Exception as e:
            logger.error(f"Error deleting document {document_id}: {e}")
            return False
  • Imports delete_document_by_id from kv.py into the tools package, making it available for registration.
    from .kv import (
        delete_document_by_id,
        get_document_by_id,
        upsert_document_by_id,
    )
  • Includes delete_document_by_id in ALL_TOOLS list, which is used to batch-register all tools with the MCP 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,
    ]
  • Loop that registers every tool in ALL_TOOLS (including delete_document_by_id) to the FastMCP server instance.
    # Register all tools
    for tool in ALL_TOOLS:
        mcp.add_tool(tool)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the action ('Delete') and return values ('Returns True on success, False on failure.'), but lacks details on permissions, side effects (e.g., if deletion is permanent), error conditions, or rate limits. This is insufficient for a destructive operation without annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and front-loaded, with two sentences that directly state the action and outcome. There is no wasted language, making it efficient and easy to parse for an AI agent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a destructive operation with 4 parameters), no annotations, and an output schema (which likely covers return values), the description is incomplete. It lacks crucial context such as parameter meanings, usage prerequisites, and behavioral risks, making it inadequate for safe and effective tool invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description must compensate for undocumented parameters. It only mentions 'ID' without explaining the four required parameters (bucket_name, scope_name, collection_name, document_id) or their relationships. This fails to add meaningful context beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Delete a document by its ID.' It specifies the verb ('Delete') and resource ('document'), but does not distinguish it from sibling tools like 'upsert_document_by_id' beyond the action type. This makes it clear but lacks explicit sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, such as needing to know the bucket, scope, and collection names, or when to choose deletion over other operations like 'upsert_document_by_id'. This leaves usage context entirely implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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