Skip to main content
If a dedicated tool covers the job, it beats hand-written SQL. It quotes identifiers for the engine in front of it, applies the user’s row limits, and runs on connections where raw execution is refused. All 48 publish a JSON Schema for input and output, so a client can validate both sides without reading this page. For the wire format, headers and error codes see MCP Protocol.

How to read this page

In the tables below, required arguments come first and optional ones follow in parentheses. Unless a row says otherwise:
  • connection_id is a connection UUID from list_connections.
  • database and schema default to whatever the connection is currently browsing, except that search_schema without schema looks in every schema. Passing them targets somewhere else without moving the app’s selection.
  • An unknown argument is rejected with -32602. There is no silent ignoring.
  • The result comes back twice: as JSON text in content[0], and as a typed object in structuredContent. Read structuredContent.
  • Timestamps are ISO 8601, error text is redacted, and “a result set” means columns[], rows[][], row_count, rows_affected, execution_time_ms, is_truncated, plus status_message, notes, database and schema when they apply.
A column a masking rule matches comes back masked in every tool that returns rows, browse_table, execute_query and export_data included. The mask replaces the value in rows[][]; columns[] and row_count are unchanged. A filter or sort in the request still runs on the stored values. A connection with rules also changes errors, plans and some text fields: see Masking rules. Row limits default to the server’s Default row limit setting (500) and are capped by Maximum row limit (10,000). Timeouts default to Query timeout (30 seconds) and are capped at 300. Both live in Settings > MCP. Whatever the row limit, rows also stop at the answer size limit.

Tool index

Scopes and gates

Fourteen tools need tools:write: connect, disconnect, switch_database, switch_schema, insert_rows, confirm_destructive_operation, transaction_control, create_database, drop_database_object, run_maintenance, stop_server_session, focus_query_tab, open_connection_window, open_table_tab. The other 34 need tools:read, execute_query among them until the statement writes. Past the scope, a call clears three more gates:
  1. Connection allowlist. A token limited to named connections gets -33007 for anything else.
  2. Connection policy. External Clients set to Blocked hides the connection: list_connections omits it and any tool that names it is refused. An AI policy of Never does the same, except that purpose: "display" still lists it. Otherwise the first call that touches a connection asks the user, as often as Settings > MCP > Approval says. That question is always a dialog on the user’s Mac, never an elicitation: a client that could answer it could also grant itself the connection. It has no deadline, so the client owns the timeout, and a refusal stands for 60 seconds before the question can be put again.
  3. Safe Mode. A write goes through the connection’s Safe Mode, which may ask the user to confirm it or to authenticate. See Approvals.
completion/complete clears the same connection policy without asking: on a connection this client is not approved for, it completes nothing. See Context matters. A call that opens a connection may also need approval on the Mac for a pre-connect script, environment variables, or local sign-in credentials. A refusal returns denied; an unanswered prompt returns timeout. confirm_destructive_operation needs admin as well, so it takes a Full Access token, and Read Only refuses it outright whatever the token carries. No token skips the user’s approval. Read Only refuses a statement classified as a write with denied. Reads also use the driver’s read-only mode where supported. What Read Only allows lists engine limits and the statements refused at every access level. Multiple statements return invalid_argument, except for SQL Server scripts sent to execute_query or confirm_destructive_operation. On SQL Server, an IF, WHILE or BEGIN ... END block holding one statement counts as one statement; a block holding more is multiple statements. At Safe Mode Read-Only, a read that calls a function TablePro cannot tell from a write is refused with denied on the engines Safe Mode names, whatever the token carries and whoever approved the call.

Masking rules

