Skip to main content
Glama
db-conn-mcp

db-conn-mcp

get_table_schema

Retrieves a table's columns, types, primary and foreign keys, and optional indexes so you can write correct filters or JOINs and inspect what is indexed.

Instructions

Get columns, types, and primary/foreign keys for a table.

Pass include_indexes=true to also get the table's indexes (name, its KEY columns in index order — an INCLUDE payload is not listed — whether it is unique, and its method: btree, gin, ...). Use it before writing a filter or a JOIN, or when a query is slow and you want to know what is actually indexed. Omitted by default, so the plain answer stays small.

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": "get_table_schema"
  }
}

Input Schema

NameRequiredDescriptionDefault
tableYes
databaseYes
include_indexesNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description must carry the full behavioral burden; it does disclose that indexes are omitted by default to keep the response small and that an INCLUDE payload is not listed, which are genuinely useful behavioral details. However, it says nothing about permissions, whether the call is read-only, or what happens for a nonexistent table, leaving the annotation gap only partly filled.

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?

The core purpose is front-loaded in one sentence, followed by the optional-flag detail and the when-to-use guidance. The parenthetical about index fields is dense but each clause carries real information; nothing is redundant.

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?

There is no output schema, and the description names the fields returned (columns, types, PK/FK, plus index name/columns/uniqueness/method). It omits other likely column metadata such as nullability or defaults, but a competent agent has enough to decide and call correctly.

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 0%, so the description must compensate; it explains include_indexes thoroughly (default false, what it adds, the shape of index data, the INCLUDE caveat). The database and table parameters receive no explanation at all, though their names are largely self-explanatory.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence names a specific verb and resource ('Get columns, types, and primary/foreign keys for a table'), which cleanly separates it from list_tables and get_database_schema. It doesn't explicitly name a sibling as the alternative, but the scope of the returned metadata is unmistakable.

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?

It gives two concrete usage conditions: before writing a filter or JOIN, and when a query is slow and you need to know what is actually indexed. That is clear context, though it never states when to prefer get_database_schema over this tool when both could answer the question.

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