Skip to main content
Glama

infer_foreign_keys

Read-only

Detect candidate foreign key relationships between spreadsheet tables by checking value containment and low dangling rates, outputting ranked confidence edges for user confirmation.

Instructions

表间外键推断(值域包含检测,确定性):from 列非空值域 ⊆ to 列值域、悬挂率 <5% 才成立,from 非空值 ≥3 防巧合;confidence = (1-悬挂率)×值域大小因子。输出候选关系边(kind=foreign_key,不落盘,供用户确认后经 save_structure 固化)。可指定 fromTable/toTable 定向检测;缺省全表两两扫描(输出按置信度排序的 topN 防爆炸)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topNNo全表扫描模式下输出候选数上限(默认 20,最大 50)
toTableNo被引用方表名(与 fromTable 成对指定)
fromTableNo引用方表名(与 toTable 成对指定)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already mark readOnlyHint=true, and the description adds substantial behavior: deterministic algorithm, exact acceptance conditions, confidence formula, no persistence, and output as unpersisted candidate edges for user confirmation. This goes well beyond the annotation baseline.

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 dense but every sentence carries meaningful information: algorithm, thresholds, confidence formula, output behavior, and usage modes. No filler or redundancy; appropriately compact for a nontrivial tool.

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?

For a read-only inference tool with no output schema, the description covers the algorithm, validity criteria, confidence calculation, output form, persistence behavior, and both invocation modes. An agent has enough context to call it correctly and interpret results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all three parameters. The description adds extra semantic value by explaining topN's purpose as preventing output explosion and clarifying fromTable/toTable as a paired directional-detection mode.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: inferring foreign keys between tables using value-domain containment detection, and specifies the output as candidate relation edges with kind=foreign_key. It is specific and informative, but it does not explicitly differentiate itself from overlapping siblings like infer_table_relation or suggest_refs.

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?

The description provides clear usage context: targeted detection via fromTable/toTable or default full-table pairwise scanning, with topN limiting output. It does not explicitly state when not to use this tool or name alternative tools for other scenarios, so it falls just short of a 5.

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