JDBC MCP Server
v0.2.0Read-only SQL, plans, schema for AI agents: PostgreSQL, Oracle, SQL Server, Firebird, SQLite, JDBC
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
rebuildCatalog rebuildCatalog
Create or refresh the persistent local catalog for offline/repeated metadata and usage lookups. Captures configured schema metadata, rebuilds the usage index and returns the distributable catalog file; writes only server-local data, never the inspected database.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
schemas | string | Schemas to capture (CSV); omit for configured/default scope. |
benchmarkQuery benchmarkQuery
Measure repeatable query latency with separate cold runs and min/median/max warm-run timings. Use for comparing query rewrites, not retrieving data; timedQuery is the one-run alternative that returns rows. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name. Returns the size of the last result (rows, columns, truncated), not the rows.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
limit * | integer | Row limit per run (> 0). |
sql * | string | |
timeoutSeconds * | integer | Timeout per run in seconds (> 0). |
coldRuns | integer | Cold runs (default 1); executed first. |
namedParams | object | Values for ':name' placeholders, keyed by name. |
params | array | Values for '?' placeholders, in order. |
warmRuns | integer | Warm runs (default 3). |
timedQuery timedQuery
Measure one read-only SQL SELECT / WITH / EXPLAIN while still returning its rows and elapsed time. Use executeQuery when timing is irrelevant or benchmarkQuery for repeated cold/warm measurements. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name. Adds available per-statement counter deltas (calls, execution time, rows, buffer hits/reads).
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sql * | string | |
limit | integer | Row limit (default: the connection's maxRows). |
namedParams | object | Values for ':name' placeholders, keyed by name. |
params | array | Values for '?' placeholders, in order. |
timeoutSeconds | integer | Timeout in seconds (default: the connection's queryTimeoutSeconds). |
listConnections listConnections
Discover the databases served here and the valid name to pass as 'connection'. Call when the target connection is not already established; returns purpose, engine, default schema and local-catalog availability without opening a database connection.
columnDistribution columnDistribution
Measure value frequency and skew for one known column by returning top-N values, counts and row shares. Use columnStats for only cardinality/extremes; runs GROUP BY + COUNT and may be expensive on large tables.
| Parameter | Type | Description |
|---|---|---|
column * | string | |
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
schema | string | |
topN | integer | Top values to return (default 20, max 1000). |
columnHistogram columnHistogram
Measure percentile distribution for one orderable numeric, date, timestamp or text column: min/max, P25/P50/P75/P90/P95/P99 and null counts. Use columnDistribution for top frequent values instead.
| Parameter | Type | Description |
|---|---|---|
column * | string | |
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
schema | string |
columnStats columnStats
Measure basic extremes and cardinality for one known column: total/non-null rows, distinct count and min/max. Use columnDistribution for frequent values or columnHistogram for percentiles.
| Parameter | Type | Description |
|---|---|---|
column * | string | |
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
schema | string |
estimateSelectivity estimateSelectivity
Estimate how selective one proposed table predicate is without executing the query. Returns planner-estimated rows, the unfiltered baseline and their ratio; use when evaluating filters or composite-index column order.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
predicate * | string | Raw boolean SQL without WHERE or ';'. |
table * | string | |
schema | string |
joinCardinality joinCardinality
Estimate the output size and selectivity of a proposed equi-join between two known tables without executing it. Returns planner estimates for both sides and versus the Cartesian product; use findJoinPaths when the join route itself is unknown.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
fromTable * | string | |
leftColumn * | string | Column in fromTable. |
rightColumn * | string | Column in toTable. |
toTable * | string | |
fromSchema | string | |
joinType | string | Join type: INNER (default), LEFT, RIGHT, FULL |
toSchema | string |
nullRatio nullRatio
Find sparse or mostly-null fields across every column of one table in a single scan. Returns null/non-null counts and ratios sorted by sparsity; use describeTable when only declared nullability is needed.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
schema | string |
describeTable describeTable
Inspect one known table or view. Use for its fields/columns, types, nullability, defaults, comments, keys, indexes, constraints or triggers. Returns full metadata for that object only; use tableContext when nearby relationships or joins are also needed.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
schema | string |
getRoutineDefinition getRoutineDefinition
Return the source code of one known function, procedure or package, including its body where available. Use listRoutines to discover routine names.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
name * | string | |
schema | string |
getTriggerDefinition getTriggerDefinition
Return the full definition/body of one known table trigger. For trigger names and compact metadata, use describeTable first.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
trigger * | string | |
schema | string |
getViewDefinition getViewDefinition
Return the SQL text that defines one known view or materialized view. For its exposed fields, keys and other object metadata, use describeTable.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
name * | string | |
schema | string |
listRoutines listRoutines
Discover function, procedure and package names in a schema, optionally by name pattern. Use getRoutineDefinition when the source of one known routine is needed.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
namePattern | string | JDBC name pattern, e.g. '%calculate%'. |
schema | string |
listSchemas listSchemas
Discover schema names visible to the current user when the target schema is unknown. Use listTables next to enumerate objects in one schema.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
includeSystem | boolean | Include system schemas. Default false. |
listSequences listSequences
Discover sequence names and metadata in one schema, or across all schemas when schema is omitted.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
schema | string |
listTables listTables
Enumerate table and view names in a known schema, optionally filtered by name or type. Does not return fields/columns; use describeTable for one object's structure.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
namePattern | string | JDBC pattern ('%' any, '_' one character). |
schema | string | Omit to use the connection's defaultSchema or the current schema. |
types | string | JDBC table types CSV (default TABLE,VIEW,MATERIALIZED VIEW): TABLE,VIEW,MATERIALIZED VIEW,SYSTEM TABLE,GLOBAL TEMPORARY,LOCAL TEMPORARY,ALIAS,SYNONYM |
searchObjects searchObjects
Find database objects when only a full or partial name is known. Searches non-system tables, views, routines, packages, sequences and synonyms case-insensitively; use describeTable after finding a table or view whose structure is needed.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
namePattern * | string | Name pattern — plain substring (auto-wrapped in %..%) or explicit pattern with % / _ |
analyzePlan analyzePlan
Diagnose query-plan performance with compact structured findings: expensive nodes, large-table full scans, estimation errors, risky nested loops and disk-sort spills. Use explainQuery when the full textual plan is required. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sql * | string | |
analyze | boolean | Execute the query to collect runtime stats where supported (default false). |
namedParams | object | Values for ':name' placeholders, keyed by name. |
params | array | Values for '?' placeholders, in order. |
explainQuery explainQuery
Return the full engine-specific textual execution plan for a SELECT / WITH statement. Use when raw plan detail is needed; prefer analyzePlan for compact performance findings. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sql * | string | |
analyze | boolean | Execute the query to collect runtime stats where supported (default false). |
namedParams | object | Values for ':name' placeholders, keyed by name. |
params | array | Values for '?' placeholders, in order. |
inspectQuery inspectQuery
Inspect SQL syntax and structure without accessing a database. Returns a parser-derived AST summary of tables, aliases, expressions, joins, predicates, ordering, columns and parameters; use validateQuery for driver validation or queryLint for metadata-aware advice.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sql * | string |
queryLint queryLint
Review authored SQL for advisory metadata and indexing problems without executing it. Reports unknown objects, SELECT *, conditionless joins, unindexed FKs and non-leading predicate/order columns; use validateQuery when database-driver acceptance is the question.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sql * | string | |
schema | string |
resolveQueryLineage resolveQueryLineage
Trace a query's data lineage from direct FROM/JOIN objects through views and optionally routines to underlying physical tables. Use inspectQuery for direct AST references only; routine expansion is best-effort and may miss dynamic SQL.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sql * | string | |
expandRoutines | boolean | Expand database functions/procedures referenced by the query, best-effort. Default true. |
expandViews | boolean | Expand database views and materialized views recursively. Default true. |
maxDepth | integer | Maximum recursive expansion depth. Default 5, max 20. |
schema | string | Default schema for unqualified names |
validateQuery validateQuery
Check whether the database driver accepts a SELECT / WITH / EXPLAIN without executing it: prepares the statement and validates parameters, syntax and referenced objects. Use inspectQuery for parser-only AST inspection or queryLint for advisory metadata/index warnings. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sql * | string | |
namedParams | object | Named parameters for ':name' placeholders. Required when SQL contains ':name'. |
params | array | Positional parameters for '?' placeholders, in order. Required when SQL contains '?'. |
executeQuery executeQuery
Run a read-only SQL SELECT / WITH / EXPLAIN when actual result rows are needed. Use timedQuery for one timed execution or benchmarkQuery for repeated latency measurements. Bind '?'->params, ':name'->namedParams; never mix. E.g. :status -> namedParams={status:'PAID'} — key is the bare name. Sets 'truncated' when the row cap is hit.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sql * | string | |
limit | integer | Row limit (default: the connection's maxRows). |
namedParams | object | Values for ':name' placeholders, keyed by name. |
params | array | Values for '?' placeholders, in order. |
timeoutSeconds | integer | Timeout in seconds (default: the connection's queryTimeoutSeconds). |
sampleRows sampleRows
Preview a small number of actual rows from one known table or view to understand data shape and example values. For fields, types and constraints without reading row data, use describeTable.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
limit | integer | Rows to return (default 10, max 100). |
schema | string |
findJoinPaths findJoinPaths
Find join paths when both endpoint tables are known but the intermediate relationships are not. Traverses declared FK and optional observed join edges in both directions; for one table's immediate neighborhood, use tableContext.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
fromTable * | string | |
toTable * | string | |
fromSchema | string | |
includeObserved | boolean | Include usage-catalog equi-joins (default: catalog enabled). |
maxDepth | integer | Maximum FK hops. Default 4. |
maxPaths | integer | Maximum paths to return. Default 5, max 25. |
scanLimit | integer | Maximum tables to scan (default 300). |
toSchema | string |
queryContext queryContext
Build multi-table SQL-authoring context from natural-language terms or an explicit table list. Use when relevant tables are unknown or a request spans several tables; for one known table's fields or structure, use describeTable.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
includeSamples | boolean | Include up to 3 rows per table (default false). |
maxTables | integer | Tables to include (default 12). |
schema | string | |
tables | string | Force-include tables (CSV), e.g. customers,orders. |
terms | string | User terms, e.g. 'customers order totals'. |
schemaBrief schemaBrief
Discover candidate tables and views across a schema when their names are unknown. Returns a broad plain-text map with column counts, PKs and relationship summaries; follow with queryContext for multi-table authoring detail or describeTable for one known object.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
maxTables | integer | Tables/views to include (default 2000). |
schema | string | |
terms | string | Terms to narrow discovery; falls back to full schema on no match. |
schemaGraph schemaGraph
Analyze schema-wide relationship topology: graph nodes/edges, central or isolated tables, components, cycle hints and an optional shortest path. Use findJoinPaths when only paths between two known tables are needed.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
fromTable | string | Optional shortest-path start. |
maxDepth | integer | Shortest-path hops (default 4). |
maxTables | integer | Tables to scan (default 50). |
schema | string | |
toTable | string | Optional shortest-path target. |
schemaGraphDot schemaGraphDot
Export a schema or selected tables as DOT/Graphviz ERD text with columns, types, PK/FK markers and join edges. Use schemaGraph for graph metrics rather than renderable diagram source.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
schema | string | |
tables | string | Tables to include (CSV); omit for all. |
schemaLint schemaLint
Audit one table or a schema for modeling and indexing risks: missing PKs, unindexed or mismatched FKs, nullable unique columns, missing CHECKs/remarks, orphan *_id columns, isolation and wide tables. Returns findings, not general table metadata.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
checks | string | Checks CSV, e.g. missingPrimaryKey,fkWithoutIndex; omit for defaults. |
maxFindings | integer | Findings to return (default 200). |
maxTables | integer | Tables to scan (default 50). |
schema | string | |
table | string | Omit to scan the schema. |
tableContext tableContext
Explore the relationship neighborhood of one known table: compact root/nearby table metadata plus declared FK and optional observed join edges. Use when nearby joins are needed; for only the table's own fields or structure, use describeTable.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
depth | integer | FK depth (default 1). |
includeIncoming | boolean | Include child references (default true). |
includeObserved | boolean | Include declared/observed/semantic usage evidence (default: catalog enabled). |
includeStats | boolean | Include row/size/activity stats (default false). |
schema | string |
fkIndexCoverage fkIndexCoverage
Audit child-side foreign keys for missing supporting indexes. Returns only FKs not covered by an index starting with the FK columns in order, plus suggested index columns; use describeTable to inspect all keys and indexes of one table.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
schema | string | |
table | string | Omit to scan the schema. |
indexStats indexStats
Inspect index definitions together with operational size, usage and cardinality counters for one table or a schema. Use describeTable for structural metadata of one table without live index statistics.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
schema | string | |
table | string | Omit to scan the schema. |
redundantIndexes redundantIndexes
Find structurally overlapping non-unique indexes whose leading columns are a strict prefix of another same-type index. Unlike unusedIndexes, this does not depend on workload scan counters.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
schema | string | |
table | string | Omit to scan the schema. |
tableStats tableStats
Inspect operational size and activity statistics for one known table: estimated/live rows, storage, dead tuples, maintenance times and scan counters. For fields, keys and constraints, use describeTable; available statistics depend on engine and privileges.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
schema | string |
unusedIndexes unusedIndexes
Find non-PK/non-unique indexes with zero recorded scans as removal candidates. Unlike redundantIndexes, this uses workload counters, which are meaningful only after representative traffic and are not supported by every engine.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
minSizeBytes | integer | Minimum size in bytes; omit tiny indexes. |
schema | string |
findQueriesByColumn findQueriesByColumn
Find stored application/report queries that actually reference one column and show whether it appears in SELECT, WHERE, JOIN, ORDER BY or HAVING. Use describeTable to discover declared columns; schema/table filters are optional and case-insensitive.
| Parameter | Type | Description |
|---|---|---|
column * | string | |
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
schema | string | |
table | string |
findQueriesByTable findQueriesByTable
Find stored application/report queries that actually reference one known table. Use to learn observed filters, joins and business usage, not to inspect declared table structure; resolved names are matched case-insensitively.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
table * | string | |
schema | string |
getQuery getQuery
Retrieve the complete stored record for one query whose source identity is already known. Returns SQL, parameters, parsed tables/columns/joins, outputs and field usages; use listQueries, findQueriesByTable or findQueriesByColumn to discover matching records first.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
sourceKind * | string | Source kind, e.g. dao, report, database-view. |
sourcePath * | string | Stable source path, e.g. file path. |
sourceUnit | string | Optional sub-unit, e.g. method name. |
invalidateUsageCatalogCache invalidateUsageCatalogCache
Force the server-local usage index to be rebuilt after its configured sources change. Invalidates only the runtime/local index; the next usage lookup rebuilds it synchronously and no inspected database data is modified.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
listKnownDomains listKnownDomains
Discover the existing business-domain vocabulary and query counts for reuse in listQueries filters.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
listKnownKinds listKnownKinds
Discover valid usage-catalog source-kind values and their query counts for reuse in listQueries filters.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
listKnownTags listKnownTags
Discover the existing business-tag vocabulary and query counts for reuse in listQueries filters.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
listQueries listQueries
Browse or search stored usage-catalog queries by source, business metadata, parse status or free text. Returns summaries newest-ingest first; use getQuery for the complete SQL and evidence of one selected record.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
businessDomain | string | Exact business domain. |
limit | integer | Rows to return (default 100, max 1000). |
offset | integer | Paging offset (default 0). |
parseStatus | string | Parse status: parsed or failed. |
searchText | string | Case-insensitive full-text search over SQL, labels, domains and source paths. |
sourceKind | string | Source kind, e.g. bi-publisher-report or dao. |
sourcePath | string | Source path LIKE pattern ('%'/'_'). |
tag | string | Exact tag. |
observedRelationships observedRelationships
Discover empirically observed equi-join column pairs from stored queries, with support counts and contributing query IDs. Use findJoinPaths for declared/combined paths between endpoints; non-equi joins are excluded.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |
minSupport | integer | Minimum supporting queries (default 1). |
schema | string | Case-insensitive filter. |
table | string | Require either join side to use this table. |
usageCatalogStatus usageCatalogStatus
Check whether the usage catalog is enabled and ready before relying on observed-query or semantic evidence. Returns configured sources, indexing state, counts and load errors without searching for queries.
| Parameter | Type | Description |
|---|---|---|
connection * | string | Database to run against. Call listConnections for valid names; do not guess. |