Skip to main content
Glama
db-conn-mcp

db-conn-mcp

check_sequences

Identify sequences that lag behind their column's maximum value after migrations or bulk copies, revealing stale sequences that could issue duplicate IDs.

Instructions

Find sequences lagging behind their column's max value (stale after migrations).

A behind: true sequence would hand out an id that already exists — fix with setval(). Run this after any bulk copy or logical-replication migration. By default only the problem sequences are listed, with total_sequences reporting how many were checked — so behind_count: 0 means "all clear". Pass behind_only=false for the full census; on a large schema that is one row per sequence (hundreds), so ask for it only when you need every sequence's state.

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": {
      "database": "<database>"
    },
    "name": "check_sequences"
  }
}

Input Schema

NameRequiredDescriptionDefault
databaseYes
behind_onlyNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

With no annotations, the description carries the burden and does so well: it discloses the risk of a lagging sequence (handing out a duplicate id), the default filtering behavior, the cost of the alternative mode, and how to read a clean result. It stops short of stating permitted access level or the full set of returned fields, but the read-only nature is implied by the check semantics and the 'all clear' framing.

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-loads the core definition, then the consequence, then the mode switch — a logical order. Every clause carries information, though the parenthetical '(hundreds)' and the setval() aside are slightly editorial for a tool definition.

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?

No output schema exists, so the description rightly explains the result contract (behind_count, total_sequences, one row per sequence in census mode). It is nearly complete for a two-parameter tool, though it doesn't enumerate the per-row fields an agent would see for a lagging sequence.

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 0%, so the description must compensate; it fully explains the non-obvious parameter (behind_only default true, false for a full census, with a performance caveat). The required 'database' parameter is left unexplained, though its meaning is largely self-evident from the name and sibling tools.

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 — finding sequences that lag behind their column's max value — plus the underlying cause (stale after migrations). No sibling tool (check_database, doctor, table_stats) does this, so it is unambiguous which one to call.

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

Usage Guidelines5/5

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

Gives an explicit trigger ('run this after any bulk copy or logical-replication migration'), explains the default mode, and explicitly warns when NOT to request the full census ('on a large schema that is one row per sequence (hundreds)'). It also names the remediation outside the tool (setval()).

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