Skip to main content
Glama
db-conn-mcp

db-conn-mcp

fetch_rows

Read-only

Fetch the next batch of rows from an open query cursor to page through large result sets. Returns rows, row count, and an exhausted flag, and closes the cursor once fully drained.

Instructions

Fetch the next N rows from an open cursor (see open_query_cursor).

Returns meta, rows, row_count, exhausted and cursor_closed; meta.database is null, since a cursor_id names no database. The cursor closes itself once fully drained, and also when the read fails: the error is raised and the cursor_id stops working, so re-open the query to read again. Fetch one batch at a time: a call made while another is running on the same cursor is refused, and the cursor and the running call carry on.

Rows arrive on the text channel only, inside the untrusted-data banner: this tool emits no structuredContent. Values render as on execute_read_query (bytea as \x hex text).

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": {
      "cursor_id": "<cursor_id>"
    },
    "name": "fetch_rows"
  }
}

Input Schema

NameRequiredDescriptionDefault
nNoHow many rows to fetch in this batch (default 100).
cursor_idYesThe cursor_id returned by open_query_cursor. An id that was fully read, closed, failed or reaped after 15 idle minutes is an error.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.8.1
    • addedInput schema / properties / cursor_id / description
      Added value: +"The cursor_id returned by open_query_cursor. An id that was fully read, closed, failed or reaped after 15 idle minutes is an error."
    • addedInput schema / properties / n / description
      Added value: +"How many rows to fetch in this batch (default 100)."
  2. First observed

TDQS

A4.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=false and destructiveHint=false, and the description goes well beyond that: it discloses that meta.database is null, that the cursor self-closes when drained or on error, that a failed read invalidates the cursor_id, that concurrent calls on the same cursor are refused without killing either call, and that results arrive only on the text channel inside an untrusted-data banner with no structuredContent. That is genuine behavioral value over the annotations, though it does not discuss pagination cost or throughput.

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

Conciseness5/5

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

Purpose and the sibling pointer are front-loaded in the first sentence; the remaining lines each add a distinct operational fact (return shape, closure semantics, concurrency rule, transport/format). No filler or repetition of the annotations.

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 no output schema, the description correctly enumerates the returned fields (meta, rows, row_count, exhausted, cursor_closed) and explains the text-channel formatting, which is what an agent needs to parse results. Minor gap: it does not say how to tell when to stop other than via exhausted, nor how large n can safely be.

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?

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning: n is framed as a batch size within a sequential drain ("next N rows", "one batch at a time") and cursor_id is tied to its lifecycle (closes on drain or failure, then stops working). It reinforces rather than merely repeats the schema text.

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 ("Fetch the next N rows") plus the precise precondition ("from an open cursor"), and points to open_query_cursor as the source of the cursor_id. An agent can distinguish this from execute_read_query or sample_table_rows 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 Guidelines4/5

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

Makes the usage chain explicit: the cursor must come from open_query_cursor, one batch should be fetched at a time, and if the cursor closes or fails the agent must re-open the query rather than retry. It does not name an explicit alternative for other read patterns (e.g. execute_read_query), so it stops short of the full when/when-not routing of a 5.

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