Skip to main content
Glama

cosmosdb_item_create

Add new items to Azure Cosmos DB containers by specifying container name and JSON data. This tool enables data insertion into NoSQL databases for application storage needs.

Instructions

Create a new item in a Cosmos DB container

Input Schema

TableJSON 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)

Implementation Reference

  • Handler logic for the cosmosdb_item_create tool: retrieves the container client and creates a new item using create_item, returning the item ID and success status.
    elif (
        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}
  • Tool schema definition for cosmosdb_item_create, specifying input parameters: container_name, optional database_name, and 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"],
        },
    ),
  • Tool registration via the list_tools handler, which returns all Azure tools including cosmosdb_item_create from 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