# MCP tool reference

> All 16 SQLEye MCP tools with arguments, limits, truncation, access class and example calls and results, including read-only mode behaviour.

Source: https://sqleye.com/docs/ai-agents/tools/ · Last updated: 2026-11-29 · Publisher: CodeROG (https://coderog.com)

SQLEye's MCP server offers 16 tools: 8 that only read, 7 that change something and 1 that deletes. Every argument is validated strictly, and an unknown argument is an error rather than ignored.

## Which tools exist?

| Tool | Does | Access |
|---|---|---|
| `list_engine_versions` | List PostgreSQL and MySQL versions SQLEye can run and whether each is installed. | read |
| `install_engine_version` | Download and install an engine version. May need your approval. | write |
| `list_instances` | List instances with status, port and capture state. | read |
| `create_instance` | Create an instance from an installed version. Does not start it. | write |
| `start_instance` | Start a stopped instance. | write |
| `stop_instance` | Stop a running instance. | write |
| `update_instance` | Rename, change port (instance must be stopped) or set auto-start. | write |
| `delete_instance` | Delete an instance; data goes to the Trash. May need your approval. | destructive |
| `get_connection_string` | Get the local connection URL. | read |
| `set_capture` | Turn capture on or off for an instance. | write |
| `get_queries` | Recent captured queries with filters. | read |
| `get_query_shapes` | Queries grouped by shape, ordered by total time. | read |
| `get_nplusone_groups` | Detected N+1 groups. | read |
| `get_connections` | Current client connections. | read |
| `explain_query` | Execution plan for one statement. Never runs it. | read |
| `clear_queries` | Clear the captured history. | write |

