cosmosdb_container_list
Retrieve a list of all Cosmos DB containers within a specified database using the Azure MCP Server. Simplify container management and auditing for efficient database operations.
Instructions
List all Cosmos DB containers in a database
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| database_name | No | Name of the Cosmos DB database (optional, defaults to 'defaultdb') |
Input Schema (JSON Schema)
{
"properties": {
"database_name": {
"description": "Name of the Cosmos DB database (optional, defaults to 'defaultdb')",
"type": "string"
}
},
"type": "object"
}
Implementation Reference
- mcp_server_azure/azure_server.py:259-262 (handler)Core execution logic for the cosmosdb_container_list tool: lists containers in the database using CosmosClient and returns their names.elif name == "cosmosdb_container_list": # Renamed from table to container containers = list(database.list_containers()) container_names = [c["id"] for c in containers] response = {"container_names": container_names}
- Input schema definition for the cosmosdb_container_list tool, including optional database_name parameter.Tool( name="cosmosdb_container_list", # Renamed from table to container description="List all Cosmos DB containers in a database", # Updated description inputSchema={ "type": "object", "properties": { "database_name": { "type": "string", "description": "Name of the Cosmos DB database (optional, defaults to 'defaultdb')", } }, }, ),
- mcp_server_azure/azure_server.py:171-175 (registration)Registers all Azure tools including cosmosdb_container_list via the MCP server's list_tools handler by calling get_azure_tools().@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
- mcp_server_azure/azure_server.py:436-439 (registration)Dispatches calls to cosmosdb_container_list (and other cosmosdb tools) to the appropriate handler function.elif name.startswith("cosmosdb_"): # Updated prefix to cosmosdb_ return await handle_cosmosdb_operations( azure_rm, name, arguments ) # Use cosmosdb handler