Skip to main content

Module drivers

Module drivers 

Source
Expand description

Driver-specific pool and transaction plugins for sqlx.

Three stateful plugins — SqlxPgPlugin, SqlxSqlitePlugin, SqlxMySqlPlugin — each holding named persistent pools and open transactions by Uuid handle. The agent calls pg__connect(url) to obtain a pool_id, then references that ID in subsequent tool calls.

§Architecture

Agent calls pg__connect(url)
    → PgPool stored in plugin.pools[uuid]
    → pool_id: Uuid returned

Agent calls pg__begin(pool_id)
    → Transaction<'static, Postgres> stored in plugin.transactions[uuid]
    → tx_id: Uuid returned

Agent calls pg__tx_execute(tx_id, sql)
    → transaction removed from registry, used, re-inserted on success or error
    → QueryResultData returned

Agent calls pg__commit(tx_id)
    → transaction removed and committed

All three plugins expose the same 14-tool surface under their respective namespaces (pg__, sqlite__, mysql__), generated by the [impl_driver_plugin!] macro.

Structs§

BeginResult
Response from *__begin: transaction handle.
ConnectParams
Parameters for *__connect: establish a new named pool.
ConnectResult
Response from *__connect: handle for subsequent tool calls.
PoolIdParams
Parameters for tools that reference a pool by ID.
PoolSqlParams
Parameters for direct-pool SQL execution tools.
PoolStatsResult
Response from *__pool_stats.
SqlxMySqlPlugin
Stateful MCP plugin for MySQL database operations.
SqlxPgPlugin
Stateful MCP plugin for PostgreSQL database operations.
SqlxSqlitePlugin
Stateful MCP plugin for SQLite database operations.
TxIdParams
Parameters for transaction lifecycle tools.
TxSqlParams
Parameters for transactional SQL execution tools.

Functions§

decode_mysql_row
Decode a sqlx::mysql::MySqlRow into a serializable RowData.
decode_pg_row
Decode a sqlx::postgres::PgRow into a serializable RowData.
decode_sqlite_row
Decode a sqlx::sqlite::SqliteRow into a serializable RowData.
mysql_args_from_json
Bind a slice of serde_json::Value into sqlx::mysql::MySqlArguments.
mysql_query_result
Convert a MySQL execute result to QueryResultData.
pg_args_from_json
Bind a slice of serde_json::Value into sqlx::postgres::PgArguments.
pg_query_result
Convert a Postgres execute result to QueryResultData.
sqlite_args_from_json
Bind a slice of serde_json::Value into sqlx::sqlite::SqliteArguments.
sqlite_query_result
Convert a SQLite execute result to QueryResultData.