cosmosdb-mcp
v0.1.0MCP server for querying and managing Azure Cosmos DB
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
cosmosdb_list_accounts
List all Azure Cosmos DB accounts in the current subscription. The subscription is resolved automatically — first from the AZURE_SUBSCRIPTION_ID environment variable, then from the active 'az login' session. If neither is available, an error is returned with instructions.
cosmosdb_list_databases
List all databases in an Azure Cosmos DB account. Returns a sorted JSON array of database names. The account can be given as a short name (e.g. my-cosmos-account) or as a full endpoint URL — the https:// prefix and .documents.azure.com:443/ suffix will be added automatically if missing.
| Parameter | Type | Description |
|---|---|---|
account * | string |
cosmosdb_list_containers
List all containers in a Cosmos DB database. Returns a sorted JSON array of container names. The account can be given as a short name or full endpoint URL.
| Parameter | Type | Description |
|---|---|---|
account * | string | |
database * | string |
cosmosdb_get_container_info
Get metadata for a Cosmos DB container. Returns partition key path, indexing policy, default TTL, unique key policy, and system properties (_self, _etag, _ts). The account can be given as a short name or full endpoint URL.
| Parameter | Type | Description |
|---|---|---|
account * | string | |
container * | string | |
database * | string |
cosmosdb_query_items
Run a SQL query against a Cosmos DB container and return results. Uses Cosmos DB SQL API syntax, e.g.: SELECT * FROM c WHERE c.status = 'active' SELECT c.id, c.name FROM c ORDER BY c._ts DESC max_items is capped at 1000. Cross-partition queries are enabled automatically. Use cosmosdb_query_items_to_file instead if the result set may be large.
| Parameter | Type | Description |
|---|---|---|
account * | string | |
container * | string | |
database * | string | |
query * | string | |
max_items | integer |
cosmosdb_query_items_to_file
Run a SQL query against a Cosmos DB container and save results to a file. Results are written to output_file as a JSON array. Only the item count is returned in context — use this variant when the result set may be large to avoid filling the context window. max_items is capped at 1000.
| Parameter | Type | Description |
|---|---|---|
account * | string | |
container * | string | |
database * | string | |
output_file * | string | |
query * | string | |
max_items | integer |
cosmosdb_count_items
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.
| Parameter | Type | Description |
|---|---|---|
account * | string | |
container * | string | |
database * | string | |
where |
cosmosdb_read_item
Read a single item from a Cosmos DB container by ID and partition key. Returns the full item document as JSON. Both item_id and partition_key are required — Cosmos DB requires the partition key for efficient point reads.
| Parameter | Type | Description |
|---|---|---|
account * | string | |
container * | string | |
database * | string | |
item_id * | string | |
partition_key * | string |
cosmosdb_upsert_item
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.
| Parameter | Type | Description |
|---|---|---|
account * | string | |
container * | string | |
database * | string | |
item * | object |
cosmosdb_delete_item
Delete an item from a Cosmos DB container. THIS IS DESTRUCTIVE — the item cannot be recovered after deletion. Both item_id and partition_key are required.
| Parameter | Type | Description |
|---|---|---|
account * | string | |
container * | string | |
database * | string | |
item_id * | string | |
partition_key * | string |