Skip to main content
Glama
igorolv

jdbc-mcp-server

joinCardinality

joinCardinality
Read-onlyIdempotent

Estimate the output size and selectivity of an equi-join between two tables without executing it. Returns planner estimates for both sides and versus the Cartesian product to assess join cost.

Instructions

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toTableYes
joinTypeNoJoin type: INNER (default), LEFT, RIGHT, FULL
toSchemaNo
fromTableYes
connectionYesDatabase to run against. Call listConnections for valid names; do not guess.
fromSchemaNo
leftColumnYesColumn in fromTable.
rightColumnYesColumn in toTable.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
noteNoAdditional context about support, limits, interpretation, or engine-specific behavior.
toTableNoRight or joined target table for the join estimate.
joinTypeNoJoin type used for the estimate or parsed join, such as INNER, LEFT, RIGHT, or FULL.
toSchemaNo
fromTableNoLeft or preserved source table for the join estimate.
fromSchemaNo
leftColumnNoColumn from the source table used on the left side of the join estimate.
rightColumnNoColumn from the target table used on the right side of the join estimate.
cartesianRowsNoProduct of the two side row estimates before applying join selectivity.
estimatedRowsNoPlanner or catalog estimate of rows for this object or operation.
toRowEstimateNoPlanner row estimate for the target table before joining.
fromRowEstimateNoPlanner row estimate for the source table before joining.
selectivityVsCartesianNoEstimated join output divided by cartesian row count, from 0.0 to 1.0 when known.

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, destructiveHint, and idempotentHint. The description adds behavioral value by stating it returns planner estimates (not actual results) and compares against the Cartesian product, which goes beyond the annotation. No contradiction with annotations.

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?

Two sentences, no filler, purpose front-loaded, and the alternative is stated succinctly. Every word contributes.

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?

For a cardinality estimation tool, it covers the core behavior (what it estimates, that it doesn't execute, what it returns) and the key alternative. It does not mention error conditions or catalog prerequisites, but given the output schema is provided separately, it is sufficiently complete for an agent to use correctly in most cases.

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 50%; the schema describes joinType, connection, leftColumn, and rightColumn, but not the table/schema parameters. The description mentions 'known tables' and 'equi-join' but does not clarify the meaning or relationship of parameters beyond what the schema already offers. It adds minimal value for parameter understanding.

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 verb ('estimate'), a specific resource ('output size and selectivity of a proposed equi-join between two known tables'), and explicitly notes it does not execute. It distinguishes itself from findJoinPaths by naming the alternative, making the purpose unambiguous.

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 provides an explicit when-not condition ('use findJoinPaths when the join route itself is unknown'), giving clear usage context. However, it doesn't address other potential siblings like estimateSelectivity or analyzePlan, leaving some routing ambiguity for an agent.

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