Skip to main content
Glama
aliyun

Hologres MCP Server

Official
by aliyun

call_hg_procedure

Execute stored procedures in Hologres databases by specifying the procedure name and arguments via the Hologres MCP Server interface for streamlined database operations.

Instructions

Call a stored procedure in Hologres database.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argumentsNoThe arguments to pass to the stored procedure in Hologres database
procedure_nameYesThe name of the stored procedure to call in Hologres database

Implementation Reference

  • Registration of the 'call_hg_procedure' tool including its input schema definition.
    Tool( name="call_hg_procedure", description="Call a stored procedure in Hologres database.", inputSchema={ "type": "object", "properties": { "procedure_name": { "type": "string", "description": "The name of the stored procedure to call in Hologres database" }, "arguments": { "type": "array", "items": { "type": "string" }, "description": "The arguments to pass to the stored procedure in Hologres database" } }, "required": ["procedure_name"] } ),
  • Input schema for validating arguments to the 'call_hg_procedure' tool: procedure_name (required string), arguments (optional array of strings).
    inputSchema={ "type": "object", "properties": { "procedure_name": { "type": "string", "description": "The name of the stored procedure to call in Hologres database" }, "arguments": { "type": "array", "items": { "type": "string" }, "description": "The arguments to pass to the stored procedure in Hologres database" } }, "required": ["procedure_name"] }
  • Specific handler for 'call_hg_procedure' tool: extracts procedure_name and arguments, validates procedure_name, constructs CALL SQL query.
    elif name == "call_hg_procedure": procedure_name = arguments.get("procedure_name") arguments_list = arguments.get("arguments") if not procedure_name: raise ValueError("Procedure name are required") query = f"CALL {procedure_name}({', '.join(arguments_list)})"
  • Generic helper function that executes the SQL query constructed by tool handlers, handles results for SELECT or other queries, connects to Hologres DB with retry.
    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)}"

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