Skip to main content
Glama

Search objects by name

pg_search
Read-onlyIdempotent

Search PostgreSQL database objects by name across tables, columns, functions, indexes, and comments to find where a known term lives; results are grouped by kind and ranked by match type.

Instructions

Find database objects by name: tables, views, columns, functions, indexes, sequences, types, enum labels, triggers, constraints, schemas, extensions, and text inside comments.

Use it when you know a word (invoice, customer_id) but not where it lives. The answer is grouped by kind, best matches first (exact name, then prefix, then substring), each as schema.object. query matches anywhere in a name (* and ? are wildcards). kinds narrows the search, schema limits it to one schema, limit is the maximum per kind. System schemas are skipped unless named.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "query": "<query>"
    },
    "name": "pg_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindsNo
limitNo
queryYes
schemaNo
connectionNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already cover the safety profile, but the description adds substantial behavior: results are grouped by kind, ranked exact → prefix → substring, formatted as `schema.object`, and system schemas are skipped unless named. It also discloses that `limit` applies per kind, which is non-obvious.

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?

Three sentences, each doing distinct work: what it finds, when to reach for it, and how results and parameters behave. No filler, and the scoping/setup information is front-loaded before the parameter details.

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

Completeness4/5

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

There is no output schema, but the description explains the return shape (grouped by kind, ranked, `schema.object`) well enough to consume results. The only real gap is the unexplained `connection` parameter for a tool that presumably targets a specific database connection.

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?

Schema coverage is 0%, so the description must carry parameter meaning, and it does for four of five: `query` substring/wildcard semantics (`*`, `?`), `kinds` narrowing, `schema` scoping, and `limit` as a per-kind maximum. The `connection` parameter is never mentioned, leaving one parameter undocumented anywhere.

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?

States a specific verb and resource ("Find database objects by name") and enumerates exactly what object kinds are covered. The scenario line ("you know a word (`invoice`, `customer_id`) but not where it lives") separates it from listing-oriented siblings like pg_list_objects without naming them.

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

Usage Guidelines4/5

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

Gives a concrete when-to-use condition with example queries, and implicitly contrasts with listing tools by emphasizing name-based lookup. It does not explicitly name an alternative for the case where you want a full inventory or want to inspect source, so exclusions are left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.