Skip to main content
Glama
data-transformer

data-transformer

by tetracoralla

BatchTicket

BatchTicket(CLI: adt)は、Agentワークフローのための決定的な構造化データ変換器です。生産バッチや出荷バッチに付随する小さなチケットのように、各実行はバージョン管理されたプランと、実行によって何が変更されたかの明示的な記録を保持します。その記録は、マッピングが意味的に正しかったことを主張するものではありません。

これは、また別のjqやSQL方言ではありません。DuckDB、JSON Schema、PyYAML、および標準パーサーが確立された実行処理を担っています。このプロジェクトは、それらの周辺のAgent契約を担います。

バージョン0.2.0は未リリースのソースリリース候補です。このプロジェクトはApache License 2.0の下でライセンスされています。安定した技術識別子は、agent-data-transformer、data-transformer、adt、および4つのdata_* MCPツールのままです。

実装されている機能

  • JSON、JSONL、CSV、TSV、YAML、Parquetを完全なペイロードを返さずに検査します。

  • JSON/YAMLエンベロープ内の境界付きネストレコードセットを発見し、その論理フィールドをプロファイリングします。

  • ソースレコードの形状をターゲットJSON Schemaと比較し、構造的なマッピング候補のみを提示し、明示的な互換マッピングの後にのみ実行可能なドラフトプランを出力します。

  • 生のコード、SQL、シェル、jq、正規表現、テンプレート実行のない安全なTransformation Plan v1。

  • フィルタ、プロジェクト、ドロップ、リネーム、ソート、リミット、重複排除、キャスト、導出、エクスプロード、ジョイン、グループ、ピボット、アンピボット、フラット化、アンフラット化、ツリー変異。

  • JSON Schemaに加えて、非null、一意、行数、フィールド、型のアサーション。

  • スキーマ対応のキー付きまたはキーなし差分。

  • 実際の宛先プリフライト、ステージングされたアトミック公開、上書き保護を備えたドライラン。

  • 累積的なソース/バイト/行/アイテム/深さ/時間/RSS/temp制限を備えた呼び出し全体のワーカー分離。

  • サンプル、形状、実行効果、差分、検証失敗、エラーを含む、完全なシリアライズ済みレスポンスに対するバイト上限。

  • 1つの厳密な型付きPlan v1モデルが、ランタイム検証、公開されたJSON Schema、ライブMCPスキーマを生成します。

  • CLIと4つのタスクレベルMCPツールを備えた1つの共有コア。

Related MCP server: MCP Data Integration Server

インストールと実行

開発チェックアウト:

git clone https://github.com/tetracoralla/BatchTicket.git
cd BatchTicket
uv sync --frozen --extra dev
uv run adt inspect examples/users.json --select 'data.users[*]'
uv run adt inspect examples/users.json --select 'data.users[*]' \
  --target-schema target.schema.json --mappings mappings.json
uv run adt transform examples/adults.plan.yaml
uv run adt transform examples/adults.plan.yaml --dry-run
uv run adt validate examples/users.json --select 'data.users[*]' \
  --assertions examples/users.assertions.json
ADT_WORKSPACE_ROOT=/absolute/granted/workspace uv run adt mcp

リポジトリ、uv、Pythonインストール、または実行時のネットワーク接続を必要としないプラットフォーム固有のプラグインをビルドします:

uv run python scripts/build_plugin.py
uv run python scripts/probe_plugin.py \
  dist/plugin/data-transformer-0.2.0-darwin-arm64
codex plugin marketplace add dist/plugin
codex plugin add data-transformer@data-transformer-local

ビルドは、dist/plugin/にプラグインディレクトリ、.tar.gzアーカイブ、SHA-256チェックサムを生成します。生成された完全なディレクトリをインストールまたはコピーします。リポジトリルートの.mcp.jsonは開発用設定であり、生成されたプラグインの.mcp.jsonはバンドルされた実行可能ファイルを直接呼び出します。生成されたローカルマーケットプレイスは、Codexをその自己完結型ディレクトリに向けます。--replaceでの再ビルドは、何かを削除または上書きする前に、シンボリックリンクされた出力ルートまたは生成されたターゲットを拒否します。

生成された自己完結型バンドルは現在、ローカル検証アーティファクトであり、公開リリースアセットではありません。これは、Pythonランタイム、Pythonパッケージ、およびサードパーティのライセンス資料がまだアーカイブに組み込まれていないネイティブライブラリを含みます。プラグインディレクトリ、アーカイブ、またはチェックサムをGitHub Releaseにアップロードしないでください。これはApache-2.0ソースリポジトリの公開または使用を制限するものではありません。リリースチェックリストを参照してください。

