Skip to main content
Glama

gws-mcp__sheets_query

Read-only

Run a query in the Google Sheets QUERY() language over a spreadsheet range and get back only the matching rows, in ONE call. Use this instead of reading a whole tab and filtering the values yourself: select A, D where I = 'open' order by A desc limit 20 returns the twenty rows you wanted and nothing else. The language supports select, where, group by, pivot, order by, limit, offset, label and format, with count, sum, avg, min and max. Columns are addressed by their SHEET letter (A, B, C), the same letter the column has in the tab, not its position inside the range; Col1-style names are also accepted and mapped to the range's columns in order (on Tab!C1:F500, Col1 is C). Text values are compared with quotes: where B = 'high' or where B contains 'urgent'. A column that mixes numbers and text is read as whichever type most of its cells hold, and the cells of the other type come back empty: that is the query endpoint's own rule and cannot be turned off, so read such a column with sheets_read or sheets_find_rows instead. Read-only: nothing in the spreadsheet changes. The result carries the header the query produced, the rows, the row count and the echoed query; an empty match is an empty rows array.

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": {
      "spreadsheet_id": "<spreadsheet_id>",
      "query": "<query>"
    },
    "name": "gws-mcp__sheets_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
queryYesThe query, in the QUERY() language, e.g. "select A, C, F where F = 'open' and C > 3 order by C desc" or "select B, count(A) group by B". Columns by sheet letter; strings in single quotes.
rangeNoWhat the query runs over: a tab name on its own queries that whole tab (the simplest correct call), or A1 notation naming a real tab, e.g. "TabName!A1:F500". A bare word that is the name of a tab is that tab, even when it also reads as a cell ("Q3", "Log"). A tab that does not exist is refused with the list of tabs. Omitted, the first tab is queried.
accountNoOptional email address of the connected account to use (e.g. 'user@gmail.com'). If omitted, the default account is used.
has_header_rowNoDefault true: the first row of the range is headers, so the result names its columns by those headers and the header row is never returned as data. Set false when the range is pure data; columns are then named by letter.
spreadsheet_idYesThe spreadsheet ID

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Beyond the readOnlyHint annotation it discloses real behavior: the mixed number/text column coercion rule, that this rule is the endpoint's own and cannot be turned off, and that an empty match yields an empty rows array rather than an error. The 'nothing in the spreadsheet changes' line merely restates the annotation, and pagination/response-size limits for large results are not addressed, keeping it short of a 5.

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?

The key point and the concrete example are front-loaded, and each subsequent sentence covers a distinct gotcha (column naming, quoting, mixed types, result shape). It is on the long side and repeats some ground already covered by the schema, which keeps it from a 5, but no sentence is filler.

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?

With no output schema, the description supplies the return shape itself: the produced header, the rows, the row count and the echoed query. Combined with the read-only assurance, the type-coercion caveat and the empty-result behavior, an agent has everything needed to call this correctly and interpret the response.

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 coverage is 100%, so the baseline is 3 and every parameter is already documented in the schema, including the tab-vs-A1 range rules and the has_header_row default. The description adds genuine meaning on column addressing — sheet letters rather than in-range position, and the Col1-style mapping worked through a concrete Tab!C1:F500 example — but it largely mirrors what the query and range schema fields already say.

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 first sentence gives a specific verb (run a query), the exact resource (a spreadsheet range via the Sheets QUERY() language) and the outcome (only matching rows, in one call). It explicitly contrasts itself with the pull-the-whole-tab-then-filter approach and later names sheets_read and sheets_find_rows, so an agent can place it among its Sheets siblings without opening any 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 states the positive condition (you want a filtered/ordered/aggregated subset in one call) and the negative one (don't read a whole tab and filter locally). It also routes away from this tool in a specific failure case: mixed-type columns should be read with sheets_read or sheets_find_rows instead, which is an explicit exclusion with a named alternative.

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.