On a connection with masking rules, PostgreSQL, MySQL, MariaDB and local SQLite mask a cell by the table column it reads, so an alias is masked too. A column that reads no column of a user table comes back masked whole, whatever its name, and status_message names it. On engines that cannot trace a column, that is every column of a query. Schema tools such as describe_table return the structure as usual. The rules also withhold text that can repeat a stored value: The withheld-message sentence reads The statement failed with error 1146, SQLSTATE 42S02. Its message is withheld because this connection has masking rules, and the message can repeat a masked value., without the codes when there are none. The withheld-statement sentence reads The statement text is withheld because this connection has masking rules, and it can repeat a masked value.

Answer size

One answer holds at most 4 MB, measured after masking. The limit covers browse_table, execute_query, confirm_destructive_operation, explain_query, export_data, stop_server_session, search_query_history and the history resource. run_maintenance applies it to each statement’s result on its own.
  • A value longer than 64 KB keeps its first 64 KB and ends in [TablePro cut this value: N bytes in all], where N is its full size in bytes. A binary value counts its base64 length and keeps the base64 of its first 48 KB. export_data never cuts a value.
  • Rows keep their order. The first row that does not fit is left out, and so is every row after it.
  • is_truncated is true when the row limit or the size limit left rows out.
  • A result set, explain_query and export_data carry notes, an array of sentences saying why rows were left out or values cut. It is absent when neither happened.
To read a value that was cut, select part of it with a narrower query. To get more rows, ask for fewer columns.

Connections

switch_database and switch_schema move what the user sees: the sidebar, and the tab strip, which lists the tabs of the database or schema the connection is on. The user’s other tabs stay open under their own database. list_connections omits connections blocked for external clients, connections whose AI policy is Never, and connections outside the token’s allowlist. Its database is the session’s browsed database when connected, the saved default otherwise. The labels the user gave a connection come with it, so a client can show the list the way the app does: Entries are sorted by name, Finder style (db2 before db10), then by id.

Listing for display

A launcher that shows the user their connections passes purpose: "display". Leaving purpose out, or sending "agent", gives the list described here. purpose: "display" needs two things, or it fails with -33007 and data.requiredScopes set to ["connections:display"]:
  • a token issued with the connections:display scope, which only pairing grants;
  • Allow apps to list connections hidden from AI turned on under Settings > MCP > Connection Access. Turning it off stops every token at once.
The display list adds connections whose AI policy is Never. Blocked connections and connections outside the token’s allowlist stay out. Each entry has id, name, type, host, port, database, is_connected, tags, color, group and username, and no ai_policy, external_access or safe_mode. The scope only widens this list. Every other tool still refuses a connection whose AI policy is Never, so a launcher opens one with tablepro://connect/<id>, not over MCP. Keep the display list away from models: an AI feature in the same client calls list_connections without purpose. The two switch_ tools move what the user sees in TablePro. To run one statement elsewhere, pass database or schema to that tool instead.

Schema discovery

describe_table is the one call to make before writing SQL against an unfamiliar table. A column always carries name, data_type, is_nullable and is_primary_key, and picks up is_generated, default_value, extra, comment and allowed_values where the engine reports them; indexes and foreign keys work the same way. An index always carries name, columns, is_unique, is_primary, is_valid and type. is_valid is false for a PostgreSQL index whose build did not finish, such as one a failed CREATE INDEX CONCURRENTLY left behind: queries skip it and get_table_ddl leaves it out. include_row_counts defaults to false. Counts come from engine statistics rather than COUNT(*), and are fetched one table at a time, so list_tables skips them when the schema holds more than 200 objects. get_database_statistics leaves out a field the engine does not report. On PostgreSQL, table_count comes back only when database names the database the connection is browsing, and size_bytes only for a database the role has CONNECT on. list_routines takes kind as procedure or function, omitted for both, and its signature is the argument list, not the return type. list_triggers takes table to scope to one table, omitted for every trigger in the schema. list_types takes kind as enum, composite, domain, range, aliasType, tableType, clrType or udt, omitted for every kind; labels is set for an enum, fields for a composite or a udt, and base_type for a domain or range. PostgreSQL and PGlite answer with the first four kinds, SQL Server with aliasType, tableType and clrType, Cassandra and ScyllaDB with udt, and every other engine with no rows.

