Skip to main content
Glama
apache

Doris MCP Server

Official
by apache

get_db_table_list

Retrieve a list of all table names within a specified database using this tool, defaulting to the current database if none is provided. Simplifies database metadata management and query preparation.

Instructions

[Function Description]: Get a list of all table names in the specified database.

[Parameter Content]:

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
db_nameNo

Implementation Reference

  • Registers the get_db_table_list tool with the MCP server, defining its parameters and description. The tool function delegates to the internal call_tool method.
            @mcp.tool(
                "get_db_table_list",
                description="""[Function Description]: Get a list of all table names in the specified database.
    
    [Parameter Content]:
    
    - 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_db_table_list_tool(
                db_name: str = None, catalog_name: str = None
            ) -> str:
                """Get database table list"""
                return await self.call_tool("get_db_table_list", {
                    "db_name": db_name,
                    "catalog_name": catalog_name
                })
  • Defines the input schema for the get_db_table_list tool in list_tools method for stdio mode compatibility.
                Tool(
                    name="get_db_table_list",
                    description="""[Function Description]: Get a list of all table names in the specified database.
    
    [Parameter Content]:
    
    - 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": {
                            "db_name": {"type": "string", "description": "Database name"},
                            "catalog_name": {"type": "string", "description": "Catalog name"},
                        },
                    },
                ),
  • Handler routing function in DorisToolsManager that extracts parameters and delegates to MetadataExtractor.get_db_table_list_for_mcp.
    async def _get_db_table_list_tool(self, arguments: Dict[str, Any]) -> Dict[str, Any]:
        """Get database table list tool routing"""
        db_name = arguments.get("db_name")
        catalog_name = arguments.get("catalog_name")
        
        # Delegate to metadata extractor for processing
        return await self.metadata_extractor.get_db_table_list_for_mcp(db_name, catalog_name)
  • MCP interface in MetadataExtractor that calls get_database_tables_async and formats the response.
    async def get_db_table_list_for_mcp(
        self, 
        db_name: str = None, 
        catalog_name: str = None
    ) -> Dict[str, Any]:
        """Get list of all table names in specified database - MCP interface"""
        logger.info(f"Getting database table list: DB: {db_name}, Catalog: {catalog_name}")
        
        try:
            tables = await self.get_database_tables_async(db_name=db_name, catalog_name=catalog_name)
            return self._format_response(success=True, result=tables)
        except Exception as e:
            logger.error(f"Failed to get database table list: {str(e)}", exc_info=True)
            return self._format_response(success=False, error=str(e), message="Error occurred while getting database table list")
  • Core implementation that executes 'SHOW TABLES FROM catalog.db' query via _execute_query_async and extracts table names from the result.
    async def get_database_tables_async(self, db_name: str = None, catalog_name: str = None) -> List[str]:
        """Asynchronously get table list in database"""
        try:
            effective_catalog = catalog_name or self.catalog_name
            effective_db = db_name or self.db_name
            
            if effective_catalog and effective_catalog != "internal":
                query = f"SHOW TABLES FROM `{effective_catalog}`.`{effective_db}`"
            else:
                query = f"SHOW TABLES FROM `{effective_db}`"
            
            result = await self._execute_query_async(query, effective_db)
            
            if not result:
                return []
            
            # Extract table names
            tables = []
            for row in result:
                if isinstance(row, dict):
                    # Get the value of the first field (usually Tables_in_xxx field)
                    table_name = list(row.values())[0] if row else None
                    if table_name:
                        tables.append(table_name)
            
            return tables
            
        except Exception as e:
            logger.error(f"Failed to get table list: {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 'Get[s] a list' but doesn't clarify if this is a read-only operation, whether it requires specific permissions, how it handles errors, or what the return format looks like. For a tool with zero annotation coverage, this is a significant gap in behavioral context.

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 structured with clear sections for function and parameters. It uses bullet points efficiently and avoids redundancy. However, the formatting with brackets like '[Function Description]' is slightly verbose, and the content could be more front-loaded with key usage information.

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

Completeness3/5

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

Given the tool's low complexity (1 optional parameter, no output schema, no annotations), the description is minimally adequate. It covers the purpose and parameter semantics but lacks behavioral details, usage guidelines, and output information. For a simple read operation, this is borderline viable but leaves gaps in completeness.

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

Parameters4/5

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

With 0% schema description coverage, the description compensates well by explaining the single parameter's semantics. It specifies that 'db_name' is the 'Target database name' and defaults to 'the current database', adding meaningful context beyond the schema's basic type and title. This is sufficient for the one parameter, though more detail on format or constraints could be helpful.

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 with a specific verb ('Get') and resource ('list of all table names in the specified database'). It distinguishes itself from siblings like get_db_list (which lists databases) and get_table_schema (which provides schema details), though it doesn't explicitly name these alternatives. The purpose is unambiguous but could be slightly more specific about 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. It doesn't mention siblings like get_db_list for listing databases or get_table_schema for detailed table information, nor does it specify prerequisites or contexts for usage. This leaves the agent without clear direction on 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