Skip to main content
Glama
db-conn-mcp

db-conn-mcp

open_query_cursor

Read-only

Open a server-side cursor for a read-only SQL query to fetch large result sets in batches, retrieve rows until exhausted, and close the cursor early if needed.

Instructions

Open a server-side cursor over a read-only query for batched fetching.

Use for results too large for one execute_read_query response (that tool has no row cap). Then call fetch_rows with the cursor_id until exhausted is true, and close_cursor if you stop early.

Returns meta, cursor_id (for fetch_rows/close_cursor) and database. The cursor pins one read-only connection until closed (auto-reaped after 15 idle minutes). At most 5 cursors may be open: opening a sixth is an error, so close the ones you no longer need.

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": {
      "database": "<database>",
      "sql": "<sql>"
    },
    "name": "open_query_cursor"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesOne read-only SQL statement (SELECT, WITH, VALUES, ...). Put values in $1, $2, ... placeholders and pass them in `params`. Multiple statements are rejected.
paramsNoValues bound to the $1, $2, ... placeholders in `sql`, in order, as real driver bind parameters. Omit when the SQL has no placeholders.
databaseYesName of a configured database, exactly as list_databases returns it (case-sensitive). Not a DSN, host or server-side database name. An unknown name is an error that lists the configured names.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.8.1
    • addedInput schema / properties / database / description
      Added value: +"Name of a configured database, exactly as list_databases returns it (case-sensitive). Not a DSN, host or server-side database name. An unknown name is an error that lists the configured names."
    • addedInput schema / properties / params / description
      Added value: +"Values bound to the $1, $2, ... placeholders in `sql`, in order, as real driver bind parameters. Omit when the SQL has no placeholders."
    • addedInput schema / properties / sql / description
      Added value: +"One read-only SQL statement (SELECT, WITH, VALUES, ...). Put values in $1, $2, ... placeholders and pass them in `params`. Multiple statements are rejected."
  2. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations only cover the read-only, non-destructive safety profile; the description adds the operationally important behavior — the cursor pins one read-only connection until closed, is auto-reaped after 15 idle minutes, and a sixth concurrent cursor is an error. The `idempotentHint: false` implication (each open yields a distinct cursor) is consistent with the text. It does not say what happens to an open cursor on client disconnect, but the idle-reap note covers the main failure mode.

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?

Front-loaded single-sentence purpose, then usage, then return/limits in three tight blocks. Every clause carries an operational fact — no restatement of the title or filler.

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?

There is no output schema, and the description correctly enumerates the returned fields (`meta`, `cursor_id`, `database`). Combined with the lifecycle and concurrency limits, an agent has everything needed to open, drain and release a cursor; only edge cases like cursor expiry mid-fetch are unstated.

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 the schema already documents sql, params and database precisely (placeholders, case-sensitive configured name, unknown-name error). The description adds nothing specific about the three parameters beyond noting the returned `database`, so baseline 3 applies.

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 — opening a server-side cursor over a read-only query — and immediately names its purpose (batched fetching), which distinguishes it from execute_read_query, the whole-result sibling.

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 an explicit selection rule ('results too large for one execute_read_query response') plus the downstream sequence: call fetch_rows with the returned cursor_id until `exhausted`, and close_cursor if stopping early. The alternative and the exit path are both stated.

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