Skip to main content
Glama
migratorAlio

sqlglot-mcp

by migratorAlio

analyze_lineage

Analyze SQL to extract table and column lineage, including source columns and full trace paths. Supports multiple SQL dialects for detailed dependency mapping.

Instructions

分析 SQL 血缘。返回 JSON 字符串,包含表级依赖(table_lineage)与列级血缘(columns,含 source_columns 和 paths 溯源链路)。

Args: sql: 待分析的 SQL 语句(支持 SELECT / INSERT INTO ... SELECT / CREATE TABLE AS / MERGE 等)。 dialect: SQL 方言,默认 presto;可传 trino/spark/hive/mysql/postgres/clickhouse 等,详见 list_dialects。 with_full_trace: 是否在结果中包含每个输出列到来源列的完整溯源路径(full paths)。 schema: 可选的表结构 JSON,用于解析未限定/有歧义的列,如 {"dim.user": ["id", "name"], "dim.org": ["id"]}。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlYes
schemaNo
dialectNopresto
with_full_traceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.3/5.0
Behavior4/5

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

无注解提供,描述承担了行为披露的全部责任。它说明了返回 JSON 结构(table_lineage、columns、source_columns、paths),以及 with_full_trace 参数的作用,还描述了 schema 参数的用途。虽然没有提及错误行为、权限或副作用,但对于一个分析型工具,这些核心行为已充分披露。

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

描述长度适中,首句点明用途和输出,然后以 Args 部分逐一说明参数,结构清晰。每句话都有价值,没有冗余。虽然稍长,但均为必要信息。

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?

对于 SQL 血缘分析这种复杂工具,描述涵盖了输出结构、参数语义、方言选项、schema 用途,并引用了 list_dialects。且存在输出 schema(has_output_schema=true),描述无需赘述返回格式细节。整体完整,代理无需额外信息即可正确调用。

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

Parameters5/5

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

schema 描述覆盖率为 0%,描述必须补偿。它解释了每个参数:sql 支持的类型、dialect 的默认值和可选项、with_full_trace 的含义、schema 的格式和用途。这些信息远超 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?

描述明确说明'分析 SQL 血缘'并详细说明返回内容(表级依赖和列级血缘),动词+资源明确,与兄弟工具(validate_sql、list_dialects)区分明显。虽然不是直接说'本工具用于血缘分析',但语义上清晰无误。

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

Usage Guidelines3/5

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

描述提到了支持的 SQL 类型和方言选项,并指引'详见 list_dialects'来获取方言详情,这提供了一些使用上下文。但没有明确说明何时使用本工具 vs validate_sql,也没有排除性说明,例如'如果需要验证 SQL 请使用 validate_sql'。因此指南部分仅属中等。

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