Skip to main content
Glama
db-conn-mcp

db-conn-mcp

sample_table_rows

Read-onlyIdempotent

Fetch up to N rows from a database table to see real values and data shape before writing a query; no filters or ordering.

Instructions

Fetch up to N rows of a table to learn its data shape.

Use it to see what real values look like before writing a query: no filter, no ordering. To fetch specific rows use execute_read_query with a WHERE clause; for more than 1000 rows use open_query_cursor and fetch_rows; to find which table holds a value use search_value. A table that does not exist is an error.

Returns meta and rows, one object per row keyed by column name, in no guaranteed order. n defaults to 10 and the answer holds at most 1000 rows: a larger n is clamped to 1000. meta.truncated is true only when n was over 1000 and was clamped; it reports that clamp, not whether the table holds more rows.

Rows arrive on the text channel only, inside the untrusted-data banner: this tool emits no structuredContent. Values render as on execute_read_query (bytea as \x hex text).

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

Input Schema

NameRequiredDescriptionDefault
nNoHow many rows to return: default 10, at most 1000.
tableYesTable or view name exactly as list_tables shows it (case-sensitive, no quotes), optionally schema-qualified: 'orders' or 'public.orders'.
databaseYesName of a configured database, exactly as list_databases returns it (case-sensitive). Not a DSN, host or server-side database name. An unknown name is an error that lists the configured names.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.8.1
    • addedInput schema / properties / database / description
      Added value: +"Name of a configured database, exactly as list_databases returns it (case-sensitive). Not a DSN, host or server-side database name. An unknown name is an error that lists the configured names."
    • addedInput schema / properties / n / description
      Added value: +"How many rows to return: default 10, at most 1000."
    • addedInput schema / properties / table / description
      Added value: +"Table or view name exactly as list_tables shows it (case-sensitive, no quotes), optionally schema-qualified: 'orders' or 'public.orders'."
  2. First observed

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare read-only, idempotent, non-destructive behavior, but the description adds substantial context beyond them: nonexistent tables error, rows come back in no guaranteed order, n is clamped to 1000, and meta.truncated reports only the clamp rather than table size. It also discloses the transport detail that rows arrive on the text channel inside an untrusted-data banner with no structuredContent, which matters for parsing.

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-loaded with purpose and routing before detailing return shape and clamping. Dense but nearly every sentence carries operational value; the truncated/clamp explanation is slightly wordy but prevents a real misreading.

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?

No output schema exists, so the description carries the return contract itself and does so fully: meta and rows, row keying by column name, ordering caveat, clamping semantics, and value rendering including bytea as hex text. Nothing material is missing for a three-parameter sampling tool.

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 100%, so the baseline is 3, but the description earns more by explaining that n defaults to 10 and that values over 1000 are clamped rather than rejected. It also clarifies the meaning of meta.truncated relative to n, which the schema does not convey.

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 ("Fetch up to N rows of a table") plus the intent ("to learn its data shape"), which immediately separates it from query-execution siblings. An agent can identify the tool without opening the schema.

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 explicit when-to-use framing ("see what real values look like before writing a query") and names three alternatives with the conditions that select them: execute_read_query with WHERE for specific rows, open_query_cursor plus fetch_rows beyond 1000 rows, and search_value to locate which table holds a value. It also states a clear exclusion (no filter, no ordering).

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