Describe the database structure
db_schemaRetrieve 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.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "db_schema"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| uri | No | Connection 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. | |
| table | No | SQL only. Describe just this table. A name that is not an identifier yields no tables rather than being executed. | |
| detail | No | "summary" (default) lists objects and columns. "full" adds constraints, indexes, foreign keys and row estimates -- larger, and worth it before writing anything. | summary |
| profile | No | A 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. | |
| timeout | No | Milliseconds before giving up on the introspection (default 30000, between 1 and 86400000). | |
| collection | No | MongoDB only. Describe just this collection. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | False when the call failed; read "error" then. | |
| hint | No | ||
| bytes | Yes | ||
| error | No | Present only when "ok" is false. | |
| detail | No | ||
| driver | No | ||
| tables | No | SQL tables, views and columns. | |
| profile | No | ||
| database | Yes | Driver that answered, for example "sqlite". | |
| keyspace | No | Redis keyspace statistics. | |
| rowCount | Yes | ||
| elapsedMs | Yes | ||
| truncated | Yes | True when a limit removed something: the result is a prefix, not the answer. | |
| collections | No | MongoDB collections and indexes. | |
| limitReason | No | maxRows or maxBytes, when the result was truncated. |