Skip to main content
Glama

cosmosdb_item_replace

Update or replace an item in a Cosmos DB container by specifying the container name, item ID, partition key, and updated JSON data. Ensures data accuracy and integrity.

Instructions

Replace an item in 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')
itemYesUpdated item data (JSON object)
item_idYesID of the item to replace
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": { "description": "Updated item data (JSON object)", "type": "object" }, "item_id": { "description": "ID of the item to replace", "type": "string" }, "partition_key": { "description": "Partition key value for the item", "type": "string" } }, "required": [ "container_name", "item_id", "partition_key", "item" ], "type": "object" }

Implementation Reference

  • Executes the cosmosdb_item_replace tool by retrieving the container client and calling replace_item with the provided item_id, partition_key (used earlier?), and new item body. Note: partition_key is in schema but not used in handler code shown.
    name == "cosmosdb_item_replace" ): # Renamed from update to replace, and table to container, using replace_item for full replace container_client = database.get_container_client( arguments["container_name"] ) item = container_client.replace_item( item=arguments["item_id"], body=arguments["item"] ) response = {"item_id": item["id"], "replaced": True}
  • Defines the input schema and metadata for the cosmosdb_item_replace tool, including parameters for container_name, database_name, item_id, partition_key, and item.
    Tool( name="cosmosdb_item_replace", # Renamed from update to replace, and table to container, using replace_item for full replace description="Replace an item in 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 replace", }, "partition_key": { "type": "string", "description": "Partition key value for the item", }, "item": { "type": "object", "description": "Updated item data (JSON object)", }, }, "required": ["container_name", "item_id", "partition_key", "item"], }, ),
  • Registers all Azure tools, including cosmosdb_item_replace, by returning get_azure_tools() in the list_tools handler.
    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