サンプル変換は2つのレコードをインラインで返し、execution_effectsを通じて1つの入力行が削除されたことを報告します。ファイル出力はoutput.pathを通じてオプトインです。既存ファイルは、output.overwriteが明示的にtrueでない限り置き換えられることはありません。

CLIパスは明示的なユーザーパスであり、絶対パスにすることができます。MCPファイルパスはより狭い機能です。サーバーはまずMCP rootsプロトコルを通じて付与されたワークスペースを使用します。単一のルートが自動的に選択されます。複数のルートが付与されている場合は、ツールのオプションのworkspaceフィールドに正確なルートnameを渡します。rootsサポートのないホストは、互換性付与として明示的なADT_WORKSPACE_ROOTを渡すことができます。ツールパスは選択されたルートに対して相対的なままです。絶対パス、親ディレクトリ、URI、シンボリックリンクによるエスケープは拒否されます。インラインのみのMCP呼び出しはワークスペース付与を必要としません。

Codex CLI 0.148は現在、MCP rootsをローカルプラグインサーバーに渡しません。コールドCLIホストテストの場合は、ADT_WORKSPACE_ROOTを正確なテストワークスペースに設定してCodexを起動します。読み取り専用ツールはapproval=neverで実行できます。data_transformは条件付きファイル出力機能を持つため、特定の呼び出しがデータをインラインで返す場合でも、承認対応ホストポリシーが必要です。ブロックされた呼び出しは認可の結果であり、シェルやモデル側のデータ書き換えにフォールバックする許可ではありません。

決定的スキーマ適応

data_inspectはオプションのtarget_schemaとmappingsオブジェクトを受け入れます。構造的証拠によって一意のネストレコードセットを選択し、完全一致または正規化された名前の一致を提案し、互換性のない、欠落した、重複した、省略された、またはドロップされたフィールドを報告できます。ファジー同義語、キャスト、デフォルトは使用しません。v1アダプターはトップレベルのレコードフィールドをマッピングし、オブジェクトスキーマまたはitemsが1つのオブジェクトスキーマである配列をサポートします。合成/参照スキーマと曖昧なレコードセットは、明示的に未解決のままです。

すべての必須フィールドに明示的な互換マッピングがある場合、adaptation.statusはreadyになり、adaptation.draft_planは通常のTransformation Plan v1になります。そのプランをdata_transformで実行します。アダプターは別の実行パスや5番目の公開ツールを作成しません。

ライブラリAPI

from data_transformer import DataTransformer

result = DataTransformer().transform(
    {
        "version": "1",
        "sources": {"rows": {"inline": [{"x": 2}, {"x": 4}]}},
        "steps": [
            {
                "op": "derive",
                "field": "doubled",
                "expr": {"multiply": [{"field": "x"}, {"value": 2}]},
            }
        ],
    }
)

公開呼び出しは、安定したerror.codeとともにstatus: ok、status: dry_run、またはstatus: errorを返します。成功した変換は、execution_effectsの下でランタイムで観測された変更を公開します。スタックトレースやDuckDB内部を漏洩することはありません。

プロダクトモデル、Transformation Plan v1、レビュー契約を参照してください。貢献はCONTRIBUTING.md、セキュリティ報告はSECURITY.md、注目すべき変更はCHANGELOG.mdに記載されています。

Available Tools

4 tools
data_diffA
Read-onlyIdempotent

Compare two structured datasets by schema and rows, optionally using stable key fields. Returns compact added, removed, and changed counts and samples.

NameRequiredDescriptionDefault
leftYes
rightYes
limitsNo
workspaceNo
key_fieldsNo
sample_rowsNo

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, covering the safety profile. The description adds context about the output being 'compact' and that it 'returns added, removed, and changed counts and samples', which goes beyond annotations. There is no contradiction, and the description adds value by clarifying the behavioral output characteristics.

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 a single, compact sentence that front-loads the purpose and includes the key optional parameter (key fields) and the output nature. Every phrase earns its place, with no redundancy or fluff. This is ideal conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 6 parameters including complex source objects (PathSource/InlineSource) and a limits model, but the description does not mention that sources can be paths or inline, nor the limits concept. However, the schema provides rich detail on these, and the output is described. Given no output schema, the description covers the return format adequately. The main gap is not explaining how sources are specified, but the schema covers that, so a moderate score is fair.

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?

