Skip to main content
Glama
srthkdev

DBeaver MCP Server

by srthkdev

test_connection

Verify connectivity to DBeaver database connections by testing if the specified connection can be established successfully.

Instructions

Test connectivity to a DBeaver connection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionIdYesThe ID or name of the DBeaver connection to test

Implementation Reference

  • Primary handler function for the 'test_connection' tool. It sanitizes the connection ID, retrieves the connection configuration, tests the connection via dbeaverClient, and returns the test result as JSON.
    private async handleTestConnection(args: { connectionId: string }) { const connectionId = sanitizeConnectionId(args.connectionId); const connection = await this.configParser.getConnection(connectionId); if (!connection) { throw new McpError(ErrorCode.InvalidParams, `Connection not found: ${connectionId}`); } const testResult = await this.dbeaverClient.testConnection(connection); return { content: [{ type: 'text' as const, text: JSON.stringify(testResult, null, 2), }], }; }
  • src/index.ts:377-390 (registration)
    Tool registration in the listTools response, defining the name, description, and input schema for 'test_connection'.
    { name: 'test_connection', description: 'Test connectivity to a DBeaver connection', inputSchema: { type: 'object', properties: { connectionId: { type: 'string', description: 'The ID or name of the DBeaver connection to test', }, }, required: ['connectionId'], }, },
  • Dispatch case in the CallToolRequestHandler that routes 'test_connection' calls to the handleTestConnection method.
    case 'test_connection': return await this.handleTestConnection(args as { connectionId: string });
  • Core helper method in DBeaverClient that performs the actual connection test by executing a database-specific test query and returning success/error details.
    async testConnection(connection: DBeaverConnection): Promise<ConnectionTest> { const startTime = Date.now(); try { // Simple test query based on database type const testQuery = this.getTestQuery(connection.driver); const result = await this.executeQuery(connection, testQuery); return { connectionId: connection.id, success: true, responseTime: Date.now() - startTime, databaseVersion: this.extractVersionFromResult(result) }; } catch (error) { return { connectionId: connection.id, success: false, error: error instanceof Error ? error.message : String(error), responseTime: Date.now() - startTime }; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/srthkdev/dbeaver-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server