cosmosdb_count_items
Count items in a Cosmos DB container, optionally filtering with a SQL WHERE clause. Returns a JSON object containing the item count.
Instructions
Count items in a Cosmos DB container, with an optional filter.
where accepts a SQL WHERE clause body (without the WHERE keyword), e.g.: c.status = 'active' c.createdAt > '2025-01-01'
If where is omitted, counts all items in the container. Returns a JSON object with a 'count' field.
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes | ||
| database | Yes | ||
| container | Yes | ||
| where | No | ||
| key_env_var | No | AZURE_COSMOS_KEY |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |