Query with AQL
query_aqlQuery an Azquo database using AQL (Azquo Query Language). AQL reference: https://www.azquo.com/connect/#aql
Read-only - this never creates or changes names or values; a heading with an edit: command or an "as" set assignment is refused (use aql_write for those). The main way to get numbers out of a database for an ad-hoc question. Neighbours: aql_write saves values with the same heading model; get_report_data runs an existing report; describe_set / describe_query explore names and sets rather than values; audit_cell explains where one cell of this tool's result came from.
AQL works with row headings, column headings, and context — all as nested string arrays, laid out like the heading area of a spreadsheet: each inner array is one row of heading cells, each string one heading. In a stack of headings, a heading on an earlier line applies until another heading or a "." replaces it, so it need not be repeated; the LAST line (the right-hand column, for row headings) is where data anchors and must be filled in every position that should have data.
Example — get monthly sales figures by product:
rowHeadings: [["Products children"]]
columnHeadings: [["Sales"], ["Jan", "Feb", "Mar"]]
context: [["2024"]]
The response contains: rowHeadings — resolved row labels columnHeadings — resolved column labels context — resolved context rows — 2D array of cell values (one entry per [row][col]; raw types: string|number|boolean|null) rowCount, columnCount, truncated — pagination info (options.rowLimit, default 1000)
Raise options.rowLimit (0 = no limit) when truncated is true. A heading naming something that is not in the database fails with aql_syntax and the engine's message - find the right name with list_names - unless options.ignoreHeadingErrors is true. Other failures return aql_runtime.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | Yes | Context expressions as a 2D array — use [[]] if no context needed | |
| options | No | Engine options, all optional - omit for defaults. rowLimit (default 1000, 0 = none), columnLimit; sortRow / sortColumn (a heading to sort by) with sortRowAsc / sortColumnAsc; hideRows / hideCols (1 drops blank rows/columns); rowLanguage / columnLanguage (attribute used to match heading text, e.g. "language date"); ignoreHeadingErrors (blank instead of an error for unknown headings); valueFormat "raw" (default) or "formatted". Example: {"rowLimit": 50, "sortColumn": "Sales", "sortColumnAsc": false} | |
| business | No | Optional. The business this call is for, by name, e.g. "azquo" - it then runs there whatever business the session is in. Worth giving on writes when you work in more than one business: a new MCP session starts in the login's own business. list_businesses shows the names. | |
| database | Yes | Database name to query | |
| rowHeadings | Yes | Row heading expressions as a 2D array of strings | |
| columnHeadings | Yes | Column heading expressions as a 2D array of strings |