Skip to main content
Glama

cosmosdb_container_list

Lists all containers in a Cosmos DB database to manage and organize data storage. Specify the database name to retrieve container information.

Instructions

List all Cosmos DB containers in a database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_nameNoName of the Cosmos DB database (optional, defaults to 'defaultdb')

Implementation Reference

  • Handler logic for the cosmosdb_container_list tool: retrieves the list of containers from the Cosmos DB database and extracts their names into a response dictionary.
    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, which optionally takes a 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')", } }, }, ),
  • The get_cosmosdb_tools function registers the cosmosdb_container_list tool by including it in the list returned for tool discovery.
    def get_cosmosdb_tools() -> list[Tool]: return [ Tool( name="cosmosdb_container_create", # Renamed from table to container description="Create a new 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')", }, "partition_key": { "type": "object", "description": "Partition key definition for the container (e.g., {'paths': ['/partitionKey'], 'kind': 'Hash'})", }, }, "required": [ "container_name", "partition_key", ], # Partition key is usually required for Cosmos DB }, ), Tool( name="cosmosdb_container_describe", # Renamed from table to container description="Get details about 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')", }, }, "required": ["container_name"], }, ), 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')", } }, }, ), Tool( name="cosmosdb_container_delete", # Renamed from table to container description="Delete 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')", }, }, "required": ["container_name"], }, ), Tool( name="cosmosdb_item_create", # Renamed from put to create, and table to container description="Create a new 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": { "type": "object", "description": "Item data to create (JSON object)", }, }, "required": ["container_name", "item"], }, ), Tool( name="cosmosdb_item_read", # Renamed from get to read, and table to container description="Read an item from 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 read", }, "partition_key": { "type": "string", "description": "Partition key value for the item", }, }, "required": ["container_name", "item_id", "partition_key"], }, ), 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"], }, ), Tool( name="cosmosdb_item_delete", # Renamed table to container description="Delete an item from 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 delete", }, "partition_key": { "type": "string", "description": "Partition key value for the item", }, }, "required": ["container_name", "item_id", "partition_key"], }, ), Tool( name="cosmosdb_item_query", # Renamed table to container, simplified query description="Query items in a Cosmos DB container using SQL", # 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')", }, "query": { "type": "string", "description": "Cosmos DB SQL query string", }, "parameters": { "type": "array", "description": "Parameters for the SQL query (optional)", "items": { "type": "object", "properties": { "name": {"type": "string"}, "value": {}, # Value can be any type }, }, }, }, "required": ["container_name", "query"], }, ), ]
  • Server's list_tools handler that returns all Azure tools, including cosmosdb_container_list via 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

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