The schema has 0% description coverage, but the description explicitly mentions 'stable key fields' matching the key_fields parameter and 'compact counts and samples' relating to sample_rows. However, it does not explain the left/right source objects, limits, or workspace parameters. The description adds some meaning but not enough to fully compensate for low coverage; baseline 3 is appropriate.

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 clearly states 'Compare two structured datasets by schema and rows' with 'optional stable key fields', and specifies the output as 'compact added, removed, and changed counts and samples'. This is a specific verb+resource combination that distinguishes it from siblings like data_transform (transforms), data_inspect (inspects), and data_validate (validates).

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 implies usage when two datasets need comparison, but it does not explicitly mention when not to use it or name alternatives. Sibling tools are obvious from their names, but the description could have added context about when to choose this over data_inspect or data_validate. Still, the purpose is clear enough that a moderate score is warranted.

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

data_inspectA
Read-onlyIdempotent

Inspect JSON, JSONL, CSV, TSV, YAML, or Parquet shape, types, counts, and a small sample without returning the full payload. Use for 'what fields are in this data?' or unknown tool output. Optionally compare record fields with target_schema and return deterministic mapping candidates; a draft plan is returned only after explicit mappings are supplied. One successful call is sufficient for its recorded observations; never repeat the same arguments to confirm it.

NameRequiredDescriptionDefault
limitsNo
sourceYes
mappingsNo
workspaceNo
sample_rowsNo
target_schemaNo

TDQS

A4.4/5.0
Behavior5/5

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

The description goes beyond the read-only/idempotent annotations by adding key behavioral details: no full payload returned, deterministic mapping candidates, draft plans only after explicit mappings, and a note that one successful call is sufficient for observations. These are meaningful traits not present in 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?

Four sentences, front-loaded with the core purpose, and every sentence adds valuable context: formats, outputs, use cases, optional mapping behavior, and idempotence caution. No filler or redundancy.

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?

The description covers the tool's main purpose, use cases, and special behaviors well. It lacks detail on certain parameters (limits, workspace) and the two source variants, but for a read-only inspection tool with clear annotations, the provided context is sufficient for an agent to invoke it 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 0%, so the description must compensate. It meaningfully explains target_schema and mappings, and implies sample behavior via 'small sample,' but it leaves limits, workspace, and source structure (path vs inline) undocumented. This is a partial but not full compensation.

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 explicitly states the tool inspects multiple data formats (JSON, JSONL, CSV, TSV, YAML, Parquet) and returns shape, types, counts, and a small sample without returning the full payload. It also clearly distinguishes itself from sibling tools by specifying its use case: 'what fields are in this data?' or unknown tool output.

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 explicit when-to-use guidance ('Use for...') and a strong behavioral instruction ('never repeat the same arguments to confirm it'). While it doesn't explicitly name alternative sibling tools as exclusions, the use case framing makes it clear when inspection is appropriate versus transform/validate/diff.

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

data_transformA
DestructiveIdempotent

Transform or rewrite records: reshape, filter, join, aggregate, cast, flatten, or convert structured data with Transformation Plan v1. Do not use this tool for a validation-only request such as checking non-null or unique fields; use data_validate. Known transformation shape: {"version":"1","sources":{"input":{"path":"users.json","select":"data.users[*]"}},"steps":[{"id":"filtered","op":"filter","source":"input","where":{"field":"age","gte":18}},{"op":"select","source":"filtered","fields":[{"field":"userId","as":"id"}]}],"return":{"mode":"auto"}}. Omit workspace with ADT_WORKSPACE_ROOT; otherwise it is an exact granted root name, never a path. Returns a compact sample and explicit execution effects; large results require output.path.

NameRequiredDescriptionDefault
planYes
dry_runNo
workspaceNo

TDQS

A4.8/5.0
Behavior5/5

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

Annotations already declare the safety profile (readOnlyHint=false, destructiveHint=true, idempotentHint=true), so the description's job is to add value beyond them. It does: it discloses that the tool 'Returns a compact sample and explicit execution effects,' warns that 'large results require output.path,' and explains workspace variable behavior (ADT_WORKSPACE_ROOT). Crucially, the description is consistent with the annotations—the described rewrite/transform behavior aligns with destructiveHint=true, so there's no contradiction.

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?

The description is long, but justifiably so given the tool's complexity—a full transformation DSL. It front-loads the purpose, uses a crisp exclusion, and packs workspace semantics and return behavior into tight sentences. The embedded JSON example is bulky but earns its place. It loses one point for the dense JSON blob being potentially hard to scan, but every sentence adds value.

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 tool with 3 top-level params, a huge nested schema (19 step types, multiple assertion types), and no output schema, the description covers the most critical gaps: workspace pathing rules, large-result handling (output.path), the full plan shape, and the validation sibling's boundary. It's slightly shy of a 5 because the 'compact sample and explicit execution effects' return semantics are never detailed, and error/limit behaviors aren't addressed—leaving some burden on the agent despite the otherwise strong guidance.

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?

