getTableDetailInfo
Retrieve detailed metadata about database tables including schema and index information to understand table structure and relationships.
Instructions
Retrieve detailed metadata information about a specific database table including schema and index details. If you don't know the table_guid parameter, retrieve it using listTables.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table_guid | Yes | Unique table identifier (format: dmsTableId.schemaName.tableName),Example: IDB_1567890.mySchema.myTable |
Implementation Reference
- The handler function that implements the getTableDetailInfo tool by calling the Alibaba Cloud DMS API to fetch table metadata including columns and indexes.async def get_meta_table_detail_info( table_guid: str = Field( description="Unique table identifier (format: dmsTableId.schemaName.tableName),Example: IDB_1567890.mySchema.myTable") ) -> TableDetail: client = create_client() req = dms_enterprise_20181101_models.GetMetaTableDetailInfoRequest(table_guid=table_guid) if mcp.state.real_login_uid: req.real_login_user_uid = mcp.state.real_login_uid try: resp = client.get_meta_table_detail_info(req) detail_info = resp.body.to_map().get('DetailInfo', {}) if resp and resp.body else {} return TableDetail(**detail_info) except Exception as e: logger.error(f"Error in get_meta_table_detail_info: {e}") raise
- Pydantic models defining the structure of the table detail response, including Column, Index, and TableDetail.class Column(MyBaseModel): ColumnName: Any = Field(description="Name of the column") ColumnType: Any = Field(description="Full SQL type declaration (e.g., 'varchar(32)', 'bigint(20)')") AutoIncrement: Any = Field(description="Whether the column is an auto-increment field") Description: Any = Field(description="Column comment/description text") Nullable: Any = Field(description="Whether NULL values are allowed") class Index(MyBaseModel): IndexColumns: Any = Field(description="List of column names included in the index") IndexName: Any = Field(description="Name of the index") IndexType: Any = Field(description="Type of index ('Primary', 'Unique', etc.)") Unique: Any = Field(description="Whether the index enforces uniqueness") class TableDetail(MyBaseModel): ColumnList: Any = Field(description="List of column metadata", default=None) IndexList: Any = Field(description="List of index metadata", default=None)
- src/alibabacloud_dms_mcp_server/server.py:710-714 (registration)Tool registration in the full toolset mode.self.mcp.tool(name="getTableDetailInfo", description="Retrieve detailed metadata information about a specific database table including " "schema and index details. If you don't know the table_guid parameter, retrieve it using listTables.", annotations={"title": "获取DMS表详细信息", "readOnlyHint": True})(get_meta_table_detail_info)
- src/alibabacloud_dms_mcp_server/server.py:584-588 (registration)Tool registration in the configured database toolset mode.self.mcp.tool(name="getTableDetailInfo", description="Retrieve detailed metadata information about a specific database table including " "schema and index details. If you don't know the table_guid parameter, retrieve it using listTables.", annotations={"title": "Get Table Details", "readOnlyHint": True})(get_meta_table_detail_info)