Skip to main content
Glama

Query a connected table

query_table
Read-onlyIdempotent

For whole-table top or bottom rows on indexed columns, use search_table with browse first. A bounded, structured query over one table's current version. NO SQL: send columns, filters, order_by, aggregates, group_by and limit as JSON. Example: {"table_id": "0f2f...", "columns": ["observed_at", "air_temp_f"], "filters": [{"column": "air_temp_f", "operator": "gte", "value": 80}], "order_by": [{"column": "observed_at", "direction": "desc"}], "limit": 50}. Ceilings: 64 columns, 8 filters, 2 sort keys, 4 aggregates, 4 group keys, 10000 rows a page (25 when limit is omitted), 8 MiB of JSON. Every page answers with next_cursor; send it back as cursor (same columns, filters and order_by) for the next page until it is null, and you have read the whole table on one immutable version. Operators, all ANDed: eq, neq, in (an array of at most 20 values), gt, gte, lt, lte, is_null and is_not_null (no value), between (exactly two non-null bounds, inclusive at both ends), and contains, starts_with and ends_with (one non-empty string, case-sensitive, text columns only). json_array_has_string tests whether a text cell containing a JSON array includes the exact case-sensitive top-level string value. Nulls, malformed JSON and other shapes do not match. Use it for membership in a published JSON string list. Dates and timestamps compare as ISO strings, so a month is one between or a gte plus an lt. GROUPED AGGREGATES: send group_by beside aggregates for one row per distinct combination, keyed by the group column names and the aggregate aliases. Example: {"table_id": "0f2f...", "columns": ["station"], "group_by": ["station"], "aggregates": [{"function": "avg", "column": "air_temp_f", "as": "avg_temp"}], "order_by": [{"column": "avg_temp", "direction": "desc"}], "limit": 10}. An aggregate answers under its as, or under {function}{column or "all"}{position} without one. group_by needs at least one aggregate, no two result columns may share a name and names are compared without case (group_by ["city"] refuses an alias of "CITY", and two aggregates cannot share one alias), and order_by may only name a group column or an alias. limit counts GROUPS, execution.truncated means the limit was reached so there may be more groups, and a grouped answer has no next page: next_cursor is null and offset and cursor stay refused beside aggregates. Without group_by an aggregate query returns one row for the whole table and cannot be ordered. When ranking entities (e.g. companies or issuers), ensure a consistent comparison period and one comparable observation per entity (using group_by, a primary observation filter, or an entity-grain table) rather than repeating multiple listings or historical filings, or state the comparability limitation if unavailable. TEXT SEARCH: when get_table_schema returns capabilities.search with a spec_digest, add search: {"text": "...", "columns": its keyword_columns (or some of them), "spec_digest": its spec_digest} for the existing all-terms search and its unchanged response. Without a spec_digest, use search_table. For words, prefixes, typos and meaning on public tables, explicitly add search.engine: "resident" and search.settled: true. Public ready packages return rows, applied plan, planner origin/reason, package generation/digest, timings and next_cursor without a total. Send later pages with search.plan and search.cursor; explicit search.plan is validated by the service and invalid_plan diagnostics pass through. Request lazy count separately with search.plan and search.count (matching_rows or relevance_window). A table whose search collapses answers one row per entity, with collapsed_by, and matched_via and group_size on each row; search.group: "row" asks for every matching row instead (send the same group with search.cursor). A table whose search does not collapse accepts search.group and answers ungrouped rows, and a scan answer is ungrouped. Confirm collapsed_by is present before relying on grouping. Preparing/unavailable first pages answer by the existing scan with a path note; an unavailable continuation returns restart_required (restart_from: 1). Scan fallbacks do not apply the resident plan; count covers lexical matching rows. Private and link-shared tables retain scan search and explain unsupported resident members in the note. For scan answers, execution.search_mode says how it ran and execution.search_scope what the count covers. A refusal saying search is unavailable means the table's version changed: call get_table_schema again. Requires an mr_use_ workspace key (Authorization: Bearer) or an OAuth connection. The first query over a dataset connects it to the workspace; connect_dataset makes that explicit but is not required. Resident answers return row_id and fields, the applied plan, planner, package and timings; cite the package generation/digest. Scan answers return rows plus table.version_id and table.content_digest; cite those. For the whole table in one request, download the Parquet instead. Reads past the free sample (the first 500 rows of a table in stored order) count against the workspace's shared free monthly allowance of 100,000 rows and 1,000 queries (the workspace of the key or grant in use) unless it is subscribed. A download counts the rows it contains, plus one query per table. At the limit the tool answers usage_limit_exceeded with the reset time and an upgrade URL.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "table_id": "<table_id>",
      "columns": "<columns>"
    },
    "name": "query_table"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
