show_hg_table_ddl
Generate the DDL script for a table, view, or foreign table in a Hologres database by specifying the schema and table names.
Instructions
Show DDL script for a table, view, or foreign table in Hologres database.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| schema | Yes | Schema name in Hologres database | |
| table | Yes | Table name in Hologres database |
Implementation Reference
- Handler logic for the 'show_hg_table_ddl' tool: extracts 'schema' and 'table' from input arguments, validates presence, constructs SQL query using hg_dump_script function, and delegates execution to handle_call_tool.elif name == "show_hg_table_ddl": schema = arguments.get("schema") table = arguments.get("table") if not all([schema, table]): raise ValueError("Schema and table are required") query = f"SELECT hg_dump_script('\"{schema}\".\"{table}\"')" else:
- src/hologres_mcp_server/server.py:527-545 (registration)Registration of the 'show_hg_table_ddl' tool in the list_tools() function, including name, description, and input schema definition requiring 'schema' and 'table' parameters.# 新增 show_hg_table_ddl 工具 Tool( name="show_hg_table_ddl", description="Show DDL script for a table, view, or foreign table in Hologres database.", inputSchema={ "type": "object", "properties": { "schema": { "type": "string", "description": "Schema name in Hologres database" }, "table": { "type": "string", "description": "Table name in Hologres database" } }, "required": ["schema", "table"] } )
- Input schema definition for the 'show_hg_table_ddl' tool, specifying required string parameters 'schema' and 'table' with descriptions.inputSchema={ "type": "object", "properties": { "schema": { "type": "string", "description": "Schema name in Hologres database" }, "table": { "type": "string", "description": "Table name in Hologres database" } }, "required": ["schema", "table"] }