Skip to main content
Glama
srthkdev

DBeaver MCP Server

by srthkdev

write_query

Execute INSERT, UPDATE, or DELETE queries on DBeaver database connections to modify data across 200+ database types without additional configuration.

Instructions

Execute INSERT, UPDATE, or DELETE queries on a specific DBeaver connection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionIdYesThe ID or name of the DBeaver connection to use
queryYesThe SQL query to execute (INSERT, UPDATE, DELETE)

Implementation Reference

  • Main handler function that validates the query (ensures it's INSERT/UPDATE/DELETE, not SELECT), sanitizes connection ID, fetches the connection, executes the query using DBeaver client, and returns a JSON response with execution details including affected rows.
    private async handleWriteQuery(args: { connectionId: string; query: string }) {
      const connectionId = sanitizeConnectionId(args.connectionId);
      const query = args.query.trim();
      
      // Validate query type
      const lowerQuery = query.toLowerCase();
      if (lowerQuery.startsWith('select')) {
        throw new McpError(ErrorCode.InvalidParams, 'Use execute_query for SELECT operations');
      }
      
      if (!(lowerQuery.startsWith('insert') || lowerQuery.startsWith('update') || lowerQuery.startsWith('delete'))) {
        throw new McpError(ErrorCode.InvalidParams, 'Only INSERT, UPDATE, or DELETE operations are allowed with write_query');
      }
    
      // Additional validation
      const validationError = validateQuery(query);
      if (validationError) {
        throw new McpError(ErrorCode.InvalidParams, validationError);
      }
      
      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);
      
      const response = {
        query: query,
        connection: connection.name,
        executionTime: result.executionTime,
        affectedRows: result.rowCount,
        success: true
      };
      
      return {
        content: [{
          type: 'text' as const,
          text: JSON.stringify(response, null, 2),
        }],
      };
    }
  • Input schema definition for the write_query tool in the list of tools, defining required parameters: connectionId (string) and query (string), with descriptions.
    {
      name: 'write_query',
      description: 'Execute INSERT, UPDATE, or DELETE queries on a specific DBeaver connection',
      inputSchema: {
        type: 'object',
        properties: {
          connectionId: {
            type: 'string',
            description: 'The ID or name of the DBeaver connection to use',
          },
          query: {
            type: 'string',
            description: 'The SQL query to execute (INSERT, UPDATE, DELETE)',
          },
        },
        required: ['connectionId', 'query'],
      },
    },
  • src/index.ts:494-498 (registration)
    Switch case in CallToolRequest handler that routes 'write_query' calls to the handleWriteQuery method, casting arguments to the expected type.
    case 'write_query':
      return await this.handleWriteQuery(args as { 
        connectionId: string; 
        query: string; 
      });
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While it indicates this is a write operation, it doesn't describe important behavioral traits like transaction handling, error behavior, permission requirements, or whether changes are reversible. For a tool that can execute destructive SQL operations, this is a significant gap.

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?

The description is a single, efficient sentence that communicates the essential information without any wasted words. It's appropriately sized and front-loaded with the core functionality.

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 tool that can execute potentially destructive SQL operations with no annotations and no output schema, the description is insufficient. It doesn't address critical context like what happens on execution failure, whether transactions are supported, what permissions are required, or what the return value contains.

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 thoroughly. The description adds minimal value beyond what the schema provides - it mentions the query must be INSERT, UPDATE, or DELETE, which slightly clarifies the 'query' parameter's semantic constraints.

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

Purpose5/5

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

The description clearly states the verb 'Execute' and specifies the exact SQL operations (INSERT, UPDATE, DELETE) on a specific resource (DBeaver connection). It distinguishes from siblings like 'execute_query' by explicitly limiting to write operations rather than general query execution.

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

Usage Guidelines4/5

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

The description provides clear context by specifying it's for INSERT, UPDATE, or DELETE queries, which implicitly guides usage toward write operations. However, it doesn't explicitly state when NOT to use this tool or name specific alternatives like 'execute_query' for read operations.

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