search_schema

Leave out schema to ask where something lives. Tables, views and other table-like objects are then searched in every schema of the database except the system ones such as pg_catalog, and columns in the current schema alone. Name a schema to search only that one, its columns included. On an engine without schemas, such as MySQL or SQLite, the search covers the whole database. Table matches come first, those in the current schema ahead of the rest, then column matches. Every match carries its schema, null on an engine without schemas. limit runs 1 to 500, default 50, and is_truncated is set only when more matches existed than it allowed. Two fields report what the search could not cover: A lost connection, or a database where no schema could be read, fails the call instead of returning part of an answer.

Reading data

browse_table

A filter is { column, operator, value, second_value, case_sensitive }. column and operator are required, second_value is the upper bound for BETWEEN, and case_sensitive defaults to whatever the operator normally does. logic is and (default) or or. The operator list is TablePro’s own filter vocabulary, published in the tool’s input schema as an enum; read it from tools/list rather than hardcoding it. Raw SQL filters are not available over MCP. A sort entry is { column, direction }, direction being ascending (default) or descending, and entries apply in the order given. offset defaults to 0. On an engine that cannot skip rows, such as Cloudflare R2 SQL, a nonzero offset is refused as an invalid argument and limit is lowered to the engine’s maximum. The result echoes the limit actually used and sets is_truncated when the rows reached it. Sorting on a column left out of columns appends it to the result. The columns you asked for keep the positions you asked for, and the sort column follows them, because some drivers can only order by a column they select.

count_rows

Without filters this returns the engine’s fast estimate unless exact is set. With filters it always counts for real, because an estimate cannot answer a filtered question.

execute_query

One statement, 100 KB at most. Destructive statements are refused here; use confirm_destructive_operation. With read_only: true, a statement that is not a read fails with denied before the user is asked anything, even on a connection set to Read & Write and with a token that carries tools:write. On MongoDB, a statement is a read only when it is one call with literal arguments, as Safe Mode describes; any other JavaScript is a write and needs tools:write. When the request carries a progressToken, the tool emits progress at 0.0 (resolving), 0.3 (executing) and 1.0 (done). On SQL Server, send the whole script instead. A variable exists only in the batch that declares it, so a DECLARE and the SELECTs that read it belong in one call. The script is cut into batches at its GO lines, as the query editor cuts it, and GO 5 runs a batch five times. The gates judge the script by its worst statement: one write anywhere needs tools:write and Safe Mode, and any destructive statement refuses the call. DECLARE and EXEC of a procedure count as writes, sp_help included. EXEC of a string and sp_executesql run server-side code and are refused. The top-level fields describe the first result set, with rows_affected counting the whole script. When the script returns more than one result set, result_sets[] lists every one in order, each with columns, rows, row_count and is_truncated. max_rows caps each result set on its own, while the size limit covers them all together. Once it is spent, the later batches still run, and their result sets come back with no rows and is_truncated set. status_message says when the script left a transaction open. A statement runs on the user’s own session, inside any transaction it holds. execute_query, confirm_destructive_operation and insert_rows follow these rules about it:
  • A statement that starts a transaction while one is open is refused, with or without Manual Commit.
  • While a transaction is open on PostgreSQL or CockroachDB, the statement runs inside SAVEPOINT tablepro_agent. A failure rolls back to the savepoint and leaves the user’s transaction usable. On Redshift, DuckDB and Teradata, where a failure would abort it, the statement is refused.
  • With Manual Commit on, a write stays pending until the user commits it in TablePro. It opens a transaction, or joins the one already open, and status_message says the change is pending. A write the connection cannot hold is refused.
  • With Manual Commit on, a statement that starts, ends or could hide transaction control is refused: BEGIN, COMMIT, ROLLBACK, SAVEPOINT, RELEASE, a procedure call, dynamic SQL, BT and ET on Teradata, and on SQL Server a transaction keyword anywhere in the batch.
  • When the open transaction ended while the statement ran, status_message says so.
  • On Teradata, a write that leaves a transaction open, as every change in an ANSI session does, gets a status_message saying so. The statements after it are refused until it is committed or rolled back.
  • An insert_rows call of several rows that joins an open transaction on PostgreSQL, CockroachDB, MySQL, MariaDB, SQLite, SQL Server or Oracle runs inside a savepoint, so a row that fails takes back the rows before it.
