Skip to main content
Glama

list_views

Retrieve and display all views within a specified schema in a Vertica database. Simplifies schema inspection and view management for efficient database oversight.

Instructions

List all views in a schema.

Args: ctx: FastMCP context for progress reporting and logging schema: Schema name (default: public) Returns: View information as a string

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaNopublic

Implementation Reference

  • The main handler function for the 'list_views' tool. It is decorated with @mcp.tool() for registration and implements the logic to query and list views from the Vertica v_catalog.views table in the specified schema.
    @mcp.tool() async def list_views( ctx: Context, schema: str = "public" ) -> str: """List all views in a schema. Args: ctx: FastMCP context for progress reporting and logging schema: Schema name (default: public) Returns: View information as a string """ await ctx.info(f"Listing views in schema: {schema}") # 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 table_name, view_definition FROM v_catalog.views WHERE table_schema = %s ORDER BY table_name; """ conn = None cursor = None try: conn = manager.get_connection() cursor = conn.cursor() cursor.execute(query, (schema,)) views = cursor.fetchall() if not views: return f"No views found in schema: {schema}" result = f"Views in schema {schema}:\n\n" for view in views: result += f"View: {view[0]}\n" result += f"Definition:\n{view[1]}\n\n" return result except Exception as e: error_msg = f"Error listing views: {str(e)}" await ctx.error(error_msg) return error_msg finally: if cursor: cursor.close() if conn: manager.release_connection(conn)

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