Skip to main content
Glama
srthkdev

DBeaver MCP Server

by srthkdev

drop_table

Remove a database table using DBeaver connections with built-in safety confirmation to prevent accidental data loss.

Instructions

Remove a table from the database with safety confirmation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
confirmYesSafety confirmation flag (must be true)
connectionIdYesThe ID or name of the DBeaver connection
tableNameYesName of the table to drop

Implementation Reference

  • The main handler function that executes the drop_table tool logic: validates inputs, checks safety confirmation, verifies table existence, constructs and executes DROP TABLE query via DBeaver client.
    private async handleDropTable(args: { connectionId: string; tableName: string; confirm: boolean }) { const connectionId = sanitizeConnectionId(args.connectionId); const tableName = args.tableName; if (!tableName) { throw new McpError(ErrorCode.InvalidParams, 'Table name is required'); } if (!args.confirm) { return { content: [{ type: 'text' as const, text: JSON.stringify({ success: false, message: 'Safety confirmation required. Set confirm=true to proceed with dropping the table.' }, null, 2), }], }; } const connection = await this.configParser.getConnection(connectionId); if (!connection) { throw new McpError(ErrorCode.InvalidParams, `Connection not found: ${connectionId}`); } // Check if table exists first try { await this.dbeaverClient.getTableSchema(connection, tableName); } catch (error) { throw new McpError(ErrorCode.InvalidParams, `Table '${tableName}' does not exist or cannot be accessed`); } const dropQuery = `DROP TABLE "${tableName}"`; const result = await this.dbeaverClient.executeQuery(connection, dropQuery); return { content: [{ type: 'text' as const, text: JSON.stringify({ success: true, message: `Table '${tableName}' dropped successfully`, executionTime: result.executionTime }, null, 2), }], }; }
  • Tool definition including name, description, and input schema specifying required parameters: connectionId, tableName, and confirm boolean.
    { name: 'drop_table', description: 'Remove a table from the database with safety confirmation', inputSchema: { type: 'object', properties: { connectionId: { type: 'string', description: 'The ID or name of the DBeaver connection', }, tableName: { type: 'string', description: 'Name of the table to drop', }, confirm: { type: 'boolean', description: 'Safety confirmation flag (must be true)', }, }, required: ['connectionId', 'tableName', 'confirm'], }, },
  • src/index.ts:512-517 (registration)
    Switch case in CallToolRequestSchema handler that dispatches to the handleDropTable method based on tool name.
    case 'drop_table': return await this.handleDropTable(args as { connectionId: string; tableName: string; confirm: boolean });

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