Skip to main content
Glama
aliyun

Alibaba Cloud DMS MCP Server

Official
by aliyun

searchDatabase

Read-only

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")
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate readOnlyHint=true, which the description does not contradict. The description adds minimal behavioral context beyond annotations, as it only mentions searching by name without detailing aspects like pagination behavior, rate limits, or authentication needs. With annotations covering safety, the description provides some value but is not rich in behavioral details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with no wasted words. It is front-loaded with the core action ('Search databases in DMS by name'), making it easy to parse. Every part of the sentence contributes to understanding the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (search with pagination), lack of output schema, and minimal annotations, the description is incomplete. It does not explain return values, error conditions, or how results are structured. For a search tool with pagination parameters, more context is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with all parameters well-documented in the schema. The description adds no additional meaning beyond the schema, such as explaining search semantics (e.g., partial matches) or usage tips. Baseline is 3 since the schema handles parameter documentation effectively.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Search') and resource ('databases in DMS'), specifying the search criterion ('by name'). However, it does not explicitly differentiate from sibling tools like 'getDatabase' or 'listInstances', which might also retrieve database information. The purpose is clear but lacks sibling differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives such as 'getDatabase' (for specific database details) or 'listInstances' (for listing instances). It mentions searching by name but does not specify use cases, exclusions, or prerequisites, leaving the agent with minimal context for tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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