A batch that raises an error fails the call with the server’s message and line number. The batches after it do not run, and the error says what stays applied. On a connection with masking rules, the whole message is withheld.

explain_query

Pass the query with no EXPLAIN prefix. Without variant the engine’s first variant runs, and every result lists them in available_variants[]. analyze: true picks the variant that runs the statement, so an analyzed write needs tools:write and Safe Mode approval, and it is refused when the engine has no such variant or the variant you pass only estimates. An analyzed write goes into query history the way an execute_query write does. An engine missing from the support table is refused. plan_text and the plan rows share one answer, plan_text first. is_truncated appears, set to true, only when the size limit left plan rows out.

export_data

Formats are csv, json and sql; pass exactly one of query or tables[]. Without output_path the text comes back inline in each export entry. With it, the file lands in the user’s Downloads folder and never overwrites, so a name that is taken gets -1, -2 and so on; the path must stay inside Downloads, end in the format’s extension, and not name a hidden file. SQL output uses the connection’s own quoting and literal rules, so exporting a query needs sql_table to name the target table. Every table in one call shares one 4 MB answer, with or without output_path, and each table gets what the ones before it left. Values stay whole: a row that does not fit is left out with every row after it, so a later table can come back with no rows. Export fewer tables, columns or rows per call when is_truncated is set.

Writing data

insert_rows binds parameters. Its confirmation shows the values that will be written, and the approved values run in the named database and schema. Each row is an array with one value per column, and a call carries at most 1,000 rows. The transaction rules of execute_query apply: under Manual Commit the rows stay pending until the user commits them in TablePro, and status_message says so. confirm_destructive_operation runs one destructive statement, or a SQL Server script containing a destructive statement. This includes DROP, TRUNCATE, ALTER … DROP, and DELETE without WHERE. Other statements are rejected; use execute_query for those. The user approves it first, through your elicitation prompt if your client supports elicitation, otherwise through TablePro’s own dialog on their Mac. transaction_control takes action as begin, commit or rollback. The transaction stays open across calls until it is committed or rolled back, and it runs on the same session as the user’s own tabs, so their editor runs and their grid saves land inside it while it is open. TablePro shows it above the connection’s tabs and on its connections strip entry, with Roll Back and Commit, until it ends. Leave nothing open. begin is refused while a transaction is already open on the session, or while the session cannot say whether one is: commit or roll that one back first. On a connection with Manual Commit on, all three actions are refused, because the user commits there. On Redis the three actions are MULTI, EXEC and DISCARD. Every command between begin and commit answers QUEUED and does nothing until commit runs them, and commit fails naming each command the server then refused. rollback drops the block whole.

Databases and objects

create_database takes options as a flat object of string values drawn from describe_create_database_options, and asks the user before it runs. drop_database_object takes kind as database or schema, deletes everything inside, cannot be undone, and is approved first. run_maintenance takes an operation name from list_maintenance_operations (VACUUM, ANALYZE, OPTIMIZE and whatever else the engine supports) and omits table for the whole database. TablePro generates the statements and runs them in order, asking for approval before each one.
describe_create_database_options, list_maintenance_operations and list_session_contexts answer is_supported: false on an engine that has no such concept rather than failing, and list_partitions answers with an empty list. Everything else that an engine cannot do comes back as an unsupported tool error.

