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
| Name | Required | Description | Default |
|---|---|---|---|
| connectionId | Yes | The ID or name of the DBeaver connection | |
| query | Yes | CREATE TABLE statement |
Implementation Reference
- src/index.ts:714-739 (handler)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), }], }; } - src/index.ts:265-278 (schema)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; });