Skip to main content

schemabrain metrics

Metrics are pre-declared aggregations anchored on a confirmed entity. The MCP get_metric tool compiles and runs them — the agent never writes SQL. Every metric is a contract: the operator decides what the business measure means; the agent picks which one to call.
Seven actions: list, apply, suggest, show, audit, export, export-all.

list

List metrics in the local store. The verification path after apply.

apply

Load metric YAML file(s) or directory(ies) into the local store.

suggest

LLM-suggest metric candidates anchored on existing entities. Run after entities are confirmed — the suggester walks the entity surface to propose anchors.
One of these is required:

show

Drill into one metric by name. Namespaced shortcut for schemabrain inspect <name> that resolves only against the metrics namespace — useful when a name collides with an entity or join.

audit

Scan applied metrics for anti-pattern descriptions and optionally remove them. Counterpart to the suggest-time anti-pattern filter for stores written before that filter shipped.

export

Render one metric from the local store as apply-ready YAML on stdout (or --out PATH).

export-all

Write one apply-ready YAML per metric into --dir. Pairs with schemabrain apply <dir>.

Examples

Suggest → review → apply

Inspect one metric

Round-trip for version control

Clean up old anti-patterns


MCP tool — get_metric

The runtime that compiles and runs metric definitions.

MCP tool — list_metrics

The discovery path for agents.

schemabrain entities

Metrics anchor on entities — curate entities first.

Semantic layer

Architectural framing for entities + metrics + joins.