Server administration

get_server_dashboard reads the live panels TablePro shows, and runs on every engine with a Server Dashboard. Name the panels in panels[] or omit it for all three. A session carries id (the process id stop_server_session takes), user, database, state, duration_seconds, query, can_kill and can_cancel; a metric carries id, label, value, unit; a slow query carries duration, query, user, database. A panel the server could not answer is left out, and errors names it: one fixed sentence per panel, keyed by panel name. The server’s own message is not sent to the client; it goes to the app’s log, where the user can read it. When every requested panel fails, the call fails. get_table_health runs the Table Health checks on one database, in every schema, on PostgreSQL, MySQL and MariaDB. It is read-only: it runs no fix and records nothing in the tab’s history. outcome is completed, skipped or failed. A skipped check’s reason says why; a failed check’s is one fixed sentence, and the server’s own message goes to the app’s log. findings[] holds every finding of each completed check, ignored ones included. A metric carries id, label, type (count, bytes, percent as a fraction, date, text or flag) and value; a count past the 64-bit signed range comes as a string. On PostgreSQL size_bytes is the catalog’s estimate as of the last VACUUM, ANALYZE or index build. A redundant index whose covering index another finding drops comes without fix_sql, and fix_withheld_reason names that covering index, so applying every fix never removes both. status comes from the history the Table Health tab records: ignored when the user ignored the finding, new when the tab has run that check and did not report the finding the last time, none otherwise. The checks run under the Query timeout, and the call fails when they take longer. stop_server_session takes mode as cancel (default) to stop the running query or kill to end the session. SQL Server, ClickHouse, MySQL before 5.0 and Oracle before 18c take only kill: their sessions report can_cancel false, and cancel fails with invalid_argument. MongoDB takes only cancel, and kill fails the same way. The user always approves this one, whatever Safe Mode says. list_session_contexts reports session-level contexts the engine exposes, such as a Snowflake warehouse or role, with the value the session currently holds.

The user’s workspace

These read and drive the TablePro app itself, and none of them bypasses the connection allowlist or a blocked connection. list_recent_tabs and search_query_history without connection_id never ask the user. They cover only the connections this client reaches without a question, which depends on the Approval setting. With connection_id, the user is asked about that connection once, as for any call that names one. focus_query_tab asks about the tab’s connection before it raises the tab. Starred tables are a good hint at what matters in a database. list_recent_tabs takes limit from 1 to 500, default 20, and its tab_type is one of query, table, createTable, erDiagram, serverDashboard, insights, tableHealth, usersRoles, objectSource, versionHistory, tableListing. open_connection_window and open_table_tab connect first if they have to, and return once the window has a tab or fail after 8 seconds. open_table_tab without database_name or schema_name means the ones the connection is on, and its tab_id is that table’s tab, never a table of the same name elsewhere. search_query_history searches the history TablePro keeps on this Mac. Pass "" to match everything and filter by date alone; since and until are Unix epoch seconds, and limit runs 1 to 500, default 50. is_truncated is true when the size limit left out matching entries.

Annotations

Every tool ships MCP annotations so a client can decide what to auto-run:
  • readOnlyHint: true on the 29 tools that only read. execute_query is not one of them.
  • destructiveHint: true on confirm_destructive_operation, drop_database_object and stop_server_session.
  • idempotentHint: true where repeating the call is safe.
  • openWorldHint: true on the 14 that can reach the database server: every write except switch_database, switch_schema and focus_query_tab, plus execute_query, explain_query and export_data.

Errors

A tool that fails returns a successful JSON-RPC result with isError: true and a text body starting with a code: invalid_argument, not_connected, not_found, denied, timeout, unsupported, query_failed, user_cancelled, internal_failure. Protocol errors, with a JSON-RPC error envelope, are reserved for the request itself: a missing scope, an unknown tool, a bad header. The full table is in MCP Protocol.