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

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)})

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