tablex
v0.1.11Governed AI agent access to saved database connections: off until enabled, risky changes ask you.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_connections
List the saved connections with their type and the access you have on each. A connection with access `off` is listed by name only and cannot be opened or used until the user enables agent access for it.
open_session
Connect to a saved connection. Other tools need an open session. Needs agent access `schema_only` or more. With `pinned` true it opens a PINNED SESSION instead: a connection of its own (never shared with the connection's other session, the app or another session), returned as `session_id`. Use one when a task needs state to last across calls: `USE database` (MySQL, MariaDB, ClickHouse), `SET search_path` (PostgreSQL), a time zone, a character set, a lock timeout, user variables (`SET @x = 1`). Run the statements with `session_id`; every other call still runs on the shared session, which keeps…
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
pinned | boolean | Open a pinned session: a connection of its own that keeps `USE` and `SET`s between calls (default false). Needs access `read`. |
close_session
Close the session of a connection. Give `connection_id` for the connection's shared session or `session_id` for one pinned session (exactly one of them). Closing a pinned session drops its connection: every `USE` and `SET` it held is gone.
| Parameter | Type | Description |
|---|---|---|
connection_id | string | Connection id from list_connections. |
session_id | string | Close this pinned session (from open_session with `pinned` true) and drop its connection, instead of the connection's shared session. |
list_namespaces
List databases (no `database` given) or the schemas of a database. Engines without schemas return an empty list for a database.
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
cursor | string | `next_cursor` of the previous page. |
database | string | List the schemas of this database; omit to list databases. |
limit | integer | Items per page (default 100, at most 500). |
list_tables
List the tables and views of a namespace, sorted by name. `database` may be omitted when the connection has a single database; `schema` is needed for engines with schemas.
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
cursor | string | `next_cursor` of the previous page. |
database | string | Database name. |
filter | string | Case-insensitive substring of the table name. |
limit | integer | Items per page (default 100, at most 500). |
schema | string | Schema name. |
describe_table
Describe a table: columns with type, nullability and comment, primary key, unique columns, indexes, foreign keys and (when the database provides it) the DDL. On a MongoDB connection `table` is the collection (with `database`): it returns its indexes (and the createIndex calls that rebuild them in `ddl`); a collection has no columns.
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
table * | string | Table or view name. |
database | string | Database name. |
schema | string | Schema name. |
get_schema_context
A compact digest of every table of a namespace (columns, keys, foreign keys, comments) sized to `budget`. Stable between calls for the same schema. Over budget it drops comments, then non-key columns of the widest tables, then tables, and says what it omitted. `tables` picks the tables to describe and `max_tables` (1 to 20) caps how many. On a MongoDB connection it needs access `read`: a collection has no declared schema, so its fields and types are read from a sample of 20 documents of each (at most 20 collections).
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
budget | integer | Size limit in tokens (estimated; default 4000). |
database | string | Database name. |
max_tables | integer | Describe at most this many tables, from 1 to 20 (clamped). |
schema | string | Schema name. |
tables | array | Describe only these tables or collections, by exact name (at most 50). |
execute_query
Run exactly one SQL statement. Needs access `read` or more; a statement that changes data needs `read_write` and may be put to the user for approval when the connection allows it. A refusal or a decline is final for this request: do not retry the statement or reword it to get around it, tell the user instead. Multi-statement scripts are refused. At most 1000 rows (default 200) and a total size limit are returned; check `truncated`. Adding structure (CREATE TABLE, INDEX, VIEW, SEQUENCE, SCHEMA, TYPE; ALTER TABLE ... ADD COLUMN, CONSTRAINT or INDEX; COMMENT ON) is an ordinary change, approved li…
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
statement * | string | One SQL statement, or one MongoDB shell command on a MongoDB connection. |
cell_char_limit | integer | Characters of every string cell to return (default 2048 when only the offset is given, at most 4000). Larger or smaller values are clamped. |
cell_char_offset | integer | Characters to skip at the start of every string cell (default 0, at most 1000000): read a long value in pieces, following the `next cell_char_offset` its marker names; narrow the query to the one row… |
dangerous | boolean | Ask the user to approve a dangerous statement. |
database | string | Database to run in. |
lock_timeout_secs | integer | Seconds (1 to 600, and below the connection's statement timeout, 30 by default) to wait for a lock another session holds before the call fails with a lock-timeout error you can retry later. tablex app… |
row_limit | integer | Rows to return (default 200, at most 1000). |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
transaction_id | string | Run in this open transaction (from begin_transaction) instead of committing by itself; omit `database` then. |
execute_batch
Run several SQL statements in order on one connection, in one call. Needs access `read` or more; the script is split into statements and each is judged like execute_query: if one changes data the connection needs `read_write` and the user is asked ONCE to approve all the changes of the script together, before anything runs. A script with a statement that is not allowed (a dangerous one, which a script never runs: DROP, TRUNCATE, ALTER ... DROP, DELETE or UPDATE without WHERE ...; adding structure such as CREATE TABLE or ALTER TABLE ... ADD COLUMN is an ordinary change; a blocked function; BEGI…
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
script * | string | The statements, separated by `;`. |
cell_char_limit | integer | Characters of every string cell to return (default 2048 when only the offset is given, at most 4000). Larger or smaller values are clamped. |
cell_char_offset | integer | Characters to skip at the start of every string cell (default 0, at most 1000000): read a long value in pieces, following the `next cell_char_offset` its marker names; narrow the query to the one row… |
continue_on_error | boolean | Go on with the next statement after one fails (default: stop at the first failure). |
database | string | Database to run in. |
lock_timeout_secs | integer | Seconds (1 to 600, and below the connection's statement timeout, 30 by default) to wait for a lock another session holds before the call fails with a lock-timeout error you can retry later. tablex app… |
row_limit | integer | Rows to return per statement (default 200, at most 1000). |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
transaction_id | string | Run the script inside this open transaction (from begin_transaction) instead of committing by itself; omit `database` then. Not with `use_transaction` or `continue_on_error`. |
use_transaction | boolean | Run the whole script in a transaction of its own: committed when every statement succeeds, rolled back when one fails. Not with `continue_on_error` or `transaction_id`. |
explain_query
Show the execution plan of one SQL statement (EXPLAIN, never ANALYZE; the statement is not executed). Needs access `read` or more. Pass the statement without EXPLAIN. A call may name a pinned session (`session_id`) to run on a connection of its own, where USE and a few harmless SETs (search_path, time zone, character set, lock timeouts, user variables) persist between calls; see open_session.
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
statement * | string | The statement to explain, without EXPLAIN. |
database | string | Database to run in. |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
execute_redis_command
Run one Redis command line on a Redis connection. Reads need access `read`; a command that changes data needs `read_write` and may be put to the user for approval when the connection allows it. A refusal or a decline is final for this request: do not retry the command or reword it to get around it, tell the user instead. Some commands (KEYS, CONFIG, EVAL, FLUSHALL, ...) are never allowed. FLUSHDB is dangerous: see execute_query. A refusal says what to ask the user to change (a setting in tablex, or a client that supports MCP elicitation): tell the user, and never go around tablex by connecting…
| Parameter | Type | Description |
|---|---|---|
command * | string | One command, e.g. `GET user:1`. |
connection_id * | string | Connection id from list_connections. |
dangerous | boolean | Ask the user to approve a dangerous command. |
database | string | Redis database index, e.g. 0. |
row_limit | integer | Rows to return (default 200, at most 1000). |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
mongo_find
Query a collection of a MongoDB connection (find). Read-only: it never changes data. Needs access `read` or more. `database` and `collection` are required (list_namespaces and list_tables name them). `filter`, `projection` and `sort` are JSON documents as in the MongoDB shell; typed values use Extended JSON, e.g. {"_id": {"$oid": "..."}} or {"created": {"$gte": {"$date": "2024-01-31T00:00:00Z"}}}. The key order of `sort` is kept. Documents come back as relaxed Extended JSON. At most 1000 documents (default 200) and a total size limit are returned; check `truncated`, and narrow the filter or th…
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name. |
connection_id * | string | Connection id from list_connections. |
database * | string | Database name. |
filter | object | JSON as MongoDB takes it; typed values use Extended JSON, e.g. {"$oid": "..."}, {"$date": "2024-01-31T00:00:00Z"}, {"$numberLong": "123"}. |
limit | integer | Documents to return (at least 1; default 200, at most 1000). |
projection | object | Fields to return, e.g. {"name": 1, "_id": 0}. |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
skip | integer | Documents to skip (default 0). |
sort | object | Sort order, e.g. {"created_at": -1}. |
mongo_aggregate
Run an aggregation pipeline on a collection of a MongoDB connection. Read-only: a pipeline with a $out or $merge stage is refused, and nothing is ever written. Needs access `read` or more. `pipeline` is the stages in order, as JSON documents (typed values use Extended JSON, as in mongo_find). A final $limit is added, so at most 1000 documents (default 200) and a total size limit are returned; check `truncated`. A call may name a pinned session (`session_id`) to run on a connection of its own, where USE and a few harmless SETs (search_path, time zone, character set, lock timeouts, user variable…
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name. |
connection_id * | string | Connection id from list_connections. |
database * | string | Database name. |
pipeline * | array | The pipeline stages, in order. |
limit | integer | Documents to return (at least 1; default 200, at most 1000). |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
mongo_count
Count the documents of a collection of a MongoDB connection that match `filter` (all of them when it is omitted). Read-only. Needs access `read` or more. The filter is a JSON document, as in mongo_find. A call may name a pinned session (`session_id`) to run on a connection of its own, where USE and a few harmless SETs (search_path, time zone, character set, lock timeouts, user variables) persist between calls; see open_session.
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name. |
connection_id * | string | Connection id from list_connections. |
database * | string | Database name. |
filter | object | JSON as MongoDB takes it; typed values use Extended JSON, e.g. {"$oid": "..."}, {"$date": "2024-01-31T00:00:00Z"}, {"$numberLong": "123"}. |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
mongo_insert
Insert documents into a collection of a MongoDB connection. Needs access `read_write` and the user's permission to change data through this front end; the user is asked to approve the exact command before anything is sent. A refusal or a decline is final for this request: do not retry it or reword it to get around it, tell the user instead. At least 1 and at most 1000 documents, inserted in order (the first failure stops the rest). `documents` are JSON documents as in mongo_find; typed values use Extended JSON. Not available inside a transaction. The result has the number inserted (`n`) and an…
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name. |
connection_id * | string | Connection id from list_connections. |
database * | string | Database name. |
documents * | array | The documents to insert (1 to 1000). |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
mongo_update
Update documents of a collection of a MongoDB connection. Needs access `read_write` and the user's permission to change data through this front end; the user is asked to approve the exact command before anything is sent. A refusal or a decline is final for this request: do not retry it or reword it to get around it, tell the user instead. `filter` selects the documents (required; one that matches every document or cannot be checked (empty, `_id: {$exists: true}`, `$where`, `$expr`, a complementary `$or`) is refused unless `allow_all` is true, and the MCP server refuses it then on a production…
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name. |
connection_id * | string | Connection id from list_connections. |
database * | string | Database name. |
filter * | object | JSON as MongoDB takes it; typed values use Extended JSON, e.g. {"$oid": "..."}, {"$date": "2024-01-31T00:00:00Z"}, {"$numberLong": "123"}. |
allow_all | boolean | Allow a `filter` that matches every document or cannot be checked (empty, `$where`, `$expr`, `_id: {$exists: true}`, a complementary `$or`). |
many | boolean | Update every matching document, not only the first (default false). |
pipeline | array | An update pipeline, instead of `update`. |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
update | object | Update operators, e.g. {"$set": {"status": "paid"}}. |
upsert | boolean | Insert a document when nothing matches (default false). |
mongo_delete
Delete documents from a collection of a MongoDB connection. Needs access `read_write` and the user's permission to change data through this front end; the user is asked to approve the exact command before anything is sent. A refusal or a decline is final for this request: do not retry it or reword it to get around it, tell the user instead. `filter` selects the documents (required; one that matches every document or cannot be checked (empty, `_id: {$exists: true}`, `$where`, `$expr`, a complementary `$or`) is refused unless `allow_all` is true, and the MCP server refuses it then on a productio…
| Parameter | Type | Description |
|---|---|---|
collection * | string | Collection name. |
connection_id * | string | Connection id from list_connections. |
database * | string | Database name. |
filter * | object | JSON as MongoDB takes it; typed values use Extended JSON, e.g. {"$oid": "..."}, {"$date": "2024-01-31T00:00:00Z"}, {"$numberLong": "123"}. |
allow_all | boolean | Allow a `filter` that matches every document or cannot be checked (empty, `$where`, `$expr`, `_id: {$exists: true}`, a complementary `$or`). |
many | boolean | Delete every matching document, not only the first (default false). |
session_id | string | Run on this pinned session (the `session_id` open_session returned with `pinned` true) instead of the connection's shared session: the `USE` and `SET`s of its earlier calls apply to this one, and noth… |
list_routines
List the functions, procedures, triggers or events of a namespace, sorted by name. `database` may be omitted when the connection has a single database; `schema` is needed for engines with schemas. Each item has a `ref` to pass to get_routine_source. A database without objects of that kind returns an empty list. SQL databases only.
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
kind * | string | Which objects to list. |
cursor | string | `next_cursor` of the previous page. |
database | string | Database name. |
filter | string | Case-insensitive substring of the name. |
limit | integer | Items per page (default 100, at most 500). |
schema | string | Schema name. |
get_routine_source
The CREATE statement or source text of one function, procedure, trigger or event. Pass the `ref` from list_routines, or `kind` and `name` (with `database` and `schema` as for list_tables, `arguments` for a PostgreSQL overload, `table` for a trigger). The source is cut to a size limit. SQL databases only.
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
arguments | string | Input argument types of a PostgreSQL overload, e.g. `integer, text`. |
database | string | Database name. |
kind | string | Kind of object, when no `ref` is given. |
name | string | Object name, when no `ref` is given. |
ref | object | |
schema | string | Schema name. |
table | string | The table of a trigger. |
begin_transaction
Begin a transaction on a PostgreSQL, MySQL, MariaDB, SQLite or DuckDB connection, on a session of its own. Needs access `read_write` and the user's permission to change data through this front end. Run statements in it with execute_query and `transaction_id`; nothing a write does is committed until commit_transaction, and the user is asked to approve the commit with the list of changes. One open transaction per connection, a few in all. A transaction is rolled back after 5 minutes without a call on it, and when its connection's session is closed. Always end it with commit_transaction or rollba…
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
commit_transaction
Commit an open transaction and close its session. When statements changed data the user is asked to approve the commit with the list of those statements; a decline is final: the transaction stays open, nothing is committed, roll it back. A transaction with no changes is committed without asking. A PostgreSQL transaction that hit an error cannot be committed: roll it back. A refusal says what to ask the user to change (a setting in tablex, or a client that supports MCP elicitation): tell the user, and never go around tablex by connecting to the database yourself.
| Parameter | Type | Description |
|---|---|---|
transaction_id * | string | From begin_transaction. |
rollback_transaction
Roll back an open transaction (undoing everything it changed) and close its session. No approval needed. A transaction that is already gone (rolled back after the idle timeout) answers `rolled_back` false.
| Parameter | Type | Description |
|---|---|---|
transaction_id * | string | From begin_transaction. |
open_table
Show a table, view or MongoDB collection to the user: tablex reveals it in its sidebar and opens it in a data tab, as a double click does. Nothing is read for you and no data is returned: use it when the user should look at the data. Needs access `schema_only` or more, and tablex has to be running; the connection is opened by tablex if needed. The answer means tablex took the request up, not that the table has loaded.
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
database * | string | Database name (for MongoDB, the database of the collection). |
object * | string | Table, view or collection name. |
schema | string | Schema name; leave out for a database without schemas (MySQL, MariaDB, SQLite, MongoDB). |
execute_and_show
Put a query in a new editor tab of tablex, where the user sees it, and run it there so the user sees the result. Needs access `read` or more, and tablex has to be running. A query that is run (`run` true, the default) must be a single read; it runs under tablex's own rules, which may ask the user to confirm first or refuse (production or read-only connections), and the user answers in tablex. A query that changes data, a script with several statements or a MongoDB script is not run from here: call with `run` false to only put it in the editor for the user to run, or use execute_query (a danger…
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
query * | string | The query text for the editor (SQL, a Redis command or a MongoDB script). |
database | string | Database to open the tab on; leave out for the connection's own database. |
run | boolean | Run it now (default true); false only puts it in the editor. |
add_connection
Add a saved connection to tablex. The user is asked to approve every call and sees the name, kind, address and connection type (never the password); a refusal or a decline is final: do not retry it, tell the user. Give either `uri` or the fields (`host`, `port`, `database`, `user`; SQLite and DuckDB: `path`, an absolute file path). The `uri` must not hold a password and only takes routing and TLS options (e.g. sslmode, authSource); give the password as `password`, which is saved in the credential store (without it the connection has none saved and tablex asks for it when connecting). SSH tunne…
| Parameter | Type | Description |
|---|---|---|
kind * | string | Database engine. |
name * | string | Display name, at most 128 characters, one line; not used by another connection. |
connection_type | string | Id or name of a connection type; default development. |
database | string | Database name (Redis: the database number). |
host | string | Host name or address (not SQLite or DuckDB). |
options | object | |
password | string | Password to save in the credential store; never shown to the user or logged. |
path | string | SQLite or DuckDB: absolute path of the database file. |
port | integer | Port, 1 to 65535; leave out for the engine's default. |
ssl | boolean | Encrypt the connection with TLS (true: `require`, on MongoDB `verify_full`) or not (false: `disable`); not SQLite or DuckDB. For the finer choice use `options.tls`; the two must agree when both are gi… |
uri | string | Connection URI without a password, instead of the fields (e.g. postgresql://app@db.local:5432/shop). |
user | string | User name. |
duplicate_connection
Copy a saved connection under a new name. The user is asked to approve every call; a refusal or a decline is final. The copy has the same address, options and type and its saved password (when the original has one); it does not get the original's own access setting, so what you may do on it follows its connection type, and the call is refused when that would be more than you may do on the original. The copy's SSH tunnel secrets are not copied. The name must not be in use (case-insensitive). A refusal says what to ask the user to change (a setting in tablex, or a client that supports MCP elicit…
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |
name * | string | Display name of the copy, at most 128 characters, one line. |
remove_connection
Remove a saved connection from tablex, with its saved passwords and pinned objects, and close your session on it. The user is asked to approve every call, and the question says when the connection is a production one; a refusal or a decline is final. It cannot be undone. A refusal says what to ask the user to change (a setting in tablex, or a client that supports MCP elicitation): tell the user, and never go around tablex by connecting to the database yourself.
| Parameter | Type | Description |
|---|---|---|
connection_id * | string | Connection id from list_connections. |