Skip to main content
Glama
srthkdev

DBeaver MCP Server

by srthkdev

alter_table

Modify database table schemas by executing ALTER TABLE statements to add columns, rename tables, or change structure through DBeaver connections.

Instructions

Modify existing table schema (add columns, rename tables, etc.)

Input Schema

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

Implementation Reference

  • The handler function that validates the ALTER TABLE query and executes it using the DBeaverClient
    private async handleAlterTable(args: { connectionId: string; query: string }) {
      const connectionId = sanitizeConnectionId(args.connectionId);
      const query = args.query.trim();
      
      if (!query.toLowerCase().startsWith('alter table')) {
        throw new McpError(ErrorCode.InvalidParams, 'Only ALTER 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 altered successfully',
            executionTime: result.executionTime 
          }, null, 2),
        }],
      };
    }
  • Tool schema definition including input parameters for connectionId and query
    {
      name: 'alter_table',
      description: 'Modify existing table schema (add columns, rename tables, etc.)',
      inputSchema: {
        type: 'object',
        properties: {
          connectionId: {
            type: 'string',
            description: 'The ID or name of the DBeaver connection',
          },
          query: {
            type: 'string',
            description: 'ALTER TABLE statement',
          },
        },
        required: ['connectionId', 'query'],
      },
    },
  • src/index.ts:506-510 (registration)
    Registration in the tool dispatch switch statement mapping 'alter_table' to its handler
    case 'alter_table':
      return await this.handleAlterTable(args as { 
        connectionId: string; 
        query: string; 
      });
  • src/index.ts:280-297 (registration)
    Tool registration in the list_tools response including name, description, and schema
    {
      name: 'alter_table',
      description: 'Modify existing table schema (add columns, rename tables, etc.)',
      inputSchema: {
        type: 'object',
        properties: {
          connectionId: {
            type: 'string',
            description: 'The ID or name of the DBeaver connection',
          },
          query: {
            type: 'string',
            description: 'ALTER TABLE statement',
          },
        },
        required: ['connectionId', 'query'],
      },
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but only states what the tool does, not behavioral traits. It doesn't disclose that this is a destructive/mutative operation (modifying schemas can break applications), permission requirements, whether changes are reversible, or any rate limits/constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Extremely concise single sentence with zero waste. Front-loaded with the core purpose and includes helpful examples. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive schema modification tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens on success/failure, return values, error conditions, or safety considerations despite the high-stakes nature of ALTER TABLE operations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters fully. The description adds no additional meaning about parameters beyond implying the query parameter should contain ALTER TABLE statements, which is already clear from the schema's description of 'ALTER TABLE statement'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Modify') and resource ('existing table schema') with specific examples ('add columns, rename tables, etc.'). It distinguishes from siblings like create_table (creates new) and drop_table (deletes), but doesn't explicitly contrast with execute_query which could also modify schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like execute_query (which could also run ALTER TABLE statements) or create_table/drop_table for other schema changes. The description implies usage for schema modifications but provides no exclusions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/omnisql-mcp'

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