Skip to main content
Glama

Query sheet rows

query_sheet
Read-only

Filter a table-shaped Excel sheet by header-based conditions and return matching rows, selected columns, and row counts to extract focused subsets from large datasets.

Instructions

Return only the rows of a table-shaped sheet (first row = headers) that match a condition.

Returns {columns, records, row_count, limited}; row_count counts all matches. Use instead of read_sheet when you need a subset of a large table. For totals per group use aggregate_sheet.

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": {
      "sheet": "<sheet>",
      "filter_query": "<filter_query>"
    },
    "name": "query_sheet"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoFile path or preloaded name (list_configured_files). Omit if only one file is preloaded.
sheetYesSheet name (case-sensitive).
columnsNoOnly return these columns. Omit for all.
max_rowsNoReturn at most this many matching rows.
cell_rangeNoRange to read, e.g. "A1:F500". Omit for the whole sheet.
filter_queryYesCondition on header names, e.g. "Status == 'PAID' and Amount > 500". Allowed: comparisons, and/or/not, in, arithmetic. Header names must be valid identifiers (no spaces).

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.4.0
    • addedInput schema / properties / cell_range / description
      Added value: +"Range to read, e.g. \"A1:F500\". Omit for the whole sheet."
    • addedInput schema / properties / columns / description
      Added value: +"Only return these columns. Omit for all."
    • addedInput schema / properties / filter_query / description
      Added value: +"Condition on header names, e.g. \"Status == 'PAID' and Amount > 500\". Allowed: comparisons, and/or/not, in, arithmetic. Header names must be valid identifiers (no spaces)."
    • addedInput schema / properties / max_rows / description
      Added value: +"Return at most this many matching rows."
    • addedInput schema / properties / path / description
      Added value: +"File path or preloaded name (list_configured_files). Omit if only one file is preloaded."
    • addedInput schema / properties / sheet / description
      Added value: +"Sheet name (case-sensitive)."
  2. Addedv0.3.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered. The description adds real behavioral context beyond that: the required table shape with headers in row one, and the non-obvious detail that row_count counts all matches rather than the rows actually returned (which relates to the 'limited' flag). It stops short of describing pagination/truncation strategy or errors on non-table sheets.

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

Conciseness4/5

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

Front-loaded with the operation, then return shape, then sibling routing — efficient and scannable. Enumerating the return keys is mildly redundant since an output schema exists, which keeps it from a 5.

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

Completeness4/5

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

With a full output schema and complete parameter documentation, the description only needs to supply routing and preconditions, which it does. The one remaining ambiguity is what happens when the sheet is not table-shaped or the filter references a missing header, but that is a minor gap for a read-only tool.

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 all six parameters including filter_query syntax and max_rows defaults are already documented in the schema. The description only re-touches the header/table constraint and the row_count semantics; it adds no new meaning about path, columns, cell_range, or max_rows. Baseline 3 is appropriate.

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?

States a specific verb and resource ('Return only the rows of a table-shaped sheet ... that match a condition') plus the key precondition that the first row must be headers. It also explicitly separates itself from read_sheet and aggregate_sheet, so an agent can pick it without opening any other 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?

Gives explicit routing: use this instead of read_sheet when you need a subset of a large table, and use aggregate_sheet for totals per group. Both the when-to-use and the when-to-use-something-else conditions are named outright.

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