Skip to main content
Glama
aliyun

Alibaba Cloud DMS MCP Server

Official
by aliyun

answerSqlSyntax

Read-only

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

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

Annotations indicate readOnlyHint=true, which the description doesn't contradict. The description adds context about prerequisites and database retrieval, but doesn't disclose behavioral traits like rate limits, response format, or error handling. With annotations covering safety, the description provides some useful operational context but lacks deeper 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.

Conciseness4/5

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

The description is appropriately sized and front-loaded with the core purpose. The usage guidelines are detailed but necessary for clarity. Some sentences could be more concise, but overall it avoids waste and structures information effectively for agent understanding.

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

Completeness4/5

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

Given the tool's complexity (answering syntax questions), annotations provide safety info, and schema covers inputs well. The description adds crucial usage context and prerequisites. Without an output schema, it doesn't explain return values, but for a Q&A tool with good annotations and schema, this is reasonably complete.

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%, so the schema fully documents parameters. The description doesn't add meaning beyond the schema for 'database_id' or 'question', though it implies 'database_id' is essential for engine-specific answers. The optional 'model' parameter isn't mentioned, but with high schema coverage, the baseline is 3 as the schema carries the burden.

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 tool's purpose: 'Answer syntax-related questions for the corresponding database engine based on the database ID.' It specifies the verb ('answer'), resource ('syntax-related questions'), and scope ('for the corresponding database engine'). However, it doesn't explicitly differentiate from sibling tools like 'fixSql' or 'optimizeSql', which also deal with SQL but have different functions.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool and alternatives. It states prerequisites ('If you don't know the databaseId, first use getDatabase or searchDatabase to retrieve it') and gives clear rules for choosing between getDatabase and searchDatabase based on available information. It also advises what to do if no information is known, making it comprehensive for usage scenarios.

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