In [read-only mode](/docs/ai-agents/security/#what-does-read-only-mode-do) only the `read` tools are listed. Each tool carries the MCP annotations `readOnlyHint` and, for the others, `destructiveHint`; all set `openWorldHint` to false.

## How do tools refer to an instance?

Every tool that takes `id` accepts the instance id or its exact name, matched without regard to case. If several instances share a name the call fails and asks for the id. Ask `list_instances` first.

## How big can a result be?

| Limit | Value |
|---|---|
| `limit` argument | integer 1 to 500, default 50 (`get_queries`, `get_query_shapes`, `get_nplusone_groups`) |
| SQL text and shape text | cut at 2,048 bytes; the full size is given in `sqlLength`, `shapeLength` or `sampleSqlLength` and a flag such as `sqlTruncated` is set |
| Error text | cut at 512 bytes, with `errorLength` and `errorTruncated` |
| One result | at most 256 KB of JSON; items beyond that are dropped, and `truncated` is set (or a `note` explains) |
| `get_connections` | at most 200 connections, current SQL cut at 2,048 bytes |
| `explain_query` plan | cut at 256 KB with `truncated` set |

`get_queries` reads from the instance's in-memory buffer, 50,000 events by default (see [settings](/docs/settings/)).

## Instance tools

### `list_engine_versions`

No arguments. Returns `versions`, each with `engine`, `version`, `installed` and `downloadSizeBytes`.

### `install_engine_version`

| Argument | Type | Notes |
|---|---|---|
| `engine` | string, required | `postgres` or `mysql` (`postgresql` is also accepted). |
| `version` | string, required | A version from `list_engine_versions`, for example `"17.12"`. |

If the version is already installed it returns `{"installed": true, "note": "already installed"}` without asking. Otherwise, with **Ask before downloading an engine** on, SQLEye asks you first. Without approval the tool returns an error saying you declined. The download is hundreds of MB and progress shows in the app.

### `list_instances`

No arguments. Returns `instances` with the fields shown in the app.

```json
{"instances":[{"id":"a1b2c3","name":"shop-pg","engine":"postgres","version":"17.12","port":5432,"status":"running","captureEnabled":true,"autoStart":false,"createdAt":"2026-12-01T09:30:00.000Z"}]}
```

The values above are illustrative.

### `create_instance`

| Argument | Type | Notes |
|---|---|---|
| `name` | string, required | |
| `engine` | string, required | `postgres` or `mysql`. |
| `version` | string, required | Must already be installed. |
| `port` | integer, optional | 1024 to 65535. A free port is chosen if omitted. |

Returns `{"instance": …}`. The instance is created stopped.

### `start_instance`, `stop_instance`

Argument: `id` (required). Returns the instance after the change.

### `update_instance`

| Argument | Type | Notes |
|---|---|---|
| `id` | string, required | |
| `name` | string | New name. |
| `port` | integer | 1024 to 65535. The instance must be stopped. |
| `autoStart` | boolean | Turns [auto-start](/docs/instances/auto-start/) on or off for the instance. |

At least one of `name`, `port` and `autoStart` is required, otherwise the call fails with "nothing to update".

### `delete_instance`

Argument: `id` (required). With **Ask before deleting an instance** on, SQLEye asks first. On approval the instance is removed and its data directory moved to the system Trash where supported. Returns `{"deleted": "<name>", "note": …}`. If you decline, nothing is deleted.

### `get_connection_string`

Argument: `id` (required). Returns `{"connectionString": "postgresql://postgres@127.0.0.1:5432/postgres"}` for PostgreSQL or `mysql://root@127.0.0.1:<port>` for MySQL. There is no password. See [connect](/docs/connect/).

## Live Eye tools

### `set_capture`

| Argument | Type | Notes |
|---|---|---|
| `id` | string, required | |
| `enabled` | boolean, required | |

Capture is off by default and adds some overhead to the database. It can be enabled only while the instance runs, as in the app. See [capture](/docs/live-eye/capture/).

### `get_queries`

Recent captured queries, oldest first within the newest matches.

| Argument | Type | Notes |
|---|---|---|
| `id` | string, required | |
| `withinSeconds` | number > 0 | Only queries that finished in the last N seconds. |
| `since` | string | Only queries after this ISO 8601 UTC time ending in `Z`, such as `2026-01-01T10:00:00Z`. |
| `afterId` | integer ≥ 0 | Only queries with an id greater than this. Use it to poll for new ones. |
| `slowOnly` | boolean | Only [slow queries](/docs/live-eye/slow-queries/). |
| `nPlusOneOnly` | boolean | Only queries in an [N+1 group](/docs/live-eye/n-plus-one/). |
| `errorsOnly` | boolean | Only failed statements. |
| `text` | string | Case-insensitive substring of the SQL. |
| `limit` | integer 1–500 | Default 50. |

If both `since` and `withinSeconds` are given, the later cut-off applies. When more queries match than `limit`, the newest are returned and a `note` says so. With no events, the note explains that capture must be on.

```json
{"totalMatching":212,"returned":2,"limit":2,"note":"Only the newest matches are returned; narrow the filters or use afterId to page.","queries":[
 {"id":1841,"timestamp":"2026-12-01T10:02:11.402Z","durationMs":1.8,"fingerprintHash":"9f3a1c0b7d2e4a55","connectionId":"4127","slow":false,"sql":"select * from comments where post_id = 17","rows":3,"database":"shop","nPlusOneGroup":"g3"},
 {"id":1842,"timestamp":"2026-12-01T10:02:11.405Z","durationMs":1.6,"fingerprintHash":"9f3a1c0b7d2e4a55","connectionId":"4127","slow":false,"sql":"select * from comments where post_id = 18","rows":2,"database":"shop","nPlusOneGroup":"g3"}]}
```

The values are illustrative. Each query can also carry `user`, `application`, `error`, and for MySQL `rowsExamined` and `noIndexUsed`.

### `get_query_shapes`

Arguments: `id` (required), `limit` (1–500, default 50). Shapes are queries with their literals replaced, see [query shapes](/docs/live-eye/query-shapes/). Ordered by total time, highest first. This is the best first call for "what is slow or repeated?".

```json
{"totalShapes":14,"returned":1,"truncated":false,"shapes":[{"fingerprintHash":"9f3a1c0b7d2e4a55","count":212,"totalMs":341.7,"avgMs":1.6,"maxMs":9.2,"lastSeen":"2026-12-01T10:02:15.100Z","nPlusOneHits":211,"shape":"select * from comments where post_id = ?"}]}
```

The values are illustrative.

### `get_nplusone_groups`

Arguments: `id` (required), `limit` (1–500, default 50). Returns groups with the most time spent first. The detection rules (default 5 repeats within 1000 ms on one connection) are the app's [N+1 settings](/docs/live-eye/n-plus-one/).

```json
{"totalGroups":1,"returned":1,"truncated":false,"groups":[{"group":"g3","fingerprintHash":"9f3a1c0b7d2e4a55","connectionId":"4127","count":211,"totalMs":338.4,"firstSeen":"2026-12-01T10:02:11.402Z","lastSeen":"2026-12-01T10:02:11.980Z","sampleQueryIds":[1841,1842,1843,1844,1845],"shape":"select * from comments where post_id = ?","sampleSql":"select * from comments where post_id = 17"}]}
```

The values are illustrative. Groups are derived from the events still in the buffer.

### `get_connections`

Argument: `id` (required). Returns `connections` with `connectionId`, `state`, `since` and, when known, `user`, `database`, `application`, `clientAddr` and `currentSql`.

### `explain_query`

| Argument | Type | Notes |
|---|---|---|
| `id` | string, required | |
| `sql` | string, required | One SELECT, INSERT, UPDATE or DELETE statement. |
| `database` | string, optional | The database to plan against. |

Returns `{"plan": "…", "truncated": false}`. The statement is never executed and `ANALYZE` is never used, so the plan is an estimate. Anything that is not one of the four statement types is rejected. This is not a way to run SQL. See [Explain](/docs/live-eye/explain/).

### `clear_queries`

Argument: `id` (required). Clears the captured history for the instance. Returns `{"cleared": true}`. Useful before re-running a test.

## How are errors reported?

Argument errors and refusals come back as a tool result with `isError` set and a plain message, for example "missing required argument `id`", "`limit` must be between 1 and 500" or "unknown argument `bogus`". Errors from the app are prefixed with their code. A call to an unknown tool is a protocol error.
