Skip to main content
Glama
nolleh
by nolleh

list_views

Retrieve all views from a specified schema in Vertica databases to analyze database structure and access available data perspectives.

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 handler function for the 'list_views' tool. It connects to Vertica, executes a query against v_catalog.views to fetch views in the given schema, formats the results, and returns them as a string. Includes the @mcp.tool() decorator for registration.
    @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)
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('List') and return type ('View information as a string'), but lacks details on permissions, rate limits, pagination, or error handling. For a tool with no annotations, this is insufficient to inform safe and effective use.

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 concise and well-structured with clear sections for Args and Returns, using only necessary sentences. However, the inclusion of 'ctx' in Args, which isn't in the input schema, adds minor noise, slightly reducing efficiency.

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 simplicity (1 parameter, no output schema, no annotations), the description is incomplete. It lacks context on when to use it, behavioral traits like safety or performance, and doesn't fully explain the parameter or return value format, making it inadequate for reliable agent operation despite the low complexity.

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 semantics beyond the input schema: it names the parameter ('schema') and provides a default value ('public'), which the schema already covers. With 0% schema description coverage, the description doesn't compensate by explaining format constraints or usage examples, but it doesn't contradict the schema either, meeting the baseline for adequate but incomplete coverage.

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 ('all views in a schema'), making the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_table_structure' or 'list_indexes', which might also involve schema metadata retrieval, so it misses full sibling differentiation.

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 any prerequisites, exclusions, or comparisons to sibling tools like 'get_table_structure' for broader schema information or 'list_indexes' for index-related metadata, leaving usage context unclear.

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