Skip to main content
Glama

cosmosdb_item_delete

Remove specific items from Azure Cosmos DB containers by providing container name, item ID, and partition key to manage database content.

Instructions

Delete an item from a Cosmos DB container

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
container_nameYesName of the Cosmos DB container
database_nameNoName of the Cosmos DB database (optional, defaults to 'defaultdb')
item_idYesID of the item to delete
partition_keyYesPartition key value for the item

Implementation Reference

  • The core handler logic for the cosmosdb_item_delete tool. It retrieves the container client and calls delete_item with the provided item_id and partition_key.
    elif name == "cosmosdb_item_delete":  # Renamed table to container
        container_client = database.get_container_client(
            arguments["container_name"]
        )
        container_client.delete_item(
            item=arguments["item_id"], partition_key=arguments["partition_key"]
        )
        response = {"item_id": arguments["item_id"], "deleted": True}
  • Defines the input schema, description, and name for the cosmosdb_item_delete tool, which is used for registration.
    Tool(
        name="cosmosdb_item_delete",  # Renamed table to container
        description="Delete an item from a Cosmos DB container",  # Updated description
        inputSchema={
            "type": "object",
            "properties": {
                "container_name": {  # Renamed from table_name
                    "type": "string",
                    "description": "Name of the Cosmos DB container",  # Updated description
                },
                "database_name": {
                    "type": "string",
                    "description": "Name of the Cosmos DB database (optional, defaults to 'defaultdb')",
                },
                "item_id": {
                    "type": "string",
                    "description": "ID of the item to delete",
                },
                "partition_key": {
                    "type": "string",
                    "description": "Partition key value for the item",
                },
            },
            "required": ["container_name", "item_id", "partition_key"],
        },
  • Registers all Azure tools, including cosmosdb_item_delete, by returning the list from get_azure_tools() in response to list_tools requests.
    @server.list_tools()
    async def list_tools() -> list[Tool]:
        """List available Azure tools"""
        logger.debug("Handling list_tools request")
        return get_azure_tools()  # Use get_azure_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/mashriram/azure_mcp_server'

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