With 0% schema description coverage, the description must compensate, and it does extensively: it embeds a complete Transformation Plan v1 JSON example showing versions, sources with path/select, steps (filter with condition, select with aliases), and return mode. It also explicitly documents the workspace parameter semantics and the output.path behavior for large results. This is exactly the burden-shifting the rubric requires when the schema provides no narrative.

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 opens with a specific verb phrase — 'Transform or rewrite records: reshape, filter, join, aggregate, cast, flatten, or convert structured data with Transformation Plan v1' — clearly naming the resource (Transformation Plan v1) and listing concrete operations. It differentiates from siblings by explicitly excluding validation tasks ('Do not use this tool for a validation-only request'). This is a strong purpose statement for a tool whose name alone would be ambiguous.

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 an explicit when-not-to-use directive with a named alternative: 'Do not use this tool for a validation-only request such as checking non-null or unique fields; use data_validate.' It also provides workspace usage guidance ('Omit workspace with ADT_WORKSPACE_ROOT; otherwise it is an exact granted root name, never a path') and large-result handling. This matches the exemplar behavior in the rubric—clear exclusion plus named alternative.

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

data_validateA
Read-onlyIdempotent

Validate or check requirements on existing structured data (校验/检查非空、唯一、类型、字段或行数); choose data_validate, not data_transform, for validation-only requests. It accepts JSON Schema and deterministic assertions and returns valid true or false without rewriting the source. Known validation shape: {"source":{"path":"users.json","select":"data.users[*]"},"assertions":[{"type":"not_null","field":"userId"},{"type":"unique","field":"userId"}]}.

NameRequiredDescriptionDefault
limitsNo
schemaNo
sourceYes
workspaceNo
assertionsNo
sample_rowsNo

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare the tool read-only, idempotent, and non-destructive. The description adds useful context by stating it 'returns valid true or false without rewriting the source' and that assertions are deterministic, reinforcing that validation has no side effects. 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.

Conciseness4/5

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

The description is front-loaded with purpose and usage guidance, and the three sentences are efficient. The JSON shape example is practical and earns its place, though it slightly lengthens the description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex 6-parameter tool with no output schema, the description covers the main purpose, sibling differentiation, side-effect-free behavior, and return type. Yet optional parameters like limits, workspace, and sample_rows are not addressed, so the description is not fully complete despite the rich input schema.

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?

With 0% schema description coverage, the description must compensate. It provides a concrete validation shape for source and assertions, and enumerates assertion type names, giving real semantic value for the core parameters. However, other parameters such as limits, workspace, and sample_rows are not described, leaving clear gaps.

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 opens with a specific verb ('Validate or check requirements') and clearly identifies the resource ('existing structured data'). It enumerates supported check types (non-null, unique, type, field, row count) and explicitly distinguishes from a sibling tool ('choose data_validate, not data_transform'), which is strong differentiation.

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?

It provides an explicit usage rule: 'choose data_validate, not data_transform, for validation-only requests.' This named alternative and clear when/when-not guidance meets the highest bar, even though it does not mention data_inspect or data_diff.

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.2.0
    • First observeddata_diff
    • First observeddata_inspect
    • First observeddata_transform
    • First observeddata_validate

TDQS

A4.4/5.0

Scored across 4 tools

Disambiguation5/5

Each tool occupies a cleanly separated role: observe (inspect), modify (transform), check (validate), and compare (diff). The overlap risk between transform and validate is explicitly addressed with cross-references steering agents to the right tool. No ambiguity remains after reading the descriptions.

Naming Consistency5/5

All tools follow the exact data_<verb> pattern in snake_case with uniform imperative verbs: transform, inspect, validate, diff. The convention is fully predictable with zero deviation.

Tool Count5/5

At 4 tools, the surface is tightly scoped with no bloat, comfortably within the ideal range for a focused data utility. Every tool earns its place within the read/validate/write/compare lifecycle.

Completeness4/5

Core workflows are fully covered: reading, transforming/writing output, validating, and diffing data, with output paths already handled by the transform tool. Minor gaps like an explicit export/delete or data source listing tool prevent a perfect score, but agents can accomplish all primary tasks.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Detects schema mismatches between data producers and consumers through static analysis, supporting extraction, comparison, code generation, and automated validation with watch mode for MCP tools, APIs, and service contracts.
    11
    17 npm
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables reading, normalizing, validating, merging, and exporting data from Excel, CSV, JSON, and SQLite sources into a unified schema, with tools exposed via FastMCP.
    1
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides deterministic tools for understanding, transforming, and verifying structured data via MCP, enabling rule inference from examples and verification of transformed records.
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables orchestrating data quality checks, transformation, and deduplication pipelines via an MCP interface. Offers tools for listing pipeline stages, validating wiring, running the full check-transform-match pipeline, and explaining configurations.
    MIT