Skip to main content
Glama
apache

Doris MCP Server

Official
by apache

get_table_comment

Retrieve comment details for a specified table in Apache Doris databases. Provide the table name and optionally the database name to access metadata insights efficiently.

Instructions

[Function Description]: Get the comment information for the specified table.

[Parameter Content]:

  • table_name (string) [Required] - Name of the table to query

  • db_name (string) [Optional] - Target database name, defaults to the current database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
db_nameNo
table_nameYes

Implementation Reference

  • MCP tool registration for 'get_table_comment' including decorator, description, parameters, and stub handler that delegates to internal call_tool method.
            @mcp.tool(
                "get_table_comment",
                description="""[Function Description]: Get the comment information for the specified table.
    
    [Parameter Content]:
    
    - table_name (string) [Required] - Name of the table to query
    
    - db_name (string) [Optional] - Target database name, defaults to the current database
    
    - catalog_name (string) [Optional] - Target catalog name for federation queries, defaults to current catalog
    """,
            )
            async def get_table_comment_tool(
                table_name: str, db_name: str = None, catalog_name: str = None
            ) -> str:
                """Get table comment"""
                return await self.call_tool("get_table_comment", {
                    "table_name": table_name,
                    "db_name": db_name,
                    "catalog_name": catalog_name
                })
  • Input schema definition for 'get_table_comment' tool used in stdio mode listing.
                Tool(
                    name="get_table_comment",
                    description="""[Function Description]: Get the comment information for the specified table.
    
    [Parameter Content]:
    
    - table_name (string) [Required] - Name of the table to query
    
    - db_name (string) [Optional] - Target database name, defaults to the current database
    
    - catalog_name (string) [Optional] - Target catalog name for federation queries, defaults to current catalog
    """,
                    inputSchema={
                        "type": "object",
                        "properties": {
                            "table_name": {"type": "string", "description": "Table name"},
                            "db_name": {"type": "string", "description": "Database name"},
                            "catalog_name": {"type": "string", "description": "Catalog name"},
                        },
                        "required": ["table_name"],
                    },
                ),
  • Tool routing handler in DorisToolsManager that delegates 'get_table_comment' execution to MetadataExtractor.get_table_comment_for_mcp.
    async def _get_table_comment_tool(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
        """Get table comment tool routing"""
        table_name = arguments.get("table_name")
        db_name = arguments.get("db_name")
        catalog_name = arguments.get("catalog_name")
        
        # Delegate to metadata extractor for processing
        return await self.metadata_extractor.get_table_comment_for_mcp(
            table_name, db_name, catalog_name
        )
  • MCP-specific wrapper method in MetadataExtractor that calls get_table_comment_async and formats response for MCP tools.
    async def get_table_comment_for_mcp(
        self, 
        table_name: str, 
        db_name: str = None, 
        catalog_name: str = None
    ) -> Dict[str, Any]:
        """Get comment information for specified table - MCP interface"""
        logger.info(f"Getting table comment: Table: {table_name}, DB: {db_name}, Catalog: {catalog_name}")
        
        if not table_name:
            return self._format_response(success=False, error="Missing table_name parameter")
        
        try:
            comment = await self.get_table_comment_async(table_name=table_name, db_name=db_name, catalog_name=catalog_name)
            return self._format_response(success=True, result=comment)
        except Exception as e:
            logger.error(f"Failed to get table comment: {str(e)}", exc_info=True)
            return self._format_response(success=False, error=str(e), message="Error occurred while getting table comment")
  • Core handler function that executes the SQL query against information_schema.tables to retrieve the table comment, with catalog support.
    async def get_table_comment_async(self, table_name: str, db_name: str = None, catalog_name: str = None) -> str:
        """Async version: get the comment for a table."""
        try:
            effective_db = db_name or self.db_name
            effective_catalog = catalog_name or self.catalog_name
    
            query = f"""
            SELECT 
                TABLE_COMMENT 
            FROM 
                information_schema.tables 
            WHERE 
                TABLE_SCHEMA = '{effective_db}' 
                AND TABLE_NAME = '{table_name}'
            """
    
            result = await self._execute_query_with_catalog_async(query, effective_db, effective_catalog)
            if not result or not result[0]:
                return ""
            return result[0].get("TABLE_COMMENT", "") or ""
        except Exception as e:
            logger.error(f"Failed to get table comment asynchronously: {e}")
            return ""
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves comment information, implying a read-only operation, but doesn't clarify permissions, rate limits, error handling, or output format. For a tool with zero annotation coverage, this is a significant gap in transparency.

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

Conciseness3/5

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

The description is structured with labeled sections ('[Function Description]' and '[Parameter Content]'), which aids readability. However, it includes redundant formatting (e.g., brackets) and could be more streamlined. The content is front-loaded with the core purpose, but the parameter section adds necessary detail without being overly verbose.

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 (2 parameters, no annotations, no output schema), the description is incomplete. It explains what the tool does and the parameters, but lacks critical context: it doesn't describe the return value (e.g., comment text format), error conditions, or how it differs from siblings. This leaves gaps for effective agent 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?

The description includes a '[Parameter Content]' section that lists both parameters with brief explanations: 'table_name' as required for the table to query, and 'db_name' as optional with a default. However, schema description coverage is 0%, so the schema provides no additional details. The description compensates somewhat by explaining parameter roles, but lacks depth on formats or constraints.

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: 'Get the comment information for the specified table.' It uses a specific verb ('Get') and resource ('comment information for the specified table'), making the function unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'get_table_column_comments' or 'get_table_schema', which reduces it from a perfect score.

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. It doesn't mention sibling tools like 'get_table_column_comments' (for column-level comments) or 'get_table_schema' (for schema details), nor does it specify prerequisites or exclusions. This leaves the agent without 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

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/apache/doris-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server