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

MCPg - Production-grade PostgreSQL MCP Server

Fuzzy search

fuzzy_search
Read-only

Find and rank PostgreSQL text column values by trigram similarity to a search term, using word or full-string matching and returning matches with similarity scores.

Instructions

Rank a text column's values by pg_trgm trigram similarity to a search term. mode='word' (default) matches fragments within longer text; mode='full' compares whole strings. Reports available=false if pg_trgm is not installed. Returns an object with available (bool), matches (list of {value, similarity} ranked by similarity descending), and mode.

Example: fuzzy_search(schema='public', table='users', column='name', term='janne', mode='word')

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>",
      "column": "<column>",
      "term": "<term>"
    },
    "name": "fuzzy_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
modeNoword
termYes
limitNo
tableYes
columnYes
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.
thresholdNo

Output Schema

NameRequiredDescriptionDefault
matchesYes
availableYes

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.8/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 genuine behavioral context beyond that: the graceful degradation path when pg_trgm is absent and the ranked-descending ordering of matches. It omits how limit and threshold prune or cap results, which matters for interpreting output.

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 action, then the mode distinction, then the failure mode, then an example — a sensible order with no filler. The final sentence enumerating the return object partly duplicates the existing output schema, which is the only redundancy.

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

Completeness3/5

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

An output schema exists, so return-value explanation is not required, and the description is otherwise adequate. For an 8-parameter tool with 13% schema coverage, though, the silence on threshold and limit leaves two behaviorally significant knobs undocumented.

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 13%, so the description must carry the load. It explains term, mode, and (via the example) schema/table/column, but leaves limit (default 10) and threshold (default 0.3) entirely undefined in both schema and description — an agent cannot tell that threshold filters out weak matches.

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 names a specific mechanism (pg_trgm trigram similarity ranking over a text column) plus the verb and resource, which clearly separates it from full_text_search, vector_search, and hybrid_search siblings. An agent can tell it performs approximate string matching rather than semantic or lexical-document search.

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?

It gives real selection guidance between mode='word' (fragments inside longer text) and mode='full' (whole-string comparison), and it warns that available=false when pg_trgm is missing. However, it never says when to pick this tool over the numerous search siblings (full_text_search, vector_search, pg_search_run), leaving that routing to inference.

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