Skip to main content
Glama
aliyun

Alibaba Cloud DMS MCP Server

Official
by aliyun

searchDatabase

Find databases by name in Alibaba Cloud DMS to access metadata and perform cross-engine queries across diverse database ecosystems.

Instructions

Search databases in DMS by name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_keyYesdatabase name to search for
page_numberNoPage number (starting from 1)
page_sizeNoResults per page (max 1000)

Implementation Reference

  • The handler function that executes the searchDatabase tool, using Alibaba Cloud DMS API to search for databases by key, processes results into DatabaseInfo objects.
    async def search_database( search_key: str = Field(description="database name to search for"), page_number: int = Field(default=1, description="Page number (starting from 1)"), page_size: int = Field(default=200, description="Results per page (max 1000)") ) -> List[DatabaseInfo]: client = create_client() req = dms_enterprise_20181101_models.SearchDatabaseRequest(search_key=search_key, page_number=page_number, page_size=page_size) if mcp.state.real_login_uid: req.real_login_user_uid = mcp.state.real_login_uid try: resp = client.search_database(req) if not resp or not resp.body: return [] db_list_data = resp.body.to_map().get('SearchDatabaseList', {}).get('SearchDatabase', []) result = [] for db in db_list_data: db_info_map = {"DatabaseId": db.get("DatabaseId"), "Host": db.get("Host"), "Port": db.get("Port"), "DbType": db.get("DbType")} db_info_map["SchemaName"] = f'{db.get("CatalogName", "")}.{db.get("SchemaName", "")}' if db.get( "CatalogName") != 'def' else db.get("SchemaName", "") result.append(DatabaseInfo(**db_info_map)) return result except Exception as e: logger.error(f"Error in search_database: {e}") raise
  • Registers the search_database function as an MCP tool named 'searchDatabase' with description and Chinese title annotation.
    self.mcp.tool(name="searchDatabase", description="Search databases in DMS by name.", annotations={"title": "搜索DMS数据库", "readOnlyHint": True})(search_database)
  • Pydantic model used for output schema, defining the structure of each searched database entry returned by the tool.
    class DatabaseInfo(MyBaseModel): DatabaseId: Any = Field(description="Unique database identifier in DMS") Host: Any = Field(description="Hostname or IP address of the database instance") Port: Any = Field(description="Connection port number") DbType: Any = Field(description="Database Engine type") SchemaName: Any = Field(description="Name of the database schema")

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