Skip to main content
Glama

Database map

db
Read-only

Trace which code queries each table by mapping database schema, columns, keys and indexes from repo migrations or a read-only live connection.

Instructions

Map the database: tables, columns, primary and foreign keys, indexes, and the code that queries each table (file:line). By default it reads schema sources in the repo: SQL migrations, Prisma, Drizzle, SQLAlchemy, Diesel and Django models. To inspect a live Postgres, MySQL or SQLite database, pass url_env (the NAME of an environment variable holding the connection string). The connection is strictly read-only and the string is never stored or shown. Pass table for one table's full detail.

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

Input Schema

NameRequiredDescriptionDefault
urlNoConnection string (prefer url_env so secrets stay out of transcripts).
rootNoRepository root. Defaults to the client's workspace root or the server's working directory.
tableNoFocus on one table: columns, indexes, who references it, and where the code queries it.
formatNotext (default, compact, file:line cited) or json.
url_envNoName of an env var with the connection string, e.g. DATABASE_URL.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint and openWorldHint, but the description adds genuinely new behavioral facts: the live connection is 'strictly read-only' and the connection string is 'never stored or shown'. It also discloses that the default path touches repo files rather than a network service, and that output is compact with file:line citations unless json is requested. It does not discuss scale, timeouts, or behavior when no schema sources are found.

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?

Four sentences, front-loaded with what gets mapped, then defaults, then the live-DB escape hatch, then the narrowing option. Each sentence carries distinct information with no filler or repetition.

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?

With five optional parameters and no output schema, the definition covers defaults (root), mode selection (url_env vs repo sources), scope narrowing (table), and output format (text/json), which is enough to call it correctly. The remaining gap is that return-value shape for json mode is undocumented and no sibling differentiation is offered, but neither is critical given the annotations.

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 100%, so every parameter is already documented in the schema, and the description largely restates those semantics (url_env as the name of an env var, table for single-table focus). It does add the useful framing that url_env is preferred over url to keep secrets out of transcripts, but that preference is already stated in the schema's own url description.

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 opens with a specific verb and resource ('Map the database') and enumerates exactly what is mapped: tables, columns, primary and foreign keys, indexes, and querying code with file:line. It also names the schema sources (SQL migrations, Prisma, Drizzle, SQLAlchemy, Diesel, Django) and the live-database option, which is far more concrete than the bare name 'db' or title 'Database map'.

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 clearly states the default mode (read schema sources in the repo) and the condition that switches modes (pass `url_env` to inspect a live Postgres/MySQL/SQLite database), plus the condition for narrowing scope (pass `table` for one table's full detail). What is missing is any explicit routing against the sibling tools (map, context, impact, search, trace), so an agent must still infer when this tool beats those.

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