stdin: {"id":1,"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{},"clientInfo":{"name":"toolwitness","version":"s772-v0"},"protocolVersion":"2025-11-25"}} {"jsonrpc":"2.0","method":"notifications/initialized"} {"id":2,"jsonrpc":"2.0","method":"tools/list","params":{}} stdout: {"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2025-11-25","capabilities":{"tools":{}},"serverInfo":{"name":"dbmcp","title":"Database MCP Server","version":"0.18.1","description":"Database MCP Server for MySQL and MariaDB","websiteUrl":"https://dbmcp.haymon.ai"},"instructions":"## Workflow\n\n1. Call `listDatabases` to discover available databases.\n2. Call `listTables` to see tables. Pass `search` to filter by name (case-insensitive substring). Pass `detailed: true` to get columns, constraints, indexes, and triggers in the same call.\n3. Call `listViews` to see views.\n4. Call `listTriggers` to see triggers.\n5. Call `listFunctions` to see stored functions.\n6. Call `listProcedures` to see stored procedures.\n7. Use `readQuery` for read-only SQL (SELECT, SHOW, DESCRIBE, EXPLAIN).\n8. Use `explainQuery` to analyze query execution plans and diagnose slow queries.\n\nPer-database tools default to the active database; pass `database` to target another.\n\n## Constraints\n\n- The server runs in read-only mode. Data and schema changes are not possible.\n- Multi-statement queries are not supported. Send one statement per request.\n"}} {"jsonrpc":"2.0","id":2,"result":{"tools":[{"name":"explainQuery","title":"Explain Query","description":"Return the execution plan for a SQL query to diagnose performance. Use this tool instead of running EXPLAIN directly through readQuery — it provides structured output.\n\n\nUse when:\n- A query runs slowly and you need to understand why\n- Investigating performance bottlenecks\n- Planning index creation to optimize queries\n- Analyzing join methods, table scan strategies, and sort operations\n\n\n\n- Running actual queries → use readQuery, or writeQuery for data changes (not available in read-only mode)\n- Checking table structure → use listTables(detailed=true)\n\n\n\n✓ \"Why is my SELECT on orders slow?\" → explainQuery(query=\"SELECT ...\")\n✓ \"Should I add an index?\" → explainQuery with analyze=true\n✗ \"Run this SELECT\" → use readQuery\n\n\n\nSet `analyze` to true for actual execution statistics (EXPLAIN ANALYZE).\nIMPORTANT: EXPLAIN ANALYZE actually executes the query! In read-only mode, only read-only statements are allowed with analyze.\nWhen analyze is false, returns EXPLAIN FORMAT=JSON output without executing.\nOnly a single SQL statement is accepted.\n\n\n\nA JSON array of execution plan rows showing access methods, join types, row estimates, and costs.\n\nLong string values are cut and end in `…[truncated, N chars total]`, and rows past the response size cap are dropped and counted in `rowsOmitted`; when either happens the response carries `truncated: true` and a `hint`.\n","inputSchema":{"properties":{"analyze":{"default":false,"description":"If true, use EXPLAIN ANALYZE for actual execution statistics. In read-only mode, only allowed for read-only statements. Defaults to false.","type":"boolean"},"database":{"default":null,"description":"Database to explain against. Defaults to the active database.","type":["string","null"]},"query":{"description":"The SQL query to explain.","type":"string"}},"required":["query"],"type":"object"},"outputSchema":{"properties":{"hint":{"description":"How to fetch less data; present only when `truncated` is `true`.","type":["string","null"]},"rows":{"description":"Result rows, each a JSON object keyed by a column name.","items":{"additionalProperties":true,"type":"object"},"type":"array"},"rowsOmitted":{"description":"Rows the response cap dropped that no cursor can fetch again.","format":"uint64","minimum":0,"type":["integer","null"]},"truncated":{"description":"Present and `true` when a character cap cut a value or dropped rows.","type":"boolean"}},"required":["rows"],"type":"object"},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":true}},{"name":"listDatabases","title":"List Databases","description":"List all accessible databases on the connected server. Use this tool to discover what databases are available before using other tools.\n\n\nALWAYS call this tool FIRST when:\n- You need to explore what databases exist on the server\n- You need a database name for listTables or query tools\n- The user asks what data is available\n\n\n\n✓ \"What databases are on this server?\"\n✓ \"Show me what's available\" → call listDatabases first\n\n\n\nA sorted JSON array of database name strings.\n\n\n\nPaginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page.\n","inputSchema":{"properties":{"cursor":{"default":null,"description":"Opaque cursor from a prior response's `nextCursor`; omit for the first page.","type":["string","null"]}},"type":"object"},"outputSchema":{"properties":{"databases":{"description":"Sorted list of database names for this page.","items":{"type":"string"},"type":"array"},"nextCursor":{"description":"Opaque cursor pointing to the next page. Absent when this is the final page.","type":"string"}},"required":["databases"],"type":"object"},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"listFunctions","title":"List Functions","description":"List user-defined SQL functions in a database, optionally filtered and/or with full metadata. Loadable UDFs (`mysql.func`) and stored procedures are excluded.\n\n\nUse when:\n- Auditing stored functions across a database (brief mode, default).\n- Searching for a function by partial name (pass `search`).\n- Inspecting a function's language, signature, return type, determinism, SQL-data-access classification, security mode, definer, comment, session context, and full reconstructed `CREATE FUNCTION` text before reasoning about correctness or invocation safety (pass `detailed: true`). Detailed mode supersedes ad-hoc `readQuery` against `information_schema.ROUTINES` / `information_schema.PARAMETERS`.\n\n\n\n- `database` — Database to target. Defaults to the active database.\n- `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`.\n- `search` — Case-insensitive filter on function names via `LIKE`. `%` matches any sequence; `_` matches a single character.\n- `detailed` — When `true`, returns full metadata objects keyed by function name instead of bare name strings. Default `false`.\n\n\n\n✓ \"What functions are in the mydb database?\" → listFunctions(database=\"mydb\")\n✓ \"Find the order-total calculation\" → listFunctions(search=\"order\")\n✓ \"What does calc_order_total do?\" → listFunctions(search=\"calc_order_total\", detailed=true)\n✗ \"List stored procedures\" → use listProcedures instead\n✗ \"List loadable UDFs from mysql.func\" → not supported; only routines in information_schema.ROUTINES are returned\n\n\n\nBrief mode (default): a sorted JSON array of function-name strings, e.g. `[\"calc_order_subtotal\", \"calc_order_total\", \"double_it\"]`.\nDetailed mode: a JSON object keyed by bare function name (MySQL/MariaDB do not allow function overloading, so no signature suffix is needed); each value carries `schema`, `language` (typically `\"SQL\"`; MariaDB external-language functions report the external language name), `arguments` (comma-separated `name type` pairs from `information_schema.PARAMETERS`, empty string for zero-parameter functions), `returnType` (full `DTD_IDENTIFIER` including length/precision/unsigned/enum/set members), `deterministic` (boolean), `sqlDataAccess` (one of `CONTAINS_SQL`, `NO_SQL`, `READS_SQL_DATA`, `MODIFIES_SQL_DATA`), `security` (`INVOKER` or `DEFINER`), `definer` (`user@host`), `description` (the `COMMENT` text or `null` when no comment was set — the empty string MySQL stores is coerced to JSON `null`), `definition` (the canonical reconstructed `CREATE FUNCTION` text including `DEFINER=` in `` `user`@`host` `` form), `sqlMode`, `characterSetClient`, `collationConnection`, and `databaseCollation`. Versus the Postgres detailed payload: `volatility`, `parallelSafety`, and `strict` are intentionally absent (no MySQL/MariaDB analogues), `owner` is renamed to `definer` (more accurate for the MySQL `DEFINER` concept), keys are bare names rather than `name(arguments)` (no overloads possible), and the four session-context fields (`sqlMode`, `characterSetClient`, `collationConnection`, `databaseCollation`) are MySQL/MariaDB-only additions.\n\n\n\nPaginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. The `search` filter must stay the same across pages for cursor continuity.\n","inputSchema":{"properties":{"cursor":{"default":null,"description":"Opaque cursor from a prior response's `nextCursor`; omit for the first page.","type":["string","null"]},"database":{"default":null,"description":"Database to list functions from. Defaults to the active database.","type":["string","null"]},"detailed":{"default":false,"description":"When `true`, each returned entry is a full metadata object (schema, language,\narguments, returnType, deterministic, sqlDataAccess, security, definer,\ndescription, definition, sqlMode, characterSetClient, collationConnection,\ndatabaseCollation); when `false` or omitted, each entry is the bare\nfunction-name string.","type":"boolean"},"search":{"default":null,"description":"Optional case-insensitive filter on function names. The input is used within a `LIKE`\nclause: `%` matches any sequence of characters and `_` matches any single character.","type":["string","null"]}},"type":"object"},"outputSchema":{"properties":{"entries":{"anyOf":[{"description":"Brief mode: sorted array of bare entity-name strings.","items":{"type":"string"},"type":"array"},{"additionalProperties":true,"description":"Detailed mode: name-keyed map; insertion order matches the SQL `ORDER BY` sort.","type":"object"}],"description":"Page of matching entries. Shape depends on the request's `detailed` flag."},"nextCursor":{"description":"Opaque cursor pointing to the next page. Absent when this is the final page.","type":"string"}},"required":["entries"],"type":"object"},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"listProcedures","title":"List Procedures","description":"List user-defined stored procedures in a database, optionally filtered and/or with full metadata. Stored functions and loadable UDFs (`mysql.func`) are excluded.\n\n\nUse when:\n- Auditing stored procedures across a database (brief mode, default).\n- Searching for a procedure by partial name (pass `search`).\n- Inspecting a procedure's language, parameter list (with `IN`/`OUT`/`INOUT` modes), determinism, SQL-data-access classification, security mode, definer, comment, session context, and full reconstructed `CREATE PROCEDURE` text before reasoning about correctness or invocation safety (pass `detailed: true`). Detailed mode supersedes ad-hoc `readQuery` against `information_schema.ROUTINES` / `information_schema.PARAMETERS`.\n\n\n\n- `database` — Database to target. Defaults to the active database.\n- `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`.\n- `search` — Case-insensitive filter on procedure names via `LIKE`. `%` matches any sequence; `_` matches a single character.\n- `detailed` — When `true`, returns full metadata objects keyed by procedure name instead of bare name strings. Default `false`.\n\n\n\n✓ \"What procedures are in the mydb database?\" → listProcedures(database=\"mydb\")\n✓ \"Find the order archival routine\" → listProcedures(search=\"archive\")\n✓ \"What does archive_order do?\" → listProcedures(search=\"archive_order\", detailed=true)\n✗ \"List functions\" → use listFunctions instead\n✗ \"List loadable UDFs from mysql.func\" → not supported; only routines in information_schema.ROUTINES are returned\n\n\n\nBrief mode (default): a sorted JSON array of procedure-name strings, e.g. `[\"archive_order\", \"archive_order_history\", \"purge_order_archive\", \"touch_post\"]`.\nDetailed mode: a JSON object keyed by bare procedure name (MySQL/MariaDB do not allow procedure overloading, so no signature suffix is needed); each value carries `schema`, `language` (typically `\"SQL\"`; MariaDB external-language procedures report the external language name), `arguments` (comma-separated `MODE name type` triples from `information_schema.PARAMETERS` — `MODE` is one of `IN`, `OUT`, `INOUT`; empty string for zero-parameter procedures), `deterministic` (boolean), `sqlDataAccess` (one of `CONTAINS_SQL`, `NO_SQL`, `READS_SQL_DATA`, `MODIFIES_SQL_DATA`), `security` (`INVOKER` or `DEFINER`), `definer` (`user@host`), `description` (the `COMMENT` text or `null` when no comment was set — the empty string MySQL stores is coerced to JSON `null`), `definition` (the canonical reconstructed `CREATE PROCEDURE` text including `DEFINER=` in `` `user`@`host` `` form; no `RETURNS` clause — procedures have no return type), `sqlMode`, `characterSetClient`, `collationConnection`, and `databaseCollation`. Versus the Postgres `listProcedures` detailed payload: `volatility`, `parallelSafety`, `strict`, and `returnType` are intentionally absent (no MySQL/MariaDB analogues for the first three; procedures have no return type for the fourth — the Postgres-side payload also omits all four), `owner` is renamed to `definer` (more accurate for the MySQL `DEFINER` concept), keys are bare names rather than `name(arguments)` (no overloads possible), the four session-context fields (`sqlMode`, `characterSetClient`, `collationConnection`, `databaseCollation`) are MySQL/MariaDB-only additions, and `deterministic` plus `sqlDataAccess` are MySQL/MariaDB-only additions versus the Postgres `listProcedures` detailed payload (which omits both because Postgres procedures have no equivalent attributes).\n\n\n\nPaginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. The `search` filter must stay the same across pages for cursor continuity.\n","inputSchema":{"properties":{"cursor":{"default":null,"description":"Opaque cursor from a prior response's `nextCursor`; omit for the first page.","type":["string","null"]},"database":{"default":null,"description":"Database to list procedures from. Defaults to the active database.","type":["string","null"]},"detailed":{"default":false,"description":"When `true`, each returned entry is a full metadata object (schema, language,\narguments with IN/OUT/INOUT mode tokens, deterministic, sqlDataAccess, security,\ndefiner, description, definition, sqlMode, characterSetClient,\ncollationConnection, databaseCollation); when `false` or omitted, each entry\nis the bare procedure-name string.","type":"boolean"},"search":{"default":null,"description":"Optional case-insensitive filter on procedure names. The input is used within a `LIKE`\nclause: `%` matches any sequence of characters and `_` matches any single character.","type":["string","null"]}},"type":"object"},"outputSchema":{"properties":{"entries":{"anyOf":[{"description":"Brief mode: sorted array of bare entity-name strings.","items":{"type":"string"},"type":"array"},{"additionalProperties":true,"description":"Detailed mode: name-keyed map; insertion order matches the SQL `ORDER BY` sort.","type":"object"}],"description":"Page of matching entries. Shape depends on the request's `detailed` flag."},"nextCursor":{"description":"Opaque cursor pointing to the next page. Absent when this is the final page.","type":"string"}},"required":["entries"],"type":"object"},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"listTables","title":"List Tables","description":"List tables in a database, optionally filtered and/or with full metadata.\n\n\nUse when:\n- Exploring a database to find relevant tables (brief mode, default).\n- Searching for a table by partial name (pass `search`).\n- Inspecting a table's columns, constraints, indexes, and triggers before writing a query (pass `detailed: true`).\n\n\n\n- `database` — Database to target. Defaults to the active database.\n- `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`.\n- `search` — Case-insensitive filter on table names via `LIKE`. `%` matches any sequence; `_` matches a single character.\n- `detailed` — When `true`, returns full metadata objects keyed by table name instead of bare name strings. Default `false`.\n\n\n\n✓ \"What tables are in mydb?\" → listTables(database=\"mydb\")\n✓ \"Find the orders table\" → listTables(search=\"order\")\n✓ \"What columns does orders have?\" → listTables(search=\"orders\", detailed=true)\n\n\n\nBrief mode (default): a sorted JSON array of table-name strings, e.g. `[\"customers\", \"orders\"]`.\nDetailed mode: a JSON object keyed by table name; each value carries `schema`, `kind`, `owner`, `comment`, `columns`, `constraints`, `indexes`, and `triggers` (the name is the key and is not repeated inside the value). Keys iterate in the same alphabetical order brief mode uses. Example: `{\"orders\": {\"schema\": \"mydb\", \"kind\": \"TABLE\", …}}`.\n\n\n\nPaginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. The `search` filter must stay the same across pages for cursor continuity.\n","inputSchema":{"properties":{"cursor":{"default":null,"description":"Opaque cursor from a prior response's `nextCursor`; omit for the first page.","type":["string","null"]},"database":{"default":null,"description":"Database to list tables from. Defaults to the active database.","type":["string","null"]},"detailed":{"default":false,"description":"When `true`, each returned entry is a full metadata object (columns,\nconstraints, indexes, triggers, owner, comment, kind); when `false` or\nomitted, each entry is the bare table-name string.","type":"boolean"},"search":{"default":null,"description":"Optional case-insensitive filter on table names. The input is used within a `LIKE`\nclause: `%` matches any sequence of characters and `_` matches any single character.","type":["string","null"]}},"type":"object"},"outputSchema":{"properties":{"entries":{"anyOf":[{"description":"Brief mode: sorted array of bare entity-name strings.","items":{"type":"string"},"type":"array"},{"additionalProperties":true,"description":"Detailed mode: name-keyed map; insertion order matches the SQL `ORDER BY` sort.","type":"object"}],"description":"Page of matching entries. Shape depends on the request's `detailed` flag."},"nextCursor":{"description":"Opaque cursor pointing to the next page. Absent when this is the final page.","type":"string"}},"required":["entries"],"type":"object"},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"listTriggers","title":"List Triggers","description":"List user-defined triggers in a database, optionally filtered and/or with full metadata.\n\n\nUse when:\n- Auditing trigger coverage across a database (brief mode, default).\n- Searching for a trigger by partial name (pass `search`).\n- Inspecting a trigger's timing, event, activation level, full `CREATE TRIGGER` text, and the session context active at trigger-creation time before reasoning about side-effects (pass `detailed: true`). Detailed mode supersedes ad-hoc `readQuery` against `information_schema.TRIGGERS`.\n\n\n\n- `database` — Database to target. Defaults to the active database.\n- `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`.\n- `search` — Case-insensitive filter on trigger names via `LIKE`. `%` matches any sequence; `_` matches a single character.\n- `detailed` — When `true`, returns full metadata objects keyed by trigger name instead of bare name strings. Default `false`.\n\n\n\n✓ \"What triggers are in the mydb database?\" → listTriggers(database=\"mydb\")\n✓ \"Find the audit triggers\" → listTriggers(search=\"audit\")\n✓ \"What does orders_audit_after_insert do?\" → listTriggers(search=\"orders_audit_after_insert\", detailed=true)\n✗ \"Show me a trigger's body\" → use detailed mode; the `definition` field carries the full `CREATE TRIGGER` text\n\n\n\nBrief mode (default): a sorted JSON array of trigger-name strings, e.g. `[\"customers_audit_after_insert\", \"orders_audit_after_insert\"]`.\nDetailed mode: a JSON object keyed by trigger name; each value carries `schema`, `table`, `timing` (BEFORE/AFTER), `events` (single-element array — `INSERT`, `UPDATE`, or `DELETE`), `activationLevel` (always `ROW` on MySQL/MariaDB), `definition` (the canonical `CREATE TRIGGER` text including `DEFINER=` in `` `user`@`host` `` form), `sqlMode`, `characterSetClient`, `collationConnection`, and `databaseCollation`. The Postgres-only `status` and `functionName` fields are intentionally absent (no per-trigger enabled/disabled flag and no separate handler-function reference on MySQL/MariaDB); the four session-context fields are MySQL/MariaDB-only additions versus the Postgres detailed payload.\n\n\n\nPaginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. The `search` filter must stay the same across pages for cursor continuity.\n","inputSchema":{"properties":{"cursor":{"default":null,"description":"Opaque cursor from a prior response's `nextCursor`; omit for the first page.","type":["string","null"]},"database":{"default":null,"description":"Database to list triggers from. Defaults to the active database.","type":["string","null"]},"detailed":{"default":false,"description":"When `true`, each returned entry is a full metadata object (schema, table, timing,\nevents, activationLevel, definition, plus backend-specific fields); when `false` or\nomitted, each entry is the bare trigger-name string.","type":"boolean"},"search":{"default":null,"description":"Optional case-insensitive filter on trigger names. The input is used within a `LIKE`\nclause: `%` matches any sequence of characters and `_` matches any single character.","type":["string","null"]}},"type":"object"},"outputSchema":{"properties":{"entries":{"anyOf":[{"description":"Brief mode: sorted array of bare entity-name strings.","items":{"type":"string"},"type":"array"},{"additionalProperties":true,"description":"Detailed mode: name-keyed map; insertion order matches the SQL `ORDER BY` sort.","type":"object"}],"description":"Page of matching entries. Shape depends on the request's `detailed` flag."},"nextCursor":{"description":"Opaque cursor pointing to the next page. Absent when this is the final page.","type":"string"}},"required":["entries"],"type":"object"},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"listViews","title":"List Views","description":"List user-defined views in a database, optionally filtered and/or with full metadata. Base tables and system-schema views are excluded.\n\n\nUse when:\n- Auditing views across a database (brief mode, default).\n- Searching for a view by partial name (pass `search`).\n- Inspecting a view's definer, security mode, check-option level, updatable flag, session character set/collation, and full SELECT body before querying it (pass `detailed: true`). Detailed mode supersedes ad-hoc `readQuery` against `information_schema.VIEWS`.\n\n\n\n- `database` — Database to target. Defaults to the active database.\n- `cursor` — Opaque pagination cursor; echo the prior response's `nextCursor`.\n- `search` — Case-insensitive filter on view names via `LIKE`. `%` matches any sequence; `_` matches a single character.\n- `detailed` — When `true`, returns full metadata objects keyed by view name instead of bare name strings. Default `false`.\n\n\n\n✓ \"What views are in the mydb database?\" → listViews(database=\"mydb\")\n✓ \"Find the active-users view\" → listViews(search=\"active\")\n✓ \"What does active_users select?\" → listViews(search=\"active_users\", detailed=true)\n✗ \"Show me the columns of a view\" → use listTables with `detailed: true` instead\n✗ \"List materialized views\" → MySQL/MariaDB have no materialized-view concept\n\n\n\nBrief mode (default): a sorted JSON array of view-name strings, e.g. `[\"active_orders\", \"active_users\", \"published_posts\"]`.\nDetailed mode: a JSON object keyed by bare view name; each value carries `schema`, `definer` (`user@host`), `security` (`INVOKER` or `DEFINER`), `checkOption` (`NONE`, `CASCADED`, or `LOCAL`), `updatable` (boolean), `characterSetClient`, `collationConnection`, and `definition` (the SELECT body verbatim from `information_schema.VIEWS.VIEW_DEFINITION`, with no `CREATE VIEW` wrapper). The view name is the map key only — it is not repeated inside the value.\n\nVersus the Postgres `listViews` detailed payload: `description` is intentionally absent (neither MySQL nor MariaDB exposes a user-comment column for views — `CREATE VIEW` syntax has no `COMMENT` clause), `algorithm` is intentionally absent (MariaDB-only column on `information_schema.VIEWS`), `owner` is renamed to `definer` (more accurate for the MySQL `DEFINER` concept), and the five MySQL/MariaDB-only structured fields (`security`, `checkOption`, `updatable`, `characterSetClient`, `collationConnection`) are added. The `definition` field shape is byte-identical to Postgres — raw SELECT body verbatim, no DDL wrapper. When the connected role lacks the `SHOW VIEW` privilege on a particular view, the engine redacts `VIEW_DEFINITION` to the empty string; the row remains in the response with `definition` reflecting that empty value.\n\n\n\nPaginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. The `search` filter must stay the same across pages for cursor continuity. Brief and detailed modes share the same `TABLE_NAME` row order, so a client can switch `detailed` between pages without losing position.\n","inputSchema":{"properties":{"cursor":{"default":null,"description":"Opaque cursor from a prior response's `nextCursor`; omit for the first page.","type":["string","null"]},"database":{"default":null,"description":"Database to list views from. Defaults to the active database.","type":["string","null"]},"detailed":{"default":false,"description":"When `true`, each returned entry is a full metadata object (schema, definer,\nsecurity, checkOption, updatable, characterSetClient, collationConnection,\ndefinition); when `false` or omitted, each entry is the bare view-name string.","type":"boolean"},"search":{"default":null,"description":"Optional case-insensitive filter on view names. The input is used within a `LIKE`\nclause: `%` matches any sequence of characters and `_` matches any single character.","type":["string","null"]}},"type":"object"},"outputSchema":{"properties":{"entries":{"anyOf":[{"description":"Brief mode: sorted array of bare entity-name strings.","items":{"type":"string"},"type":"array"},{"additionalProperties":true,"description":"Detailed mode: name-keyed map; insertion order matches the SQL `ORDER BY` sort.","type":"object"}],"description":"Page of matching entries. Shape depends on the request's `detailed` flag."},"nextCursor":{"description":"Opaque cursor pointing to the next page. Absent when this is the final page.","type":"string"}},"required":["entries"],"type":"object"},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":false}},{"name":"readQuery","title":"Read Query","description":"Execute a read-only SQL query. Allowed statements: SELECT, SHOW, DESCRIBE, EXPLAIN.\n\n\nUse when:\n- Querying data from tables (SELECT with WHERE, JOIN, GROUP BY, etc.)\n- Aggregations: COUNT, SUM, AVG, GROUP BY, HAVING\n- Listing server variables or status (SHOW)\n- Viewing table structure (DESCRIBE)\n\n\n\n- Data changes (INSERT, UPDATE, DELETE) → use writeQuery (not available in read-only mode)\n- Query performance analysis → use explainQuery\n- Discovering tables or columns → use listTables (pass detailed=true for column-level metadata)\n- Switching database context (USE is rejected) → pass the `database` argument\n\n\n\n✓ \"SELECT * FROM users WHERE status = 'active'\"\n✓ \"SELECT COUNT(*) FROM orders GROUP BY region\"\n✓ \"SHOW TABLES\" or \"DESCRIBE users\"\n✗ \"INSERT INTO users ...\" → use writeQuery (not available in read-only mode)\n✗ \"EXPLAIN SELECT ...\" → use explainQuery for structured analysis\n\n\n\nA JSON array of row objects, each keyed by column name.\n\nLong string values are cut and end in `…[truncated, N chars total]`; read the rest with `SUBSTRING`/`SUBSTR`. Rows past the response size cap are dropped: a `SELECT` page ends early and `nextCursor` resumes at the first row left out, while other statements report the count in `rowsOmitted`. When either happens the response carries `truncated: true` and a `hint`.\n\n\n\n`SELECT` results are paginated. Pass the prior response's `nextCursor` as `cursor` to fetch the next page. Order by a unique key so pages neither skip nor repeat rows. `SHOW`, `DESCRIBE`, and `EXPLAIN` return a single page and ignore `cursor`.\n\n\n\nEach call stops at the configured query timeout. On a timeout, check the plan with explainQuery before retrying: filter on indexed columns, or limit inner result sets before joining or aggregating. For a query known to be slow, pass `timeout` (seconds, at least 1) to allow more time. This only helps if the server allows a higher maximum, which is often the same as the default; a value above it is rejected with an error naming the maximum.\n","inputSchema":{"properties":{"cursor":{"default":null,"description":"Opaque cursor from a prior response's `nextCursor`; omit for the first page.","type":["string","null"]},"database":{"default":null,"description":"Database to run the query against. Defaults to the active database.","type":["string","null"]},"query":{"description":"The SQL query to execute.","type":"string"},"timeout":{"default":null,"description":"Seconds this call may run, from 1 up to the server maximum. Defaults to the configured query timeout.","format":"uint64","minimum":1,"type":["integer","null"]}},"required":["query"],"type":"object"},"outputSchema":{"properties":{"hint":{"description":"How to fetch less data; present only when `truncated` is `true`.","type":["string","null"]},"nextCursor":{"description":"Opaque cursor pointing to the next page. Absent when this is the final\npage, when the result fits in one page, or when the statement is a\nnon-`SELECT` kind that does not paginate (e.g. `SHOW`, `EXPLAIN`).","type":"string"},"rows":{"description":"Result rows, each a JSON object keyed by a column name.","items":{"additionalProperties":true,"type":"object"},"type":"array"},"rowsOmitted":{"description":"Rows the response cap dropped that no cursor can fetch again.","format":"uint64","minimum":0,"type":["integer","null"]},"truncated":{"description":"Present and `true` when a character cap cut a value or dropped rows.","type":"boolean"}},"required":["rows"],"type":"object"},"annotations":{"readOnlyHint":true,"destructiveHint":false,"idempotentHint":true,"openWorldHint":true}}]}}