Skip to main content
Glama

list_indexes

Retrieve detailed index information for a specified table in a Vertica database, including schema context. Optimizes database management by enabling quick inspection of table indexes.

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
schemaNopublic
table_nameYes

Implementation Reference

  • Implements the list_indexes tool handler using @mcp.tool() decorator. Queries v_catalog.projections to list projections (Vertica's equivalent of indexes) for the specified table and schema, formats and returns the results as a string.
    @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 the list_indexes function as an MCP tool.
    @mcp.tool()

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

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