Skip to main content
Glama
MCPg - Production-grade PostgreSQL MCP Server

MCPg - Production-grade PostgreSQL MCP Server

PG search more like this

pg_search_more_like_this
Read-only

Find rows similar to a seed document using PostgreSQL pg_search more_like_this, returning matching IDs and relevance scores for similarity search.

Instructions

Find rows similar to a seed document via pdb.more_like_this + @@@. document_id is the value of key_field for the seed row. All nine documented pdb.more_like_this tuning args (fields jsonb, min_doc_frequency, max_doc_frequency, min_term_frequency, max_query_terms, min_word_length, max_word_length, boost_factor, stop_words) are optional kwargs — when omitted the wrapper does not mention them in the SQL so upstream's defaults apply. Returns the same {id, score} hit shape as pg_search_run. Requires the pg_search extension.

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": {
      "schema": "<schema>",
      "table": "<table>",
      "document_id": "<document_id>",
      "key_field": "<key_field>",
      "limit": "<limit>"
    },
    "name": "pg_search_more_like_this"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitYes
tableYes
fieldsNo
schemaYes
databaseNoOptional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected.
key_fieldYes
stop_wordsNo
document_idYes
boost_factorNo
max_query_termsNo
max_word_lengthNo
min_word_lengthNo
max_doc_frequencyNo
min_doc_frequencyNo
min_term_frequencyNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.4
    • changedInput schema / properties / database / description
      Previous value: -"Optional: target a configured secondary (read-only) database by name; omit for the primary. Call list_databases to see the configured ids."New value: +"Optional: a database id from list_databases, to target a configured secondary (read-only) database; omit for the primary. Database names that are not configured ids are rejected."
  2. First observedv0.6.8

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered; the description adds genuinely new behavior: the pg_search extension dependency and the important detail that omitted tuning kwargs are dropped from the generated SQL so upstream defaults apply. It does not mention pagination or cost/limits on scanning a large table, which keeps it below a 5.

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?

Front-loaded with the core purpose, then seed-row semantics, then optional args, then return shape and prerequisite — a sensible order. It is dense with backticked identifiers and the nine-arg enumeration is long, but every clause carries information rather than filler.

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?

For a 15-parameter tool with an output schema, the description covers the non-obvious required-parameter relationship (document_id ↔ key_field), the extension prerequisite, defaulting behavior, and return shape. Remaining gaps are limit behavior and schema/table selection conventions, which are largely self-evident from their names.

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?

Schema description coverage is only 7% (just 'database'), so the description has to compensate and does so partially: it explains that document_id is the value of key_field for the seed row and enumerates the nine optional tuning args with their types. But it gives no meaning for limit, schema, table, key_field, or how each tuning knob changes results, leaving the majority of the 15 parameters semantically thin.

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 rows similar to a seed document', and pins the underlying mechanism (pdb.more_like_this + @@@). It also anchors itself against a sibling by noting the returned hit shape matches pg_search_run, so an agent can tell it apart from full-text/hybrid search without opening the schema.

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

Usage Guidelines3/5

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

The seed-document framing implies when the tool applies, and 'Requires the pg_search extension' gives a prerequisite. However, it never explicitly states when to choose this over pg_search_run or hybrid_bm25_vector_search, nor any exclusion or fallback path if the extension is absent.

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

Deploy Server

Other Tools