Skip to main content
Glama

Describe the database structure

db_schema
Read-onlyIdempotent

Retrieve database schema details (tables, columns, indexes) before writing queries to avoid guessing names and failed executions. Supports SQL, MongoDB, Redis.

Instructions

Describe the structure of a database: tables and their columns for SQL, collections with their indexes for MongoDB, keyspace statistics for Redis. Call it before writing a query so names are not guessed -- it is almost always cheaper than a failed query. Runs read-only introspection statements only, never a statement of yours, and "table"/"collection" are bound as parameters wherever the driver allows rather than pasted into SQL. "detail": "full" adds foreign keys, index definitions, primary and unique constraints, row estimates, and inferred field schemas for MongoDB.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uriNoConnection string, for example postgres://user@host/db, mysql://user@host/db, sqlite:///path/to/app.db, mongodb://host/db or redis://host. Pass "profile" wherever db_list shows one.
tableNoSQL only. Describe just this table. A name that is not an identifier yields no tables rather than being executed.
detailNo"summary" (default) lists objects and columns. "full" adds constraints, indexes, foreign keys and row estimates -- larger, and worth it before writing anything.summary
profileNoA profile name from db_list. Exactly one of "profile" (a name from db_list) or "uri" (an ad-hoc connection string). Prefer "profile": it keeps the password out of the transcript.
timeoutNoMilliseconds before giving up on the introspection (default 30000, between 1 and 86400000).
collectionNoMongoDB only. Describe just this collection.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesFalse when the call failed; read "error" then.
hintNo
bytesYes
errorNoPresent only when "ok" is false.
detailNo
driverNo
tablesNoSQL tables, views and columns.
profileNo
databaseYesDriver that answered, for example "sqlite".
keyspaceNoRedis keyspace statistics.
rowCountYes
elapsedMsYes
truncatedYesTrue when a limit removed something: the result is a prefix, not the answer.
collectionsNoMongoDB collections and indexes.
limitReasonNomaxRows or maxBytes, when the result was truncated.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.0.4

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint, so the safety profile is covered. The description nevertheless adds real context beyond them: it runs introspection statements only and never a statement of the caller, and it binds "table"/"collection" as parameters rather than pasting them into SQL -- a meaningful disclosure about injection safety and how the call behaves.

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?

Three sentences, front-loaded with purpose, then usage rationale, then behavior and the detail modes; no filler or restatement of the tool name. It is dense but each clause adds a distinct fact, with only slight overlap between the detail=full sentence and the schema's own description of that parameter.

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?

An output schema exists, so return values need no explanation here. Given six optional parameters, 100% schema coverage, and annotations covering safety, the description supplies everything else an agent needs -- what it does per backend, when to call it, and how it is safely executed.

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 and the schema already documents every parameter. The description still earns above baseline by spelling out exactly what "detail": "full" adds -- foreign keys, index definitions, primary and unique constraints, row estimates, and inferred field schemas for MongoDB -- which is more concrete than the schema's enumeration and tells the agent when the cost is worth it.

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 opening sentence names a specific verb (describe) and resource (database structure) and enumerates what that means per backend: tables/columns for SQL, collections/indexes for MongoDB, keyspace statistics for Redis. It is immediately distinguishable from db_query, db_explain and db_health, which it implicitly contrasts by positioning itself as the pre-query step.

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 an explicit when-to-use rule -- "Call it before writing a query so names are not guessed -- it is almost always cheaper than a failed query" -- which is a clear, actionable trigger. It stops short of naming the sibling alternatives (db_explain, db_health) or stating when *not* to call it, so it is strong but not exhaustive.

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