cosmosdb_item_delete
Delete a specific item from a Cosmos DB container by specifying the container name, item ID, and partition key. Works with Azure MCP Server for automated logging and audit tracking.
Instructions
Delete an item from a Cosmos DB container
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| container_name | Yes | Name of the Cosmos DB container | |
| database_name | No | Name of the Cosmos DB database (optional, defaults to 'defaultdb') | |
| item_id | Yes | ID of the item to delete | |
| partition_key | Yes | Partition key value for the item |
Input Schema (JSON Schema)
{
"properties": {
"container_name": {
"description": "Name of the Cosmos DB container",
"type": "string"
},
"database_name": {
"description": "Name of the Cosmos DB database (optional, defaults to 'defaultdb')",
"type": "string"
},
"item_id": {
"description": "ID of the item to delete",
"type": "string"
},
"partition_key": {
"description": "Partition key value for the item",
"type": "string"
}
},
"required": [
"container_name",
"item_id",
"partition_key"
],
"type": "object"
}
Implementation Reference
- mcp_server_azure/azure_server.py:294-301 (handler)The handler logic for the 'cosmosdb_item_delete' tool, which deletes an item from a Cosmos DB container using the delete_item method.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}
- The input schema and Tool definition for 'cosmosdb_item_delete', specifying parameters like container_name, item_id, and partition_key.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"], },
- mcp_server_azure/azure_server.py:171-175 (registration)The tool registration via the list_tools handler, which returns get_azure_tools() including the cosmosdb_item_delete tool.@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
- mcp_server_azure/azure_server.py:436-439 (registration)Dispatch logic in call_tool that routes cosmosdb_item_delete to the handle_cosmosdb_operations function.elif name.startswith("cosmosdb_"): # Updated prefix to cosmosdb_ return await handle_cosmosdb_operations( azure_rm, name, arguments ) # Use cosmosdb handler