Select
AI-generatedSummary
Execute a SQL SELECT query against a specified Azure Cosmos DB container and return the matching documents, optionally through AI tool invocation with dynamic SQL input.
Inputs
- Authentication Type (required) — Choose the authentication method for connecting to Cosmos DB: 'Master Key' or 'Microsoft Entra ID (Azure AD)'.
- Database Name or ID (required) — Select or dynamically specify the database by name or ID to execute the query against.
- Container Name or ID (required) — Select or dynamically specify the container within the database to query.
- SQL Query — The SQL SELECT query to execute against the chosen container. Can be dynamically provided when AI model controls this field; otherwise, set as static.
- Return All — Toggle to return all query results or limit the output to a specified maximum number.
- Limit — The maximum number of results to return when 'Return All' is disabled.
- Simplify Output — Choose to remove standard Cosmos DB metadata fields (e.g., _rid, _self, _etag) from each returned document for a cleaner output.
- Exclude Fields — Enable to exclude additional custom-specified fields from each returned document.
- Fields to Exclude — Comma-separated list of additional document fields to exclude from the output when 'Exclude Fields' is enabled.
- Use Dev Override (Custom Endpoint + Token) — Enable to override the selected credentials with a custom Cosmos DB endpoint and bearer token.
- Custom Endpoint — Specify a custom Cosmos DB account endpoint URL to use when overriding credentials.
- Custom Access Token — Specify the bearer token to use with the custom endpoint override.
Output shape
a JSON string representing an array of documents matching the SQL SELECT query
The output consists of an array of documents fetched from the specified Cosmos DB container according to the SQL query. Metadata fields (_rid, _self, _etag, _attachments, _ts) can be omitted if 'Simplify Output' is enabled. Additional fields can be excluded if specified. If no results are found, a JSON string message indicates this. When 'Return All' is false, the number of returned documents is limited to the configured 'Limit'. Execution errors are surfaced as node errors.
Examples
Example 1: Retrieve all documents with status 'active' from container 'orders' in database 'salesDb' using Master Key authentication, returning all results and removing metadata fields.
Authentication Type: Master Key; Database Name or ID: salesDb; Container Name or ID: orders; SQL Query: SELECT * FROM c WHERE c.status = 'active'; Return All: true; Simplify Output: true.