list_connections
Retrieve a list of all configured database connections in the MariaDB MCP Server, enabling you to view available connections for running queries or managing schemas.
Instructions
Lists configured MariaDB connections.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.js:44-65 (handler)Handler for list_connections tool: iterates over all configured connections, retrieves each connection config via db.getConnectionConfig(), and returns an array of connection details (name, description, host, port, database, read/write permissions, timeout, and row limits).
case "list_connections": { const list = allConnections.map((connectionName) => { const c = db.getConnectionConfig(connectionName); return { name: connectionName, description: c.description, host: c.host, port: c.port, database: c.database, read: c.read, write: c.write, ...(c.statement_timeout_ms > 0 && { statement_timeout_ms: c.statement_timeout_ms, }), ...(c.default_row_limit > 0 && { default_row_limit: c.default_row_limit, }), ...(c.max_row_limit > 0 && { max_row_limit: c.max_row_limit }), }; }); return ok(list); } - src/tools.js:7-11 (schema)Tool definition schema for list_connections: declares the tool name, description ('Lists configured MariaDB connections.'), and an empty inputSchema (no required parameters).
{ name: "list_connections", description: "Lists configured MariaDB connections.", inputSchema: { type: "object", properties: {} }, }, - src/index.js:31-37 (registration)Tool registration via ListToolsRequestSchema handler which calls buildToolDefinitions() to return all tool definitions including list_connections.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: buildToolDefinitions( readableConnections, writableConnections, allConnections, ), })); - src/db.js:25-34 (helper)Helper method getConnectionConfig() used by the list_connections handler to retrieve configuration details for each named connection.
getConnectionConfig(name) { const cfg = this.config.connections[name]; if (!cfg) { const available = this.getConnectionNames().join(", "); throw new Error( `Connection not found: '${name}'. Available connections: ${available}`, ); } return cfg; } - src/db.js:9-11 (helper)Helper method getConnectionNames() used by the list_connections handler to get all configured connection names.
getConnectionNames() { return Object.keys(this.config.connections); }