Skip to main content
Glama

cosmosdb_item_query

Query items in a Cosmos DB container using SQL to retrieve specific data from Azure databases.

Instructions

Query items in a Cosmos DB container using SQL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
container_nameYesName of the Cosmos DB container
database_nameNoName of the Cosmos DB database (optional, defaults to 'defaultdb')
queryYesCosmos DB SQL query string
parametersNoParameters for the SQL query (optional)

Implementation Reference

  • Handler logic inside handle_cosmosdb_operations that executes the cosmosdb_item_query tool by querying items in the specified container using the provided SQL query and parameters.
    elif (
        name == "cosmosdb_item_query"
    ):  # Renamed table to container, simplified query
        container_client = database.get_container_client(
            arguments["container_name"]
        )
        items = list(
            container_client.query_items(
                query=arguments["query"],
                parameters=arguments.get("parameters", []),  # Optional parameters
            )
        )
        response = {"items": items}
  • Input schema definition for the cosmosdb_item_query tool, specifying required container_name and query, with optional database_name and parameters.
    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"],
        },
    ),
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action is a query but doesn't mention whether this is read-only (likely but not confirmed), what permissions are required, whether there are rate limits, what the return format looks like, or if there are pagination considerations. For a database query tool with zero annotation coverage, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that gets straight to the point with zero wasted words. It's appropriately sized for the tool's complexity and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a database query tool with no annotations, no output schema, and multiple sibling tools, the description is incomplete. It doesn't explain what the tool returns, how results are formatted, whether there are limitations on query complexity, or how it differs from other Cosmos DB item operations. The agent would need to guess about important behavioral aspects.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all four parameters thoroughly. The description mentions 'using SQL' which implies the query parameter accepts SQL syntax, but this doesn't add significant meaning beyond what the schema provides. The baseline of 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Query items') and resource ('in a Cosmos DB container using SQL'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like cosmosdb_item_read or cosmosdb_item_create, which would require more specific scope information.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With multiple Cosmos DB item operations available (create, read, delete, replace), there's no indication whether this is for complex queries versus simple lookups, or when SQL queries are preferred over direct item operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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