cosmosdb_upsert_item
Insert or replace an item in a Cosmos DB container using id and partition key. Returns the stored item as JSON.
Instructions
Insert or replace an item in a Cosmos DB container.
The item must include an 'id' field. If an item with the same id and partition key already exists it will be replaced; otherwise a new item is created. Returns the stored item document (including system fields) as JSON.
key_env_var: name of the environment variable holding the Cosmos DB account key. If the variable is set, key-based auth is used; otherwise DefaultAzureCredential is used.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"account": "<account>",
"database": "<database>",
"container": "<container>",
"item": "<item>"
},
"name": "cosmosdb_upsert_item"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | ||
| database | Yes | ||
| container | Yes | ||
| item | Yes | ||
| key_env_var | No | AZURE_COSMOS_KEY |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |