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

MCPg - Production-grade PostgreSQL MCP Server

Generate test row for

generate_test_row_for
Read-only

Generates a single realistic PostgreSQL test row using catalogue metadata, skips generated columns, samples foreign-key values, and returns ready-to-run INSERT SQL without executing it.

Instructions

Generate ONE realistic test row for a table — catalogue-aware. Skips identity / generated columns (server fills them in), samples one existing row from each referenced table for FK columns (so the row inserts cleanly), and uses column-name heuristics (*_email → user_N@example.com, *_url → https://example.com/r/N, *_at → recent timestamp, etc.) to make values look like data. Sibling of generate_test_data (bulk) — designed for the shadow-migration workflow where a single realistic row matters more than volume. Returns an object with insert_sql (one ready-to-execute INSERT), columns (per-column ColumnFill with sql_literal + heuristic explanation), schema, table. Does NOT execute the INSERT — caller applies via run_write when ready.

Example: generate_test_row_for(schema='public', table='orders', seed=42)

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>"
    },
    "name": "generate_test_row_for"
  }
}

Input Schema

NameRequiredDescriptionDefault
seedNo
tableYes
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.
follow_foreign_keysNo

Output Schema

NameRequiredDescriptionDefault
tableYes
schemaYes
columnsYes
insert_sqlYes

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

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

Goes well beyond the annotations by disclosing what is skipped (identity/generated columns), how FK values are produced (sampling one existing row per referenced table so the row inserts cleanly), the column-name heuristics used for value shape, and that the tool does NOT execute the INSERT. This is the kind of behavior an agent cannot infer from readOnlyHint/openWorldHint.

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?

Dense but front-loaded: the one-row scope and catalogue-awareness come first, then mechanics, then return shape, then the non-execution caveat, then an example. Every sentence carries information, though the heuristic parenthetical is packed tightly enough to slow scanning.

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 a five-parameter generator with an output schema, the description covers generation strategy, FK handling, return keys, and the execution boundary. Remaining gaps are minor — seed determinism and the `follow_foreign_keys` toggle — and return values are already documented by the output schema.

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 20% (only `database` is documented in-schema), so the description carries much of the burden. It illustrates `schema`, `table`, and `seed` via the example call and explains FK sampling, which implicitly covers `follow_foreign_keys`. However, `seed` reproducibility semantics and how to disable `follow_foreign_keys` (default true) are never stated.

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 ("Generate ONE realistic test row for a table") and immediately differentiates itself from the bulk sibling `generate_test_data`. An agent can tell exactly which of the two generation tools to pick without opening either schema.

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?

Names the alternative (`generate_test_data` bulk) and the workflow that selects this tool: "the shadow-migration workflow where a single realistic row matters more than volume." It also clarifies the hand-off — the caller applies the INSERT via `run_write`. It stops short of explicit when-not-to-use conditions, but the routing context is clear.

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