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

MCPg - Production-grade PostgreSQL MCP Server

Recommend read your writes

recommend_read_your_writes
Read-only

Determine whether to use WAIT FOR LSN for read-your-writes consistency by combining server role, replay lag, and PostgreSQL version into an actionable recommendation.

Instructions

Advise whether the caller should use WAIT FOR LSN for read-your-writes consistency. Combines server role (primary vs standby), replay lag, and PG version into a structured recommendation. Never raises. reason is one of primary_no_wait_needed, standby_no_lag, standby_lag_unknown, standby_with_lag, standby_pg18_or_older, unavailable. Returns an object with recommend_use (bool), reason, is_in_recovery, server_version_num, current_lag_bytes (int / null), and detail.

Example: recommend_read_your_writes()

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "recommend_read_your_writes"
  }
}

Input Schema

NameRequiredDescriptionDefault
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.

Output Schema

NameRequiredDescriptionDefault
detailYes
reasonYes
recommend_useYes
is_in_recoveryYes
current_lag_bytesYes
server_version_numYes

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

A4.3/5.0
Behavior4/5

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

The annotations already mark this as a safe read-only, closed-world operation. The description adds meaningful behavior beyond that: it combines server role, replay lag, and version; never raises; enumerates the possible `reason` values including `unavailable` and lag-unknown states; and lists the return object fields.

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?

The description is front-loaded with the core purpose, then compactly lists the inputs considered, failure behavior, reason codes, and return fields. The example call is brief and the entire definition is appropriately sized with no wasted wording.

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

Completeness5/5

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

Given that this is a low-risk advisory tool, annotations cover its safety profile, an output schema exists, and the description supplies the behavioral contract, reason codes, and non-raising behavior, nothing essential for correct invocation is missing. The description is complete relative to the tool's complexity.

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 100%, so the optional `database` parameter is already documented as a configured secondary database id. The description adds no further parameter semantics and does not mention the database targeting behavior, so the schema carries the burden and the baseline 3 is appropriate.

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 states a specific decision-support verb and resource: advise whether the caller should use `WAIT FOR LSN` for read-your-writes consistency. It also differentiates this advisory tool from siblings such as `wait_for_lsn` by describing it as producing a structured recommendation rather than performing the wait.

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?

The description clearly establishes the decision context: callers use it to decide whether to apply `WAIT FOR LSN` based on role, replay lag, and PG version. It does not explicitly name the alternative tool (`wait_for_lsn`) or give when-not conditions, but the intended usage is clear from the opening sentence.

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