Skip to main content
Glama
hangdo-merkle

postgres-mcp

get_table_sample

Preview data from a PostgreSQL table by returning the first n rows, ordered by primary key when available. Specify table, schema, and row count to inspect data without modifying the database.

Instructions

Return the first n rows of a table (ORDER BY primary key if available).

Args: table: Table name. schema: Schema name (default: "public"). n: Number of rows to return (default: 20, max: 500).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nNo
tableYes
schemaNopublic

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden. It does disclose the ordering behavior (if primary key available) and the max row limit (500), which adds value. However, it does not mention error behavior, whether it is strictly read-only (though 'Return' implies so), or what happens when no primary key exists (non-deterministic order). These gaps are minor but present.

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 concise and well-structured: a one-line summary followed by a clean parameter list. No redundant wording, and the most important detail (the ordering behavior) is front-loaded. Every sentence earns its place.

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?

The tool is simple and has an output schema, so the return shape is covered. The description explains the core behavior and parameter constraints. It does not mention edge cases like negative n or empty results, but these are either self-evident or unlikely to affect correct usage. The description is complete enough for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must explain every parameter. It does so clearly: table name, schema (with default), and n (with default and max). It adds the max constraint (500) which is not in the schema. This fully compensates for the missing schema descriptions.

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 clearly states the action: 'Return the first *n* rows of a table' with an explicit ordering hint (ORDER BY primary key). It distinguishes itself from siblings like list_tables and execute_query by focusing on sampling rows. No ambiguity.

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 description implies usage (quick sample of a table) but does not explicitly state when to choose this over alternatives like execute_query or describe_table. There are no when-not-to-use notes or direct comparisons to siblings. Usage context is inferred rather than spelled out.

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