open_query_cursor
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
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | One read-only SQL statement (SELECT, WITH, VALUES, ...). Put values in $1, $2, ... placeholders and pass them in `params`. Multiple statements are rejected. | |
| params | No | Values bound to the $1, $2, ... placeholders in `sql`, in order, as real driver bind parameters. Omit when the SQL has no placeholders. | |
| database | Yes | 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. |