Skip to main content
Glama
aliyun

Alibaba Cloud DMS MCP Server

Official
by aliyun

getDatabase

Retrieve detailed database information, including schema and connection details, by providing the host, port, and schema name using the Alibaba Cloud DMS MCP Server tool.

Instructions

Obtain detailed information about a specific database in DMS when the host and port are provided.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYesHostname or IP of the database instance
portYesConnection port number
schema_nameYesName of the database schema
sidNoRequired for Oracle like databases

Implementation Reference

  • The core handler function implementing the 'getDatabase' tool logic. It creates a DMS client, constructs a GetDatabaseRequest with host, port, schema_name (and optional sid), calls the API, parses the response into a DatabaseDetail model, and handles errors.
    async def get_database( host: str = Field(description="Hostname or IP of the database instance"), port: str = Field(description="Connection port number"), schema_name: str = Field(description="Name of the database schema"), sid: Optional[str] = Field(default=None, description="Required for Oracle like databases") ) -> DatabaseDetail: client = create_client() req = dms_enterprise_20181101_models.GetDatabaseRequest(host=host, port=port, schema_name=schema_name) if sid: req.sid = sid if mcp.state.real_login_uid: req.real_login_user_uid = mcp.state.real_login_uid try: resp = client.get_database(req) db_data = resp.body.to_map().get('Database', {}) if resp and resp.body else {} return DatabaseDetail(**db_data) except Exception as e: logger.error(f"Error in get_database: {e}") raise
  • Registration of the 'getDatabase' tool in the ToolRegistry's _register_full_toolset method, associating the tool name with the get_database handler function, including description and read-only annotation.
    description="Obtain detailed information about a specific database in DMS when the host and port are provided.", annotations={"title": "获取DMS数据库详情", "readOnlyHint": True})(get_database) self.mcp.tool(name="listTables",
  • Pydantic model used as the return type for the get_database handler, defining the structure and descriptions for the output schema including DatabaseId, SchemaName, DbType, InstanceAlias, InstanceId, and State.
    class DatabaseDetail(MyBaseModel): DatabaseId: Any = Field(description="Unique database identifier in DMS", default=None) SchemaName: Any = Field(description="Name of the database schema", default=None) DbType: Any = Field(description="Database Engine type", default=None) InstanceAlias: Any = Field(description="Instance alias in DMS", default=None) InstanceId: Any = Field(description="Instance identifier in DMS", default=None) State: Any = Field(description="Current operational status", default=None)

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