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

MCPg - Production-grade PostgreSQL MCP Server

PG search parse query

pg_search_parse_query
Read-only

Parses a pg_search query string and returns canonical text for debugging, letting you confirm parser interpretation with lenient or AND-mode options.

Instructions

Parse a query string through pdb.parse and return its canonical text form for debugging — useful for confirming the parser interpreted a phrase as expected. lenient=True relaxes syntax checking; conjunction_mode=True treats space-separated terms as AND-joined rather than OR-joined. 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": {
      "query_string": "<query_string>"
    },
    "name": "pg_search_parse_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
lenientNo
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.
query_stringYes
conjunction_modeNo

Output Schema

NameRequiredDescriptionDefault
parsedYes

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
Behavior3/5

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

Annotations already declare this is a safe read-only, closed-world operation, so the safety profile is covered. The description still adds real value by stating a hard prerequisite ('Requires the pg_search extension') and what the tool returns (canonical text), but it says nothing about failure behavior when the extension is absent or when lenient parsing still rejects input.

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?

Two sentences, front-loaded with the effect and purpose, then the two flag semantics and the prerequisite. No filler, no restatement of the tool name.

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?

With an output schema present, the description needn't detail return structure, and it still summarizes the return as canonical text. Combined with the extension prerequisite and flag semantics, an agent has enough to call it correctly; only error/absence handling is unaddressed.

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 only 25%, so the description must compensate and largely does: it explains that lenient relaxes syntax checking and that conjunction_mode switches space-separated terms from OR to AND. The database parameter is covered by its own schema description, leaving only the obvious query_string undocumented.

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 verb and resource ('Parse a query string through pdb.parse and return its canonical text form') plus the debugging intent, which implicitly separates it from the search-executing siblings like pg_search_run and pg_search_more_like_this. It never names a sibling explicitly, so the differentiation is inferred rather than stated.

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 clause 'useful for confirming the parser interpreted a phrase as expected' gives a concrete debug-time use case. There is no explicit 'do not use this to run searches — use pg_search_run instead' routing statement, so an agent must infer the boundary from the sibling names.

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