Skip to main content
Glama
igorolv

jdbc-mcp-server

resolveQueryLineage

resolveQueryLineage
Read-onlyIdempotent

Trace a SQL query's data lineage from direct tables through views and routines to underlying physical tables, enabling impact analysis and data flow understanding.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
schemaNoDefault schema for unqualified names
maxDepthNoMaximum recursive expansion depth. Default 5, max 20.
connectionYesDatabase to run against. Call listConnections for valid names; do not guess.
expandViewsNoExpand database views and materialized views recursively. Default true.
expandRoutinesNoExpand database functions/procedures referenced by the query, best-effort. Default true.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
cyclesNoPossible relationship or lineage cycles found during traversal.
maxDepthYesMaximum relationship traversal depth that was applied.
warningsNoNon-fatal warnings produced while resolving or expanding lineage.
inspectionNoParsed query inspection that underpins lineage (opaque; the inspectQuery tool returns the typed form).
directObjectsNoObjects directly referenced by the query before recursive expansion.
expandedObjectsNoAll resolved objects visited during lineage expansion.
unresolvedObjectsNoObjects that could not be resolved against metadata during lineage analysis.
expandedPhysicalTablesNoPhysical tables reached by recursively expanding views and routines.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already mark the tool as read-only, idempotent, and non-destructive. The description adds valuable behavioral context beyond annotations: it traverses views and routines, can optionally expand routines, and is best-effort with potential misses on dynamic SQL. This gives an agent a realistic expectation of completeness.

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?

The description is two sentences, front-loads the core behavior, and includes the key differentiator and caveat without waste. Every clause earns its place.

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?

Given the tool's complexity, the input schema covers defaults and constraints, annotations cover safety, and an output schema exists for return values. The description adds the essential behavioral scope and limitations, making the tool adequately specified for an agent to invoke 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 83%, so the input schema already documents most parameters with meanings and defaults. The description adds context about 'views' and 'optionally routines' that maps loosely to expandViews and expandRoutines, but it doesn't substantially enhance parameter understanding beyond the schema.

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 states a specific action and resource: tracing a query's data lineage from direct FROM/JOIN objects through views and routines to physical tables. It explicitly differentiates from inspectQuery, which handles direct AST references only, making the tool's niche clear.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit guidance on when to use this tool versus inspectQuery: use inspectQuery for direct AST references only, and this tool for deeper lineage. It also discloses the limitation that routine expansion is best-effort and may miss dynamic SQL, helping an agent decide based on the query's nature.

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