Skip to main content
Glama

cosmosdb_item_create

Add a new item to a Cosmos DB container using JSON data. Specify the container name and item details for efficient document storage and retrieval. Simplifies database management on Azure MCP Server.

Instructions

Create a new item in a Cosmos DB container

Input Schema

NameRequiredDescriptionDefault
container_nameYesName of the Cosmos DB container
database_nameNoName of the Cosmos DB database (optional, defaults to 'defaultdb')
itemYesItem data to create (JSON object)

Input Schema (JSON Schema)

{ "properties": { "container_name": { "description": "Name of the Cosmos DB container", "type": "string" }, "database_name": { "description": "Name of the Cosmos DB database (optional, defaults to 'defaultdb')", "type": "string" }, "item": { "description": "Item data to create (JSON object)", "type": "object" } }, "required": [ "container_name", "item" ], "type": "object" }

Implementation Reference

  • Implements the core logic for creating a new item in a Cosmos DB container by calling create_item on the container client with the provided item data.
    name == "cosmosdb_item_create" ): # Renamed from put to create, and table to container container_client = database.get_container_client( arguments["container_name"] ) item = container_client.create_item(body=arguments["item"]) response = {"item_id": item["id"], "created": True}
  • Defines the Tool object for cosmosdb_item_create, including name, description, and inputSchema specifying container_name, optional database_name, and required item object.
    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"], }, ),
  • Registers the cosmosdb_item_create tool (among others) by including it in the list returned from get_azure_tools() in the MCP list_tools handler.
    @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