Skip to main content
Glama
avantifellows

Avanti Fellows PostgreSQL MCP Server

Official

search_columns

Find database columns by name across all tables when you know the column name but not which table contains it. Returns matching columns with their table names.

Instructions

Search for columns by name across all tables.

Useful when you know a column name but not which table it's in.

Args:
    search_term: Partial column name to search for (case-insensitive)

Returns:
    JSON array of matching columns with their tables

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_termYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'search_columns' tool, registered via @mcp.tool(). It queries information_schema.columns to find columns matching the search term across all non-system tables and returns a JSON array of matches.
    @mcp.tool()
    async def search_columns(search_term: str) -> str:
        """Search for columns by name across all tables.
    
        Useful when you know a column name but not which table it's in.
    
        Args:
            search_term: Partial column name to search for (case-insensitive)
    
        Returns:
            JSON array of matching columns with their tables
        """
        sql = """
            SELECT
                table_schema,
                table_name,
                column_name,
                data_type
            FROM information_schema.columns
            WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
            AND LOWER(column_name) LIKE LOWER($1)
            ORDER BY table_schema, table_name, column_name
        """
    
        try:
            async with get_connection() as conn:
                rows = await conn.fetch(sql, f"%{search_term}%")
                results = [dict(row) for row in rows]
                return json.dumps(results, indent=2)
        except Exception as e:
            return json.dumps({"error": str(e)})
Behavior4/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 effectively describes the search behavior (case-insensitive partial matching) and return format (JSON array with tables). However, it doesn't mention potential limitations like result size, pagination, or performance considerations for large databases.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly structured and concise: purpose statement, usage guidance, parameter explanation, and return format in four clear lines. Every sentence earns its place with no wasted words, and information is front-loaded appropriately.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (search across tables), no annotations, and the presence of an output schema (which handles return value documentation), the description is complete. It covers purpose, usage context, parameter semantics, and behavioral traits adequately for the agent to use it correctly.

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?

The schema has 0% description coverage, so the description must compensate. It clearly explains the 'search_term' parameter as 'Partial column name to search for (case-insensitive),' adding crucial semantic context beyond the bare schema. The description fully documents the single parameter's purpose and behavior.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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: 'Search for columns by name across all tables.' This specifies the verb (search), resource (columns), and scope (across all tables), distinguishing it from siblings like 'describe_table' (single table) or 'list_tables' (tables only).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly provides usage guidance: 'Useful when you know a column name but not which table it's in.' This clearly indicates when to use this tool versus alternatives like 'describe_table' (for specific table details) or 'query' (for data retrieval).

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/avantifellows/mcp-postgres'

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