Skip to main content
Glama
aliyun

Alibaba Cloud DMS MCP Server

Official
by aliyun

answerSqlSyntax

Get SQL syntax answers for specific database engines by providing database ID and natural language questions to clarify database-specific syntax rules.

Instructions

Answer syntax-related questions for the corresponding database engine based on the database ID.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
questionYesNatural language question
modelNoOptional: if a specific model is desired, it can be specified here

Implementation Reference

  • Core handler function that calls the Alibaba Cloud DMS API to answer SQL syntax questions using database metadata.
    async def answer_sql_syntax( database_id: str = Field(description="DMS databaseId"), question: str = Field(description="Natural language question"), model: Optional[str] = Field(default=None, description="Optional: if a specific model is desired, it can be specified here") ) -> Dict[str, Any]: client = create_client() req = dms_enterprise_20181101_models.AnswerSqlSyntaxByMetaAgentRequest(db_id=database_id, query=question) # if mcp.state.real_login_uid: # req.real_login_user_uid = mcp.state.real_login_uid if model: req.model = model try: resp = client.answer_sql_syntax_by_meta_agent(req) if not resp or not resp.body: return None data = resp.body.to_map() return data except Exception as e: logger.error(f"Error in ask_sql_syntax: {e}") raise
  • Registration and wrapper handler for answerSqlSyntax tool when a default database_id is configured, injecting the default database.
    @self.mcp.tool(name="answerSqlSyntax", description="Answer syntax-related questions for the corresponding database engine ", annotations={"title": "SQL语法回答", "readOnlyHint": True, "destructiveHint": False}) async def answer_sql_syntax_configured( question: str = Field(description="Natural language question"), model: Optional[str] = Field(default=None, description="Optional: if a specific model is desired, it can be specified here") ) -> Dict[str, Any]: result_obj = await answer_sql_syntax(database_id=self.default_database_id, question=question, model=model) return result_obj
  • Direct registration of the core answer_sql_syntax handler in the full toolset mode (no default database configured).
    self.mcp.tool(name="answerSqlSyntax", description=f"Answer syntax-related questions " f"for the corresponding database engine " f"based on the database ID." f"{DATABASE_ID_DESCRIPTION}", annotations={"title": "SQL语法回答", "readOnlyHint": True})(answer_sql_syntax)

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