Skip to main content
Glama
santosh07401

Redshift MCP Server

by santosh07401

redshift_list_tables

Retrieve all table names from a specified schema in Amazon Redshift to explore database structure and identify available data tables.

Instructions

List all tables in a specific schema.

Args:
    schema: The schema name (default: "public")

Returns:
    JSON list of table names

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaNopublic

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler implementation for the 'redshift_list_tables' MCP tool. Decorated with @mcp.tool() for registration, defines input schema via type hints and docstring, constructs SQL to list tables in the given schema, and executes via 'redshift_query' helper.
    @mcp.tool()
    def redshift_list_tables(schema: str = "public") -> str:
        """
        List all tables in a specific schema.
        
        Args:
            schema: The schema name (default: "public")
        
        Returns:
            JSON list of table names
        """
        sql = f"""
        SELECT table_name 
        FROM information_schema.tables 
        WHERE table_schema = '{schema}'
        AND table_type = 'BASE TABLE'
        """
        return redshift_query(sql)
  • Input/output schema definition for the tool via function signature (schema: str = 'public') and docstring.
    def redshift_list_tables(schema: str = "public") -> str:
        """
        List all tables in a specific schema.
        
        Args:
            schema: The schema name (default: "public")
        
        Returns:
            JSON list of table names
        """
  • Helper tool 'redshift_query' used by 'redshift_list_tables' to execute the generated SQL and return JSON results.
    @mcp.tool()
    def redshift_query(sql: str) -> str:
        """
        Execute a SQL query on Redshift and return results as JSON.
        
        Args:
            sql: The SQL query to execute
        
        Returns:
            JSON string of the query results or error message
        """
        try:
            with get_connection() as conn:
                df = pd.read_sql(sql, conn)
                return df.to_json(orient="records", indent=2)
        except Exception as e:
            return f"Error executing query: {str(e)}"
  • Supporting get_connection function used indirectly via redshift_query for database connectivity.
    def get_connection():
        """Create a connection to Redshift or local Postgres."""
        try:
            # If host is localhost and port is 5432, assume local Postgres for testing
            if REDSHIFT_HOST == "localhost" and REDSHIFT_PORT == 5432:
                import psycopg2
                return psycopg2.connect(
                    host=REDSHIFT_HOST,
                    port=REDSHIFT_PORT,
                    database=REDSHIFT_DATABASE,
                    user=REDSHIFT_USER,
                    password=REDSHIFT_PASSWORD
                )
            else:
                return redshift_connector.connect(
                    host=REDSHIFT_HOST,
                    port=REDSHIFT_PORT,
                    database=REDSHIFT_DATABASE,
                    user=REDSHIFT_USER,
                    password=REDSHIFT_PASSWORD
                )
        except Exception as e:
            logger.error(f"Connection error: {e}")
            raise
Behavior2/5

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

With no annotations provided, the description carries full burden but only states it's a list operation. It doesn't disclose behavioral traits like whether it requires specific permissions, how it handles large result sets, or potential rate limits. This leaves significant gaps for a tool that interacts with a database.

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

Conciseness5/5

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

The description is front-loaded with the core purpose, followed by clear Arg and Return sections. Every sentence earns its place with no wasted words, making it highly efficient and well-structured.

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 low complexity (1 parameter) and the presence of an output schema (which handles return values), the description is reasonably complete. It covers the purpose, parameter meaning, and return type, though it could benefit from more behavioral context given the lack of annotations.

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?

The description adds meaningful context for the single parameter by explaining that 'schema' is the schema name with a default of 'public'. Since schema description coverage is 0%, this compensates well, though it doesn't detail constraints like valid schema names or case sensitivity.

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 verb 'List' and resource 'tables in a specific schema', making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'redshift_describe_table' or 'redshift_query', which prevents 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 Guidelines3/5

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

The description implies usage through the phrase 'in a specific schema' and mentions a default value, suggesting context for when to use it. However, it lacks explicit guidance on when to choose this tool over alternatives like 'redshift_describe_table' or 'redshift_query', leaving some ambiguity.

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/santosh07401/redshift-mcp-server'

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