Skip to main content
Glama
aliyun

Alibaba Cloud DMS MCP Server

Official
by aliyun

listTables

Search for database tables by databaseId and optional table name. Retrieve table details efficiently, enabling precise metadata access and management in Alibaba Cloud DMS.

Instructions

Search for tables by databaseId and (optional) table name. If you don't know the databaseId, first use getDatabase or searchDatabase to retrieve it.(1)If you have the exact host, port, and database name, use getDatabase.(2)If you only know the database name, use searchDatabase.(3)If you don't know any information, ask the user to provide the necessary details.Note: searchDatabase may return multiple databases. In this case, let the user choose which one to use.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
database_idYesDMS databaseId
page_numberNoPagination page number
page_sizeNoResults per page (max 200)
search_nameNoOptional: Search keyword for table names

Implementation Reference

  • Core handler function implementing the listTables tool logic by calling the Alibaba Cloud DMS Enterprise API to list tables in a database.
    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
  • Registration of the listTables tool in the full toolset, directly binding the list_tables handler function.
    self.mcp.tool(name="listTables", description=f"Search for tables by databaseId and (optional) table name. " f"{DATABASE_ID_DESCRIPTION}", annotations={"title": "列出DMS表", "readOnlyHint": True})(list_tables)
  • Registration of a pre-configured wrapper for listTables tool when default database ID is set, calling the core handler with pre-set database_id.
    @self.mcp.tool(name="listTables", description="Lists tables in the database. Search by name is supported.", annotations={"title": "List Tables (Pre-configured DB)", "readOnlyHint": True}) async def list_tables_configured( search_name: Optional[str] = Field(default=None, description="Optional: A string used as the search keyword to match table names."), page_number: int = Field(description="Pagination page number", default=1), page_size: int = Field(description="Number of results per page", default=200) ) -> Dict[str, Any]: if not search_name: search_name = "%" return await list_tables(database_id=self.default_database_id, search_name=search_name, page_number=page_number, page_size=page_size)

Other Tools

Related 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-dms-mcp-server'

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