Skip to main content
Glama

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

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

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

  • 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"], },
  • 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
  • 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

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