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

MCPg - Production-grade PostgreSQL MCP Server

Hybrid search

hybrid_search
Read-only

Fuse vector and full-text rankings with reciprocal-rank fusion so rows strong in either semantic or keyword search surface, overcoming gaps in single-method retrieval.

Instructions

Combine vector and full-text ranking via reciprocal-rank fusion (RRF) — pulls candidates from each source, then fuses them so rows ranked highly in EITHER source surface. Closes the gap between pure vector (misses keyword/identifier matches) and pure full-text (misses semantic synonyms). Parameters: vector_column, text_column, query_vector, text_query, plus metric / text_config / limit / candidate_pool / rrf_k tunables. Each match carries vector_rank, fts_rank, the fused rrf_score, and (when present) the original distance + ts_rank values.

Example: hybrid_search(schema='public', table='docs', vector_column='embedding', text_column='body', query_vector=[0.1, ...], text_query='postgresql tuning')

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>",
      "vector_column": "<vector_column>",
      "text_column": "<text_column>",
      "query_vector": "<query_vector>",
      "text_query": "<text_query>"
    },
    "name": "hybrid_search"
  }
}

Input Schema

NameRequiredDescriptionDefault
limitNo
tableYes
metricNol2
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.
text_queryYes
text_columnYes
text_configNoenglish
query_vectorYes
vector_columnYes
candidate_poolNo

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.7/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, and the description adds real value on top: it explains the RRF mechanics, names the tunable knobs, and describes the per-row output fields (vector_rank, fts_rank, rrf_score, distance, ts_rank). That goes well beyond the annotation surface.

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 what and why, then parameters, then a concrete call example. Dense and mostly waste-free, though the clause about pulling candidates and fusing them partially restates the opening sentence.

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 an 11-parameter tool with 6 required inputs and near-zero schema documentation, the description covers the mechanics, the knob list, the returned rank fields, and a usage example. Remaining gaps are knobs semantics and sibling disambiguation.

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 9%, so the description must compensate. It names all the key inputs and groups metric/text_config/limit/candidate_pool/rrf_k as tunables, but explains none of their meaning or accepted values. It also references rrf_k, which does not appear in the input schema at all.

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

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific technique and verb: combine vector and full-text ranking via reciprocal-rank fusion, with a clear rationale (closes gaps of pure vector and pure full-text). It doesn't distinguish itself from the close sibling hybrid_bm25_vector_search, which is the only real gap.

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 value proposition ('closes the gap between pure vector... and pure full-text...') implies when to reach for it, but there is no explicit 'use this when / use X instead' routing, and it never mentions vector_search, full_text_search, or hybrid_bm25_vector_search as alternatives.

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