Skip to main content
Glama
aliyun

Hologres MCP Server

Official
by aliyun

execute_hg_dml_sql

Execute INSERT, UPDATE, and DELETE SQL queries to modify data in Hologres databases through the MCP server interface.

Instructions

Execute (INSERT, UPDATE, DELETE) SQL to insert, update, and delete data in Hologres databse.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe DML SQL query to execute in Hologres database

Implementation Reference

  • Registration of the execute_hg_dml_sql tool in list_tools(), including name, description, and input schema.
    Tool(
        name="execute_hg_dml_sql",
        description="Execute (INSERT, UPDATE, DELETE) SQL to insert, update, and delete data in Hologres databse.",
        inputSchema={
            "type": "object",
            "properties": {
                "query": {
                    "type": "string",
                    "description": "The DML SQL query to execute in Hologres database"
                }
            },
            "required": ["query"]
        }
    ),
  • Input schema definition for execute_hg_dml_sql tool: requires a 'query' string that is the DML SQL.
    inputSchema={
        "type": "object",
        "properties": {
            "query": {
                "type": "string",
                "description": "The DML SQL query to execute in Hologres database"
            }
        },
        "required": ["query"]
    }
  • Handler dispatch block in @app.call_tool(): validates that the tool name matches and query is a valid DML statement (INSERT, UPDATE, DELETE). Sets 'query' variable for execution.
    elif name == "execute_hg_dml_sql":
        query = arguments.get("query")
        if not query:
            raise ValueError("Query is required")
        if not any(query.strip().upper().startswith(keyword) for keyword in ["INSERT", "UPDATE", "DELETE"]):
            raise ValueError("Query must be a DML statement (INSERT, UPDATE, DELETE)")
  • Shared helper function handle_call_tool that performs the actual database connection, query execution, and result formatting. For DML tools like execute_hg_dml_sql, it executes the query and returns a success message (falls to 'else' clause due to name mismatch).
    def handle_call_tool(tool_name, query, serverless = False):
        """Handle callTool method."""
        config = get_db_config()
        try:
            with connect_with_retry() as conn:
                with conn.cursor() as cursor:
    
                    # 特殊处理 serverless computing 查询
                    if serverless:
                        cursor.execute("set hg_computing_resource='serverless'")
                    
                    # Execute the query
                    cursor.execute(query)
                    
                    # 特殊处理 ANALYZE 命令
                    if tool_name == "gather_hg_table_statistics":
                        return f"Successfully {query}"
                    
                    # 处理其他有返回结果的查询
                    if cursor.description:  # SELECT query
                        columns = [desc[0] for desc in cursor.description]
                        rows = cursor.fetchall()
                        result = [",".join(map(str, row)) for row in rows]
                        return "\n".join([",".join(columns)] + result)
                    elif tool_name == "execute_dml_sql":  # Non-SELECT query
                        row_count = cursor.rowcount
                        return f"Query executed successfully. {row_count} rows affected."
                    else:
                        return "Query executed successfully"
        except Exception as e:
            return f"Error executing query: {str(e)}"
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool executes DML SQL, implying data mutation, but lacks critical details such as required permissions, whether changes are reversible, potential side effects, or error handling. This is a significant gap for a mutation tool with zero annotation coverage.

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

Conciseness4/5

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

The description is a single, efficient sentence that front-loads key information ('Execute (INSERT, UPDATE, DELETE) SQL'). It avoids redundancy, though it could be slightly more structured by separating purpose from context. Overall, it earns its place without waste.

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?

Given the complexity of a DML execution tool with no annotations and no output schema, the description is incomplete. It fails to address behavioral aspects like safety, permissions, or response format, leaving the agent with insufficient context to use the tool effectively beyond basic parameter input.

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?

The input schema has 100% description coverage, with the 'query' parameter documented as 'The DML SQL query to execute in Hologres database'. The description adds no additional meaning beyond this, such as syntax examples or constraints, so it meets the baseline of 3 where the schema does the heavy lifting.

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 action ('Execute') and resource ('SQL to insert, update, and delete data in Hologres database'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like execute_hg_ddl_sql or execute_hg_select_sql, which handle other SQL types, so it falls short of a perfect score.

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?

The description implies usage for DML operations (INSERT, UPDATE, DELETE) but provides no explicit guidance on when to use this tool versus alternatives like execute_hg_ddl_sql for DDL or execute_hg_select_sql for queries. There are no exclusions or prerequisites mentioned, leaving the agent to infer context from tool names alone.

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/aliyun/alibabacloud-hologres-mcp-server'

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