cursorNo
offsetNo
searchNo
columnsYes
filtersNo
group_byNo
order_byNo
table_idYes
aggregatesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / filters / items / properties / operator / enum
      Previous value: -[
      -  "eq",
      -  "neq",
      -  "in",
      -  "gt",
      -  "gte",
      -  "lt",
      -  "lte",
      -  "is_null",
      -  "is_not_null",
      -  "between",
      -  "contains",
      -  "starts_with",
      -  "ends_with"
      -]New value: +[
      +  "eq",
      +  "neq",
      +  "in",
      +  "gt",
      +  "gte",
      +  "lt",
      +  "lte",
      +  "is_null",
      +  "is_not_null",
      +  "between",
      +  "contains",
      +  "starts_with",
      +  "ends_with",
      +  "json_array_has_string"
      +]
  2. Changed1 schema field changed
    • addedInput schema / properties / search / properties / group
      Added value: +{
      +  "enum": [
      +    "collapse",
      +    "row"
      +  ],
      +  "type": "string"
      +}
  3. Changed5 schema fields changed
    • addedInput schema / properties / search / properties / count
      Added value: +{
      +  "enum": [
      +    "matching_rows",
      +    "relevance_window"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / search / properties / cursor
      Added value: +{
      +  "maxLength": 4096,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • addedInput schema / properties / search / properties / engine
      Added value: +{
      +  "const": "resident",
      +  "type": "string"
      +}
    • addedInput schema / properties / search / properties / plan
      Added value: +{
      +  "additionalProperties": {},
      +  "propertyNames": {
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / search / properties / settled
      Added value: +{
      +  "const": true,
      +  "type": "boolean"
      +}
  4. Changed1 schema field changed
    • addedInput schema / properties / search
      Added value: +{
      +  "additionalProperties": false,
      +  "properties": {
      +    "columns": {
      +      "items": {
      +        "maxLength": 128,
      +        "minLength": 1,
      +        "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
      +        "type": "string"
      +      },
      +      "maxItems": 16,
      +      "type": "array"
      +    },
      +    "generation_digest": {
      +      "pattern": "^sha256:[0-9a-f]{64}$",
      +      "type": "string"
      +    },
      +    "mode": {
      +      "enum": [
      +        "lexical",
      +        "hybrid"
      +      ],
      +      "type": "string"
      +    },
      +    "spec_digest": {
      +      "pattern": "^sha256:[0-9a-f]{64}$",
      +      "type": "string"
      +    },
      +    "text": {
      +      "maxLength": 512,
      +      "minLength": 1,
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "text",
      +    "columns",
      +    "spec_digest"
      +  ],
      +  "type": "object"
      +}
  5. Changed2 schema fields changed
    • changedInput schema / properties / filters / items / properties / operator / enum
      Previous value: -[
      -  "eq",
      -  "neq",
      -  "in",
      -  "gt",
      -  "gte",
      -  "lt",
      -  "lte",
      -  "is_null",
      -  "is_not_null"
      -]New value: +[
      +  "eq",
      +  "neq",
      +  "in",
      +  "gt",
      +  "gte",
      +  "lt",
      +  "lte",
      +  "is_null",
      +  "is_not_null",
      +  "between",
      +  "contains",
      +  "starts_with",
      +  "ends_with"
      +]
    • addedInput schema / properties / group_by
      Added value: +{
      +  "default": [],
      +  "items": {
      +    "maxLength": 128,
      +    "minLength": 1,
      +    "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
      +    "type": "string"
      +  },
      +  "maxItems": 4,
      +  "type": "array"
      +}
  6. Changed3 schema fields changed
    • addedInput schema / properties / cursor
      Added value: +{
      +  "maxLength": 512,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / properties / limit / maximum
      Previous value: -100New value: +10000
    • addedInput schema / properties / offset
      Added value: +{
      +  "maximum": 100000000,
      +  "minimum": 0,
      +  "type": "integer"
      +}
  7. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Beyond the annotations, the description discloses authentication requirements (mr_use_ workspace key or OAuth), pagination invariants ('same columns, filters and order_by' until next_cursor is null), immutability of the queried version, restart behavior on version changes, and billing implications including the free sample and 100,000-row/1,000-query monthly allowance. These are substantive behavioral traits not present in the annotations.

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

Conciseness3/5

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

The purpose, example and ceilings are front-loaded, and much of the long text is substantively necessary for this ten-parameter tool. Still, the description becomes a dense wall of text with repeated rules around next_cursor and grouped results, and tangential guidance about ranking entities such as companies or issuers that could be separated or trimmed.

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

Completeness5/5

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

Given ten parameters, nested search options, no output schema and no schema descriptions, the definition is complete enough for an agent to call it correctly: it covers query shape, limits, operators, grouping, text search, pagination, auth, billing and versioning behavior. The remaining gaps are minor schema-level discrepancies rather than missing essential context.

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

Parameters4/5

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

With 0% schema description coverage, the description does most of the semantic work: it enumerates operators, explains grouped aggregates, specifies cursor pagination, and gives detailed search object fields such as spec_digest, engine, settled, plan, count and group. However, it contains a schema inconsistency by stating a 64-column ceiling while the schema caps columns at 20, and it leaves schema parameters such as offset and search.mode largely unexplained.

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

Purpose5/5

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

The description states a specific verb and resource: 'A bounded, structured query over one table's current version.' It explicitly contrasts itself with search_table for whole-table top/bottom rows and with Parquet download for the entire table, so an agent can distinguish its purpose from siblings without opening the schema.

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

Usage Guidelines5/5

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

It gives explicit routing conditions: use search_table with browse first for whole-table top or bottom rows on indexed columns; use search_table when get_table_schema has no spec_digest; use the Parquet download for the whole table in one request. It also clarifies that connect_dataset is not required and explains text-search prerequisites, which is unusually thorough when-to-use guidance.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources