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"], }, ),

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