list_connections
Lists available database connections in the current session, showing name, engine type, and accessible databases. Triggers authentication if not yet connected.
Instructions
List the database connections available in the current session. Returns the name (pass to query_database / list_schema via the connection argument), engine type (mariadb or mssql), and the databases each connection grants access to. Calling this will trigger authentication if not yet connected.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/tools.ts:135-165 (handler)The `listConnections` function returns a ToolDef with handler that gets the OAuth token from deps.creds.get(), maps each connection's name, engine, databases and expires_at to a JSON response.
function listConnections(deps: Deps): ToolDef { return { name: 'list_connections', description: 'List the database connections available in the current session. Returns the ' + 'name (pass to `query_database` / `list_schema` via the `connection` argument), engine ' + 'type (`mariadb` or `mssql`), and the databases each connection grants access to. ' + 'Calling this will trigger authentication if not yet connected.', inputSchema: { type: 'object', additionalProperties: { not: {} }, }, async handler() { try { const token = await deps.creds.get(); const out = token.connections.map((c) => ({ name: c.name, engine: c.engine, databases: c.databases, expires_at: c.expiresAt.getTime() === 0 ? undefined : c.expiresAt.toISOString().replace(/\.\d+Z$/u, 'Z'), })); return toolText(JSON.stringify(out, null, 2)); } catch (err) { return toolError(`authorize failed: ${(err as Error).message}`); } }, }; } - src/mcp/tools.ts:143-146 (schema)Input schema for list_connections: empty object with no additional properties (no arguments required).
inputSchema: { type: 'object', additionalProperties: { not: {} }, }, - src/mcp/tools.ts:23-31 (registration)The `buildTools()` function registers `listConnections(deps)` as one of five tools in the returned array.
export function buildTools(deps: Deps): ToolDef[] { return [ connectionStatus(deps), disconnect(deps), listConnections(deps), listSchema(deps), queryDatabase(deps), ]; }