
Lambë
io.github.hakimjonas由 GitHub 帳號 hakimjonas 發布v0.14.0更新於 Oct 27, 2026
Shape-aware query language for structured data — JSON, YAML, TOML, HCL, CSV, Markdown.
概覽
本機 MCP 伺服器,提供 Lambë 查詢語言,用來查詢 JSON、YAML、TOML、HCL、CSV、TSV 與 Markdown,並支援形狀檢查與 schema 驗證。
- 可以做什麼
- 以管線式運算式查詢、篩選、轉換與彙總結構化資料檔案
- 回傳推斷出的形狀(JSON Schema 子集文件),協助了解陌生資料的結構
- 依 JSON Schema 驗證資料,並指出不一致的具體路徑
- 靜態追蹤查詢,顯示每個管線階段的形狀、警告以及可序列化的輸出格式
- 對查詢結果做布林斷言,並在 JSON、YAML、TOML、CSV、TSV、HCL 之間轉換輸出
- 適用情境
- 適合在助理還不熟悉資料結構時使用:檢視 API 回應、稽核 Helm 或 Terraform 檔案、驗證 CI 假設,或在不猜測結構的情況下擷取欄位值。
- 執行需求
- 以本機程序(stdio)方式執行,僅限桌面端;清單列出 Linux、macOS 與 Windows 的預先編譯二進位檔,README 另提供 Dart 套件或從原始碼建置的方式。未宣告需要帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Lambë,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Lambë
A query language for structured data that shows you what you're working with.
lam queries JSON, YAML, TOML, HCL, CSV, TSV, and Markdown. Unlike other query tools, it tells you what your query does before you run it — the shape at each pipe stage, which output formats can serialize the result, what would go wrong.
Use it when you don't already know the data: inspecting an unfamiliar API response, auditing a Helm chart, verifying a CI pipeline's assumptions, or asking an AI agent to extract something without guessing at the structure.
Queries are bounded and always terminate. No recursion, no lambdas, no def. That's the tradeoff: Lambë doesn't try to be a programming language, so its shape inference, --explain, --schema, and error remediations all work.
Lambë (pronounced "lam-beh") means "language" in Quenya (Tolkien's elvish). The package name is lambe for ASCII compatibility.
Installation
One-line installer (Linux and macOS, no sudo, verifies SHA256 checksums):
This downloads lam and lam-mcp from the latest GitHub release into ~/.local/bin/. Environment variables LAMBE_VERSION (pin a version) and LAMBE_PREFIX (change install dir) are supported; see the script for details.
Other options:
See Getting started for all installation options.
Shape-aware output
Lambë checks the result of your query against the shape the target format can serialize. When they match, output is produced. When they don't, the error names the required shape and lists query fragments that would bridge it. In an interactive terminal, Lambë offers to apply the chosen fragment and retry in place.
The same flow applies to CSV and TSV (which require a list of records at the root) and HCL (which requires a map).
Suggestions surface the intent-level as(<format>) form. The explanation names the raw fragment ({value: .}, to_entries, etc.) the bridge composes, so --explain and manual composition stay available to anyone who wants them.
Non-scalar cells in CSV/TSV
By default, nested lists or maps in CSV/TSV cells are rejected — there is no faithful delimited rendering for them. When you need a quick export and lossy is acceptable, pass --flatten-cells json (CLI) or :flatten-cells json (REPL) to encode them as JSON strings inline. Round-tripping the resulting file back into Lambë does not recover the original structure; prefer reshaping the data query-side when fidelity matters.
as(fmt) — bridging in the query language
When the shape of the target format is known up front, as(fmt) performs the bridge inside the query. The combinator is a no-op when the input already satisfies the target, applies a single curated bridge when one exists, and lists the candidates when more than one could apply.
as accepts json, yaml, toml, csv, tsv, and hcl.
--explain — see the shape at every pipe stage
--explain walks the pipe backbone of a query and reports the shape at each stage, followed by the set of output formats the final shape can be serialized as. It performs static analysis only and does not evaluate the query; pass a data file to seed with real shape information, or omit it to trace against an unknown input.
Explain flags provably-empty filters (filter(.missing) on a known shape) and runtime-rejection mismatches (filter on a non-list input) by default. Pass --explain-trivial to also flag sort_by/group_by/map/unique_by whose argument references a missing field (often a typo, sometimes intentional). For agent tooling and build pipelines, --explain-json emits the same information as a structured JSON document.
--schema — declare a shape and let Lambë check your work
When you have a JSON Schema for your data — from an API contract, OpenAPI spec, or hand-written docs — point --schema at it:
The schema fills in information data alone can't express: optional fields (from JSON Schema's required), element shapes of empty lists, types shapeOf couldn't infer from sampling. --explain shows them; the evaluator trusts them.
With data present, Lambë also validates: a schema saying age: number against data with age: "30" exits 1 at load time with a JSON-path-annotated diagnostic. No silent drift, no running a query against data that doesn't match its contract.
A sibling <datafile>.schema.json is auto-detected, so a project convention of placing schemas next to data works without explicit flags.
The reverse direction is symmetrical: lam --print-shape data.json emits the inferred shape as a JSON Schema document. Round-trip:
Accepted JSON Schema keywords: type, properties, items, required. Value-level constraints (minimum, pattern, enum, etc.), structural combinators (allOf, oneOf), $ref, and conditional schemas are rejected with a per-keyword error. Lambë is a shape system, not a validation engine — for richer validation, reach for ajv or check-jsonschema.
Query Syntax
Queries start with . (the current data) and chain operations with |:
Pipelines read left to right. Each | passes its result to the next operation:
This takes .users, keeps active ones, sorts by name, and extracts names.
Expressions
Operations
Operations follow | and transform the piped value:
See the full list in Pipeline Operations below.
CLI
Interactive REPL
When a query produces a result the current output format cannot serialize, the REPL lists the available bridges inline; pressing the number of a suggestion applies it and prints the bridged output. Tab completion works on field names (.us<TAB>) and pipeline operations (| fil<TAB>). The REPL also supports syntax highlighting, persistent history (~/.lambe_history), Ctrl+R reverse search, and multi-line input with \ continuation.
Library
Shape and bridging API
Supported Formats
Parsers from rumil_parsers, tested against official spec suites.
Markdown is input-only in this release. The Markdown AST is a presentation tree rather than a data structure, so there is no general-purpose mapping from arbitrary query results back to Markdown text. Projections of a Markdown document (lists of headings, counts, filtered sections) emit as JSON, YAML, CSV, or TSV through the usual --to flag.
Pipeline Operations
AI Integration
Lambë ships as both an Agent Skill (loaded into an agent's session as expertise) and an MCP server (callable as a runtime tool).
Agent Skill
The skill folder lives at .agents/skills/lambe/ in this repository,
following the cross-vendor agent-skills specification
that Claude Code, OpenAI Codex, GitHub Copilot, Cursor, and the
Microsoft Agent Framework all read.
To make Lambë available to an agent in another project, copy the folder into the agent-conventional location:
Agents that follow the spec auto-discover the skill at session start.
MCP Server
Install, then add .mcp.json to your project:
This gives AI assistants five tools that cover the whole feedback loop:
lambe_query— extract/filter/transform, with an optionalschemaparameter that validates data structurally before the query runs.lambe_print_shape— inspect unfamiliar data; returns a JSON Schema subset document.lambe_check— validate data against a JSON Schema. Returns{"ok": true}or{"ok": false, "error": "..."}naming the disagreement path.lambe_explain— trace a query statically (with or without data); returns a structured JSON report with shape-per-stage, warnings, and writability.lambe_assert— boolean assertion on a query result.
When lambe_query encounters a shape mismatch with the requested output format, the error response includes a structured suggestions array: each entry carries a template_text, an apply_as (the complete query formed by appending the template to the original expression), and a one-line explanation. Agents can call the tool again with an apply_as verbatim.
For AI Coding Agents
Add AGENTS.md and .mcp.json to your project root. AI assistants that open the project will discover and use Lambë for data queries.
In CI
Test Matchers
The lambe_test package provides test matchers for Dart:
Documentation
- Getting started - install and first queries
- Syntax reference - the full query language
- REPL guide - interactive mode, commands, keyboard shortcuts
- Schema guide - the JSON Schema subset, merge semantics, round-trip
- Recipes - real-world patterns for Kubernetes, Terraform, CI, CSV
- Man page - Unix man page (
man -l doc/lam.1)
What lambë is not
Lambë is a bounded tree transformer over JSON-shaped data. It
deliberately omits Turing-completeness, user-defined functions,
recursive descent (..), try/catch, regex, streaming, and
in-place mutation. Staying bounded is what makes shape inference,
--explain, and as(fmt) bridging work.
See doc/non-goals.md for the full list and the lambë idiom that replaces each omission.
Design
See DESIGN.md for architecture and design decisions.
Part of the Arda Ecosystem
Built on Rumil parser combinators with left-recursive grammar support.
- Rumil - parser combinators with left recursion
- Rumil Parsers - format parsers for JSON, YAML, TOML, XML, CSV, HCL, Proto3, Markdown
- Rumil Expressions - shared evaluation helpers
來源:README.md,提交 18c0a1a
工具
0版本歷史
1- v0.14.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分