Skip to main content
Glama
srthkdev

DBeaver MCP Server

by srthkdev

create_table

Execute CREATE TABLE statements to add new database tables using existing DBeaver connections, enabling structured data storage without additional configuration.

Instructions

Create new tables in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionIdYesThe ID or name of the DBeaver connection
queryYesCREATE TABLE statement

Implementation Reference

  • The handler function that validates the CREATE TABLE query and executes it using the DBeaver client, returning success status and execution time.
    private async handleCreateTable(args: { connectionId: string; query: string }) { const connectionId = sanitizeConnectionId(args.connectionId); const query = args.query.trim(); if (!query.toLowerCase().startsWith('create table')) { throw new McpError(ErrorCode.InvalidParams, 'Only CREATE TABLE statements are allowed'); } const connection = await this.configParser.getConnection(connectionId); if (!connection) { throw new McpError(ErrorCode.InvalidParams, `Connection not found: ${connectionId}`); } const result = await this.dbeaverClient.executeQuery(connection, query); return { content: [{ type: 'text' as const, text: JSON.stringify({ success: true, message: 'Table created successfully', executionTime: result.executionTime }, null, 2), }], }; }
  • Input schema defining the parameters for the create_table tool: connectionId (string) and query (string, CREATE TABLE statement).
    inputSchema: { type: 'object', properties: { connectionId: { type: 'string', description: 'The ID or name of the DBeaver connection', }, query: { type: 'string', description: 'CREATE TABLE statement', }, }, required: ['connectionId', 'query'], },
  • src/index.ts:262-279 (registration)
    Tool registration in the list_tools response, including name, description, and input schema.
    { name: 'create_table', description: 'Create new tables in the database', inputSchema: { type: 'object', properties: { connectionId: { type: 'string', description: 'The ID or name of the DBeaver connection', }, query: { type: 'string', description: 'CREATE TABLE statement', }, }, required: ['connectionId', 'query'], }, },
  • src/index.ts:500-504 (registration)
    Dispatch in the call_tool handler switch statement that routes to the handleCreateTable function.
    case 'create_table': return await this.handleCreateTable(args as { connectionId: string; query: string; });

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