Skip to main content
Glama
nolleh
by nolleh

list_indexes

Retrieve all indexes for a specific table in Vertica databases to analyze database structure and optimize query performance.

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 handler function for the 'list_indexes' tool. It is decorated with @mcp.tool() for registration and implements the logic to query Vertica's v_catalog.projections table to retrieve and format index (projection) information for a given table and schema.
    @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)
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool lists indexes but doesn't describe what 'index information' includes (e.g., index names, types, columns), whether it's read-only, requires permissions, or has any side effects. This leaves significant gaps for a tool that interacts with database metadata.

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 concise and well-structured with clear sections for Args and Returns. However, the inclusion of 'ctx' in Args (which isn't in the input schema) adds minor noise, and the Returns section is vague ('Index information as a string').

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 (database metadata query), lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the output contains, potential errors, or behavioral traits like performance implications. This makes it inadequate for confident tool invocation.

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 adds minimal value beyond the input schema. It mentions 'table_name' and 'schema' parameters but doesn't explain their semantics beyond what's in the schema (e.g., format of table names, what schemas are valid). With 0% schema description coverage, the description doesn't compensate adequately, but it at least names the parameters.

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 ('List') and resource ('indexes for a specific table'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'get_table_structure' or 'list_views', which might also involve table metadata retrieval.

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_structure' (which might include index info) or 'list_views', nor does it specify prerequisites or exclusions for usage.

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