Skip to main content
Glama
nolleh
by nolleh

list_indexes

List all indexes for a specified table in Vertica. Provide table name and optional schema to retrieve index information. Useful for database schema inspection and query optimization.

Instructions

List all indexes for a specific table.

Args:
    ctx: FastMCP context for progress reporting and logging
    table_name: Name of the table to inspect
    schema: Schema name (default: public)

Returns:
    Index information as a string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
table_nameYes
schemaNopublic

Implementation Reference

  • The `list_indexes` async handler function that lists projections (indexes) for a given Vertica table. It queries v_catalog.projections and returns formatted results.
    @mcp.tool()
    async def list_indexes(
        ctx: Context,
        table_name: str,
        schema: str = "public"
    ) -> str:
        """List all indexes for a specific table.
    
        Args:
            ctx: FastMCP context for progress reporting and logging
            table_name: Name of the table to inspect
            schema: Schema name (default: public)
    
        Returns:
            Index information as a string
        """
        await ctx.info(f"Listing indexes for table: {schema}.{table_name}")
    
        # Get or create connection manager
        manager = await get_or_create_manager(ctx)
        if not manager:
            return "Error: Failed to initialize database connection. Check configuration."
    
        query = """
        SELECT
            projection_name,
            is_super_projection,
            anchor_table_name
        FROM v_catalog.projections
        WHERE projection_schema = %s
        AND anchor_table_name = %s
        ORDER BY projection_name;
        """
    
        conn = None
        cursor = None
        try:
            conn = manager.get_connection()
            cursor = conn.cursor()
            cursor.execute(query, (schema, table_name))
            indexes = cursor.fetchall()
    
            if not indexes:
                return f"No projections found for table: {schema}.{table_name}"
    
            # Format the output for projections
            result = f"Projections for {schema}.{table_name}:\n\n"
            for proj in indexes:
                # proj[0]: projection_name, proj[1]: is_super_projection, proj[2]: anchor_table_name
                result += f"- {proj[0]} (Super Projection: {proj[1]}) [Table: {proj[2]}]\n"
            return result
    
        except Exception as e:
            error_msg = f"Error listing indexes: {str(e)}"
            await ctx.error(error_msg)
            return error_msg
        finally:
            if cursor:
                cursor.close()
            if conn:
                manager.release_connection(conn)
  • The @mcp.tool() decorator registers list_indexes as an MCP tool on the FastMCP instance.
    @mcp.tool()
    async def list_indexes(
Behavior2/5

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

No annotations are present, so the description must disclose behavioral traits. It states returns are a string but omits details on performance, side effects, permissions, or error handling, leaving the agent under-informed.

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 short and includes an Args/Returns structure, making it reasonably scannable. It could be slightly more concise by merging the header, but overall it is efficient.

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 has 2 parameters and no output schema, the description is minimal. It lacks details on the return format, edge cases, or database prerequisites, making it only barely adequate for operation.

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?

Schema coverage is 0%, but the description adds meaningful parameter descriptions ('Name of the table to inspect' and 'Schema name (default: public)'), compensating for the lack of schema descriptions. This adds value beyond the schema.

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 'List all indexes for a specific table,' specifying the verb and resource. However, it does not differentiate from sibling tools like get_table_structure, which might have similar functionality.

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?

No guidance is provided on when to use this tool versus alternative tools. The description only states what the tool does, without any when-not or alternative references.

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/nolleh/mcp-vertica'

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