getTableDetailInfo
Retrieve comprehensive metadata of a database table, including schema and index details, using a unique table identifier. Identify the table_guid parameter with listTables if unknown.
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 core handler function implementing the 'getTableDetailInfo' tool. It takes a table_guid, calls the Alibaba Cloud DMS Enterprise API's get_meta_table_detail_info method, and returns a TableDetail object containing column and index information.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
- src/alibabacloud_dms_mcp_server/server.py:710-713 (registration)Registration of the 'getTableDetailInfo' tool in the full toolset mode, binding it to the get_meta_table_detail_info handler function.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-587 (registration)Registration of the 'getTableDetailInfo' tool in the pre-configured database toolset mode, binding it to the get_meta_table_detail_info handler function.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)
- Pydantic model defining the output schema for the getTableDetailInfo tool, including lists of columns and indexes.class TableDetail(MyBaseModel): ColumnList: Any = Field(description="List of column metadata", default=None) IndexList: Any = Field(description="List of index metadata", default=None)
- Supporting helper function list_tables that retrieves table guids needed as input for getTableDetailInfo (via listTables tool).async def list_tables( # Renamed from listTable to follow convention database_id: str = Field(description="DMS databaseId"), search_name: Optional[str] = Field(default=None, description="Optional: Search keyword for table names"), page_number: int = Field(default=1, description="Pagination page number"), page_size: int = Field(default=200, description="Results per page (max 200)") ) -> Dict[str, Any]: if not search_name: search_name = "%" client = create_client() req = dms_enterprise_20181101_models.ListTablesRequest(database_id=database_id, search_name=search_name, page_number=page_number, page_size=page_size, return_guid=True) if mcp.state.real_login_uid: req.real_login_user_uid = mcp.state.real_login_uid try: resp = client.list_tables(req) return resp.body.to_map() if resp and resp.body else {} except Exception as e: logger.error(f"Error in list_tables: {e}") raise