valem
Valem - Deterministic reactive state models. Create your own calculators/forms with AI
使うべきか
品質と安全性
検出事項(4)
- HIGH
- MEDIUMevolve_spec 内
- LOWsnapshot 内
- LOWpair_browser 内
ツール定義とプロトコルへの準拠に関する自動分析に基づいています。
コンテキストコスト
これは、サーバーのツールがモデルのコンテキストに読み込まれるたびに消費されるおおよそのトークン数です。数が多いほど、ほかのタスクに使える注意が減ります。
インストール
ワンクリックインストール
これを `claude_desktop_config.json` ファイルに追加してください:
{
"mcpServers": {
"valem": {
"url": "https://valem.run/mcp"
}
}
}リモートエンドポイント
https://valem.run/mcpstreamable-httpできること
ツール一覧
ツール(27)
🟢list_models
List the ids of all currently registered Valem models (alphabetical).
入力スキーマ
{
"type": "object",
"properties": {}
}🟡create_model(spec)
Create a new model from a declarative ModelSpec. The spec carries the JSON schema plus derivations (computed fields), constraints (invariants), and optional effects. Returns the created id. Fails (isError) on an invalid spec. If the requested id is already taken, a numeric postfix (-2, -3, …) is appended so the create still succeeds — always read the returned id, it may differ from the one you sent. When paired with a browser (remote_with_browser mode), ALWAYS include a viewDefinition in the spec so the model is immediately visible/usable in the sandbox — do not omit it and wait to be asked for one afterward. See the valem://guide/view-system resource for the component catalog.
入力スキーマ
{
"type": "object",
"properties": {
"spec": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"version": {
"type": "string"
},
"schema": {
"type": "object"
},
"constants": {
"type": "object"
},
"library": {
"type": "object",
"properties": {
"define": {
"type": "string"
},
"description": {
"type": "string"
},
"signatures": {
"type": "object"
}
},
"required": [
"define"
]
},
"defaultValues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"path",
"expr"
]
}
},
"derivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"evaluation": {
"type": "string",
"enum": [
"eager",
"lazy"
]
}
},
"required": [
"path",
"expr"
]
}
},
"metaDerivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"property": {
"type": "string"
},
"expr": {
"type": "string"
}
},
"required": [
"path",
"property",
"expr"
]
}
},
"constraints": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"expr": {
"type": "string"
},
"message": {
"type": "string"
},
"policy": {
"type": "string",
"enum": [
"rollback",
"flag"
]
},
"path": {
"type": "string"
}
},
"required": [
"id",
"expr"
]
}
},
"effects": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"executor": {
"type": "string",
"enum": [
"caller",
"server",
"llm",
"timer"
]
},
"trigger": {
"type": "string"
},
"dedupeKey": {
"type": "string"
},
"statusPath": {
"type": "string"
},
"emit": {
"type": "string"
},
"payload": {
"type": "object"
},
"request": {
"type": "object"
},
"requests": {
"type": "string"
},
"prompt": {
"type": "string"
},
"responseSchema": {
"type": "object"
},
"at": {
"type": "string"
},
"afterMs": {
"type": "string"
},
"response": {
"type": "object"
},
"policy": {
"type": "object"
}
},
"required": [
"id",
"executor",
"trigger"
]
}
},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"given": {
"type": "object"
},
"expect": {
"type": "object"
}
},
"required": [
"expect"
]
}
},
"viewDefinition": {
"type": "object"
}
},
"required": [
"id",
"schema"
],
"description": "A full ModelSpec document (id, schema, derivations, constraints, effects, defaultValues, views)."
}
},
"required": [
"spec"
]
}出力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"version": {
"type": "string",
"description": "The spec version."
},
"derivationCount": {
"type": "integer",
"description": "Number of derivations."
},
"metaDerivationCount": {
"type": "integer",
"description": "Number of meta-derivations."
},
"constraintCount": {
"type": "integer",
"description": "Number of constraints."
},
"effectCount": {
"type": "integer",
"description": "Number of effects."
}
}
}🟢get_model_info(id)
Get summary info for a model: id, version, and derivation/meta/constraint/effect counts.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
}
},
"required": [
"id"
]
}出力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"version": {
"type": "string",
"description": "The spec version."
},
"derivationCount": {
"type": "integer",
"description": "Number of derivations."
},
"metaDerivationCount": {
"type": "integer",
"description": "Number of meta-derivations."
},
"constraintCount": {
"type": "integer",
"description": "Number of constraints."
},
"effectCount": {
"type": "integer",
"description": "Number of effects."
}
}
}🟢get_spec(id)
Get the full stored ModelSpec JSON for a model.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
}
},
"required": [
"id"
]
}出力スキーマ
{
"type": "object",
"properties": {}
}🟢get_library(id)
List the JSONata functions and values a model's library exports — what an expression in this model may call, with signature, arity and originating layer. Call it before writing an expression so you reuse the model's existing vocabulary instead of re-deriving it. Returns null when the model declares no library.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
}
},
"required": [
"id"
]
}出力スキーマ
{
"type": "object",
"properties": {
"description": {
"type": "string",
"description": "The library's prose description, if any."
},
"exports": {
"type": "array",
"description": "One entry per exported name: {name, kind ('function'|'constant'), signature, arity, origin}."
}
}
}🟢get_state(id, at, paths, depth)
Get a model's merged state (base fields plus all computed derived fields). On a large model this is the biggest context cost — narrow it: pass 'paths' to project only specific subtrees (canonical addresses, each spliced back into a pruned document at its address), and/or 'depth' to cap nesting (deeper containers collapse to a '<object: N fields>' / '<array: N items>' marker). Pass an optional ISO-8601 'at' timestamp for a point-in-time read from mutation history.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"at": {
"type": "string",
"description": "Optional ISO-8601 instant (e.g. 2026-07-03T12:00:00Z) for a point-in-time read; omit for current state."
},
"paths": {
"type": "array",
"description": "Optional canonical addresses to project, e.g. [\"$.order\", \"$.totals\"]. Only these subtrees are returned, spliced back into a pruned document at their addresses; absent addresses are skipped.",
"items": {
"type": "string"
}
},
"depth": {
"type": "integer",
"minimum": 0,
"description": "Optional max nesting depth; containers deeper than this collapse to a size marker. Applied after 'paths'."
}
},
"required": [
"id"
]
}出力スキーマ
{
"type": "object",
"properties": {}
}🟢get_field(id, path)
Get the value of a single field by its JSON Path address (e.g. "$.order.total"). Evaluates a LAZY derivation on demand.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"path": {
"type": "string",
"description": "A canonical JSON Path address, e.g. \"$.order.total\"."
}
},
"required": [
"id",
"path"
]
}🟢mutate(id, mutations, includeTraces)
Apply field mutations to a model and run the reactive pipeline (derivations recompute, constraints enforce, effects dispatch). 'mutations' is a flat map keyed by canonical JSON Path address, e.g. {"$.order.qty": 3}. A ROLLBACK constraint violation returns isError with the structured list of violated constraints. Returns the actionable summary (derivedUpdated / flaggedConstraints / dispatchedEffects); pass includeTraces:true for the full derivation/constraint trace (the same payload 'explain' serves — omit it and call explain only when a value looks wrong).
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"mutations": {
"type": "object",
"description": "Map of canonical JSON Path address to new value, e.g. {\"$.order.qty\": 3, \"$.order.discount\": 0.1}.",
"additionalProperties": true
},
"includeTraces": {
"type": "boolean",
"description": "Include the full derivation/constraint trace in the result (default false)."
}
},
"required": [
"id",
"mutations"
]
}出力スキーマ
{
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "True when the mutation committed."
},
"mutatedPaths": {
"type": "array",
"description": "Base paths written."
},
"derivedUpdated": {
"type": "array",
"description": "Derived paths recomputed."
},
"metaUpdated": {
"type": "array",
"description": "Meta paths recomputed."
},
"flaggedConstraints": {
"type": "array",
"description": "Ids of FLAG-policy constraints that fired."
},
"dispatchedEffects": {
"type": "array",
"description": "Ids of effects dispatched."
},
"traces": {
"type": "array",
"description": "Full derivation/constraint traces (only when includeTraces:true)."
}
}
}🟡patch_model(id, patch, includeTraces)
Apply an RFC 6902 JSON Patch document to a model and run the reactive pipeline. Unlike 'mutate' (a flat address→value map), a patch expresses array insert/remove/move and test/copy ops, e.g. [{"op":"add","path":"/order/items/-","value":{...}}, {"op":"remove","path":"/order/items/0"}]. 'path' fields use RFC 6901 JSON Pointer (slash-separated, '-' for array append), NOT the $.-rooted address form. Same result shape and ROLLBACK/schema error handling as 'mutate'.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"patch": {
"type": "array",
"description": "An RFC 6902 JSON Patch: an array of {op, path, value?, from?} operations applied in order.",
"items": {
"type": "object"
}
},
"includeTraces": {
"type": "boolean",
"description": "Include the full derivation/constraint trace in the result (default false)."
}
},
"required": [
"id",
"patch"
]
}出力スキーマ
{
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "True when the mutation committed."
},
"mutatedPaths": {
"type": "array",
"description": "Base paths written."
},
"derivedUpdated": {
"type": "array",
"description": "Derived paths recomputed."
},
"metaUpdated": {
"type": "array",
"description": "Meta paths recomputed."
},
"flaggedConstraints": {
"type": "array",
"description": "Ids of FLAG-policy constraints that fired."
},
"dispatchedEffects": {
"type": "array",
"description": "Ids of effects dispatched."
},
"traces": {
"type": "array",
"description": "Full derivation/constraint traces (only when includeTraces:true)."
}
}
}🟢get_effective_schema(id, path)
Get the effective JSON Schema for a field: the static schema overlaid with LIVE meta-derived constraints (current min/max/required/…). Check this BEFORE writing a value to learn what the reactive pipeline will accept, instead of discovering an invalid mutation only by trying it and getting a schema-violation error.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"path": {
"type": "string",
"description": "A canonical JSON Path address, e.g. \"$.order.total\"."
}
},
"required": [
"id",
"path"
]
}出力スキーマ
{
"type": "object",
"properties": {}
}🟢snapshot(id)
Capture an immutable point-in-time snapshot of a model's state (base document + derived/meta caches). A natural safety step before a risky evolve_spec: keep the returned snapshot and, if the change goes wrong, hand it back to 'restore' to roll the state back.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
}
},
"required": [
"id"
]
}出力スキーマ
{
"type": "object",
"properties": {}
}🔴restore(id, snapshot)
Restore a model's state from a snapshot previously returned by 'snapshot' (pass it back verbatim as 'snapshot'). Overwrites the model's current base state. The snapshot must be for the same model.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"snapshot": {
"type": "object",
"description": "A snapshot object as returned by the 'snapshot' tool.",
"additionalProperties": true
}
},
"required": [
"id",
"snapshot"
]
}🟢explain(id, path, limit)
Explain why a field is what it is: returns the recent derivation/constraint trace records for a path from the in-memory ring buffer (inputs, expression, result). For a constraint use the synthetic path "$constraint:<id>". Trace records can be bulky — pass 'limit' to return only the most recent N.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"path": {
"type": "string",
"description": "A canonical JSON Path address, e.g. \"$.order.total\"."
},
"limit": {
"type": "integer",
"minimum": 1,
"description": "Optional cap; return only the most recent N trace records."
}
},
"required": [
"id",
"path"
]
}🟢get_history(id)
List the ISO-8601 timestamps of a model's committed mutations (most recent 100).
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
}
},
"required": [
"id"
]
}🟢get_audit(id, pathPrefix, from, to, limit)
Query a model's durable, append-only audit trail (newest-first): one record per committed reactive cycle (mutations, derivedUpdated, traces, flaggedConstraints, dispatchedEffects, source, sequence). This is the queryable superset of get_history/explain — it survives the in-memory ring buffer rolling over. Filter with an optional 'pathPrefix' (canonical address), an ISO-8601 'from'/'to' window, and 'limit'. (Embedded mode keeps this in memory for the session; remote/paired mode reads the server's durable store.)
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"pathPrefix": {
"type": "string",
"description": "Optional canonical address prefix; keep only records that touched a matching field/derivation/constraint."
},
"from": {
"type": "string",
"description": "Optional ISO-8601 lower bound (inclusive)."
},
"to": {
"type": "string",
"description": "Optional ISO-8601 upper bound (exclusive)."
},
"limit": {
"type": "integer",
"minimum": 1,
"description": "Optional max records (default 100, newest-first)."
}
},
"required": [
"id"
]
}🟢verify_audit(id)
Verify the tamper-evidence hash chain of a model's durable audit trail. Returns {valid, recordsChecked, firstBrokenSequence, detail}; a false 'valid' points at the first altered/reordered/deleted record. (Embedded mode has no hash chain and reports valid.)
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
}
},
"required": [
"id"
]
}出力スキーマ
{
"type": "object",
"properties": {
"valid": {
"type": "boolean",
"description": "True when the whole chain is intact."
},
"recordsChecked": {
"type": "integer",
"description": "Number of records examined."
},
"firstBrokenSequence": {
"type": "integer",
"description": "Sequence of the first broken record, or null."
},
"detail": {
"type": "string",
"description": "Human-readable explanation ('ok' when valid)."
}
}
}🟡upload_blob(data, mediaType)
Store binary content (base64-encoded in 'data') in the content-addressed blob store and get back a BlobRef {$blobId, $mediaType, $bytes} to embed in a model's binary field. Storage is content-addressed (SHA-256), so uploading identical bytes returns the same $blobId.
入力スキーマ
{
"type": "object",
"properties": {
"data": {
"type": "string",
"description": "The blob content, base64-encoded."
},
"mediaType": {
"type": "string",
"description": "Optional media type (default application/octet-stream)."
}
},
"required": [
"data"
]
}出力スキーマ
{
"type": "object",
"properties": {
"$blobId": {
"type": "string",
"description": "Content-addressed id (sha256:...)."
},
"$mediaType": {
"type": "string",
"description": "The stored media type."
},
"$bytes": {
"type": "integer",
"description": "Size in bytes."
}
}
}🟢download_blob(blobId, modelId)
Fetch a blob's bytes by id, base64-encoded in the result. Pass 'modelId' to fetch a blob referenced by a specific model (access-scoped); omit it for a direct store fetch. Large blobs may exceed the result-size limit — this channel suits small binaries only.
入力スキーマ
{
"type": "object",
"properties": {
"blobId": {
"type": "string",
"description": "The blob id (sha256:...)."
},
"modelId": {
"type": "string",
"description": "Optional model id to scope the fetch to a referencing model."
}
},
"required": [
"blobId"
]
}出力スキーマ
{
"type": "object",
"properties": {
"blobId": {
"type": "string",
"description": "The requested blob id."
},
"bytes": {
"type": "integer",
"description": "Size in bytes."
},
"data": {
"type": "string",
"description": "The blob content, base64-encoded."
}
}
}🔴evolve_spec(id, evolution)
Apply an incremental SpecEvolution diff to a model, preserving live state. Returns the new version. Fails (isError) if the evolved spec is invalid, if expectedVersion no longer matches, or if a schema change would strand existing state. Prefer targeted diffs (upsertSchemaNodes/upsertSchemaDefs, upsertComponents, upsertConstants) over resending a whole section (newSchema/newViewDefinition/newConstants).
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"evolution": {
"type": "object",
"properties": {
"newVersion": {
"type": "string"
},
"newSchema": {
"type": "object"
},
"newViewDefinition": {
"type": "object"
},
"upsertDerivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"evaluation": {
"type": "string",
"enum": [
"eager",
"lazy"
]
}
},
"required": [
"path",
"expr"
]
}
},
"removeDerivations": {
"type": "array",
"items": {
"type": "string"
}
},
"upsertMetaDerivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"property": {
"type": "string"
},
"expr": {
"type": "string"
}
},
"required": [
"path",
"property",
"expr"
]
}
},
"removeMetaDerivations": {
"type": "array",
"items": {
"type": "string"
}
},
"upsertDefaultValues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"path",
"expr"
]
}
},
"removeDefaultValues": {
"type": "array",
"items": {
"type": "string"
}
},
"newConstants": {
"type": "object"
},
"upsertConstraints": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"expr": {
"type": "string"
},
"message": {
"type": "string"
},
"policy": {
"type": "string",
"enum": [
"rollback",
"flag"
]
},
"path": {
"type": "string"
}
},
"required": [
"id",
"expr"
]
}
},
"removeConstraints": {
"type": "array",
"items": {
"type": "string"
}
},
"upsertEffects": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"executor": {
"type": "string",
"enum": [
"caller",
"server",
"llm",
"timer"
]
},
"trigger": {
"type": "string"
},
"dedupeKey": {
"type": "string"
},
"statusPath": {
"type": "string"
},
"emit": {
"type": "string"
},
"payload": {
"type": "object"
},
"request": {
"type": "object"
},
"requests": {
"type": "string"
},
"prompt": {
"type": "string"
},
"responseSchema": {
"type": "object"
},
"at": {
"type": "string"
},
"afterMs": {
"type": "string"
},
"response": {
"type": "object"
},
"policy": {
"type": "object"
}
},
"required": [
"id",
"executor",
"trigger"
]
}
},
"removeEffects": {
"type": "array",
"items": {
"type": "string"
}
},
"backfill": {
"type": "object"
},
"expectedVersion": {
"type": "string"
},
"upsertSchemaDefs": {
"type": "object"
},
"removeSchemaDefs": {
"type": "array",
"items": {
"type": "string"
}
},
"upsertSchemaNodes": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"schema": {
"type": "object"
},
"required": {
"type": "boolean"
}
},
"required": [
"path",
"schema"
]
}
},
"removeSchemaNodes": {
"type": "array",
"items": {
"type": "string"
}
},
"newDefaultView": {
"type": "string"
},
"upsertViews": {
"type": "array",
"items": {
"type": "object"
}
},
"removeViews": {
"type": "array",
"items": {
"type": "string"
}
},
"upsertComponents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"viewId": {
"type": "string"
},
"parentId": {
"type": "string"
},
"beforeId": {
"type": "string"
},
"component": {
"type": "object"
}
},
"required": [
"viewId",
"component"
]
}
},
"removeComponents": {
"type": "array",
"items": {
"type": "object",
"properties": {
"viewId": {
"type": "string"
},
"componentId": {
"type": "string"
}
},
"required": [
"viewId",
"componentId"
]
}
},
"upsertConstants": {
"type": "object"
},
"removeConstants": {
"type": "array",
"items": {
"type": "string"
}
},
"newLibrary": {
"type": "object",
"properties": {
"define": {
"type": "string"
},
"signatures": {
"type": "object"
}
},
"required": [
"define"
]
}
},
"description": "A SpecEvolution document: newVersion/expectedVersion plus per-section upsert/remove lists. Schema tiers: upsertSchemaDefs/removeSchemaDefs (by $defs name), upsertSchemaNodes/removeSchemaNodes (by canonical data path), or newSchema (wholesale). View tiers: upsertViews/removeViews/newDefaultView, upsertComponents/removeComponents, or newViewDefinition. Constants: upsertConstants/removeConstants or newConstants."
}
},
"required": [
"id",
"evolution"
]
}出力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The evolved model id."
},
"version": {
"type": "string",
"description": "The model's new version after evolution."
}
}
}🔴delete_model(id)
Remove a model from the registry. Fails (isError) if the model does not exist.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
}
},
"required": [
"id"
]
}出力スキーマ
{
"type": "object",
"properties": {
"deleted": {
"type": "boolean",
"description": "True when the model was removed."
}
}
}🟢get_view(id, viewId)
Evaluate a model's embedded view definition against current state and return the resolved component tree. Pass an optional 'viewId' for a named view; omit for the default view.
入力スキーマ
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The model id."
},
"viewId": {
"type": "string",
"description": "Optional named view id; omit for the default view."
}
},
"required": [
"id"
]
}出力スキーマ
{
"type": "object",
"properties": {}
}🟢get_domain_guidance(topics)
Get vetted instructions for the hard modelling shapes this domain involves (progressive tax/fee charges, per-period schedules, classification, date math, group-by, …). Read the model description in ANY language, pick the matching topic ids, and call this BEFORE authoring the spec — then follow what it returns. Available topics: - amortization_schedule — A computed array / per-period schedule: an amortization table, time series, or per-period breakdown (one row per period). - group_by — Group-by / aggregation over an array: subtotals, counts, sums per category. - date_math — Date arithmetic: days/months/years between dates, elapsed duration, age from a birth date. - classification — Deriving a label / tier / band / risk level / status from data via thresholds. - currency_conversion — Currency / FX conversion of an amount by an exchange rate. - status_field — A status / state field with flags or labels derived from the current status. - rank_percentile — Rank / percentile / leaderboard / quartile over an array of values. - regulated_charge — An official published charge whose rates are set by an authority: a tax, duty, levy, tariff, fee, toll, excise, or customs charge. - percentage — Percentages / ratios: percent-of, markup, discount, tax-inclusive vs exclusive, share-as-percent. - unit_conversion — Unit conversion / dimensional consistency: cm-m, kg-lb, C-F, miles-km — one canonical unit per quantity. - compound_growth — Compound growth / interest: future value, compound interest, exponential growth (the ** operator). - weighted_average — Weighted sum / weighted average / score over an array of values and weights. - eligibility — A boolean eligibility / qualification verdict derived from several criteria (and/or of conditions). - proration — Prorating / allocating an amount across a count or period (per-unit share, partial-period). - editable_items — A user-edited list of items the user adds, edits and removes: line items, debts, expenses, passengers, participants — each with its own fields.
入力スキーマ
{
"type": "object",
"properties": {
"topics": {
"type": "array",
"description": "Ids of the guidance topics that apply (usually 0-2).",
"items": {
"type": "string",
"enum": [
"amortization_schedule",
"group_by",
"date_math",
"classification",
"currency_conversion",
"status_field",
"rank_percentile",
"regulated_charge",
"percentage",
"unit_conversion",
"compound_growth",
"weighted_average",
"eligibility",
"proration",
"editable_items"
]
}
}
},
"required": [
"topics"
]
}出力スキーマ
{
"type": "object",
"properties": {
"topics": {
"type": "array"
},
"guidance": {
"type": "string",
"description": "Concatenated instructions for the requested topics."
}
}
}🟢validate_spec(spec)
Validate a ModelSpec WITHOUT creating it: returns a 'valid' flag plus structured findings (errors + warnings, each with a location and message). Use this to iterate on a draft — fix the reported errors, re-validate — before committing with create_model.
入力スキーマ
{
"type": "object",
"properties": {
"spec": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"version": {
"type": "string"
},
"schema": {
"type": "object"
},
"constants": {
"type": "object"
},
"library": {
"type": "object",
"properties": {
"define": {
"type": "string"
},
"description": {
"type": "string"
},
"signatures": {
"type": "object"
}
},
"required": [
"define"
]
},
"defaultValues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"path",
"expr"
]
}
},
"derivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"evaluation": {
"type": "string",
"enum": [
"eager",
"lazy"
]
}
},
"required": [
"path",
"expr"
]
}
},
"metaDerivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"property": {
"type": "string"
},
"expr": {
"type": "string"
}
},
"required": [
"path",
"property",
"expr"
]
}
},
"constraints": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"expr": {
"type": "string"
},
"message": {
"type": "string"
},
"policy": {
"type": "string",
"enum": [
"rollback",
"flag"
]
},
"path": {
"type": "string"
}
},
"required": [
"id",
"expr"
]
}
},
"effects": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"executor": {
"type": "string",
"enum": [
"caller",
"server",
"llm",
"timer"
]
},
"trigger": {
"type": "string"
},
"dedupeKey": {
"type": "string"
},
"statusPath": {
"type": "string"
},
"emit": {
"type": "string"
},
"payload": {
"type": "object"
},
"request": {
"type": "object"
},
"requests": {
"type": "string"
},
"prompt": {
"type": "string"
},
"responseSchema": {
"type": "object"
},
"at": {
"type": "string"
},
"afterMs": {
"type": "string"
},
"response": {
"type": "object"
},
"policy": {
"type": "object"
}
},
"required": [
"id",
"executor",
"trigger"
]
}
},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"given": {
"type": "object"
},
"expect": {
"type": "object"
}
},
"required": [
"expect"
]
}
},
"viewDefinition": {
"type": "object"
}
},
"required": [
"id",
"schema"
],
"description": "The ModelSpec to validate."
}
},
"required": [
"spec"
]
}出力スキーマ
{
"type": "object",
"properties": {
"valid": {
"type": "boolean",
"description": "True when the spec has no errors."
},
"errors": {
"type": "array",
"description": "Blocking findings (each with location + message)."
},
"warnings": {
"type": "array",
"description": "Non-blocking findings."
}
}
}🟢eval_expression(expr, input, library, constants)
Evaluate a single JSONata expression against a sample input document and return the computed value, or the exact compile/eval error. Write the expr exactly as in a derivation/constraint 'expr': bare dot-paths, no leading $ (e.g. "loan.amount * loan.annualRate / 1200"). Use this to verify an expression before putting it in a spec — it uses the same compiler the runtime validates against. If the expression calls a library function, pass the model's library definition as 'library' — without it every $myFn(...) call fails as undefined.
入力スキーマ
{
"type": "object",
"properties": {
"expr": {
"type": "string",
"description": "A single JSONata expression (bare dot-paths, no leading $)."
},
"input": {
"type": "object",
"description": "Sample document the expression runs against (full nested shape, e.g. {\"loan\": {\"amount\": 20000}}). Optional; defaults to {}.",
"additionalProperties": true
},
"library": {
"type": "string",
"description": "Optional JSONata library definition expression whose exports are bound while evaluating, e.g. \"( $money := function($n){ $round($n,2) }; [\\\"money\\\"] )\". Pass it when the expression calls $myFn(...)."
},
"constants": {
"type": "object",
"description": "Optional constants bound as $const while evaluating (and while defining the library).",
"additionalProperties": true
}
},
"required": [
"expr"
]
}出力スキーマ
{
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"description": "True when the expression compiled and evaluated."
},
"undefined": {
"type": "boolean",
"description": "True when the result is JSONata 'undefined' (no match)."
},
"error": {
"type": "string",
"description": "'compile' or 'evaluation' when ok is false."
},
"message": {
"type": "string",
"description": "The compile/eval error message when ok is false."
}
}
}🟢test_spec(spec, tests)
Run a spec's embedded test cases (or ad-hoc given->expect cases) through the real reactive pipeline in a throwaway runtime, returning pass/fail plus per-field failures (path, expected, actual). Use this to certify domain behavior before create_model / promotion.
入力スキーマ
{
"type": "object",
"properties": {
"spec": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"version": {
"type": "string"
},
"schema": {
"type": "object"
},
"constants": {
"type": "object"
},
"library": {
"type": "object",
"properties": {
"define": {
"type": "string"
},
"description": {
"type": "string"
},
"signatures": {
"type": "object"
}
},
"required": [
"define"
]
},
"defaultValues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"path",
"expr"
]
}
},
"derivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"evaluation": {
"type": "string",
"enum": [
"eager",
"lazy"
]
}
},
"required": [
"path",
"expr"
]
}
},
"metaDerivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"property": {
"type": "string"
},
"expr": {
"type": "string"
}
},
"required": [
"path",
"property",
"expr"
]
}
},
"constraints": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"expr": {
"type": "string"
},
"message": {
"type": "string"
},
"policy": {
"type": "string",
"enum": [
"rollback",
"flag"
]
},
"path": {
"type": "string"
}
},
"required": [
"id",
"expr"
]
}
},
"effects": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"executor": {
"type": "string",
"enum": [
"caller",
"server",
"llm",
"timer"
]
},
"trigger": {
"type": "string"
},
"dedupeKey": {
"type": "string"
},
"statusPath": {
"type": "string"
},
"emit": {
"type": "string"
},
"payload": {
"type": "object"
},
"request": {
"type": "object"
},
"requests": {
"type": "string"
},
"prompt": {
"type": "string"
},
"responseSchema": {
"type": "object"
},
"at": {
"type": "string"
},
"afterMs": {
"type": "string"
},
"response": {
"type": "object"
},
"policy": {
"type": "object"
}
},
"required": [
"id",
"executor",
"trigger"
]
}
},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"given": {
"type": "object"
},
"expect": {
"type": "object"
}
},
"required": [
"expect"
]
}
},
"viewDefinition": {
"type": "object"
}
},
"required": [
"id",
"schema"
],
"description": "The ModelSpec whose tests to run."
},
"tests": {
"type": "array",
"description": "Optional list of test cases (each with 'given' inputs and 'expect' outputs); omit to run the spec's own embedded 'tests'."
}
},
"required": [
"spec"
]
}出力スキーマ
{
"type": "object",
"properties": {
"total": {
"type": "integer",
"description": "Total test cases run."
},
"passed": {
"type": "integer",
"description": "Cases that passed."
},
"failed": {
"type": "integer",
"description": "Cases that failed."
},
"results": {
"type": "array",
"description": "Per-case results (with per-field failures on failure)."
}
}
}🟢dry_run(spec, mutations)
Compile a candidate ModelSpec in an ISOLATED throwaway runtime, apply optional sample mutations, and return the resulting merged state (base + derived) — WITHOUT registering it in the live registry. Use this to preview the full reactive cascade of a draft spec.
入力スキーマ
{
"type": "object",
"properties": {
"spec": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"version": {
"type": "string"
},
"schema": {
"type": "object"
},
"constants": {
"type": "object"
},
"library": {
"type": "object",
"properties": {
"define": {
"type": "string"
},
"description": {
"type": "string"
},
"signatures": {
"type": "object"
}
},
"required": [
"define"
]
},
"defaultValues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"description": {
"type": "string"
}
},
"required": [
"path",
"expr"
]
}
},
"derivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"expr": {
"type": "string"
},
"evaluation": {
"type": "string",
"enum": [
"eager",
"lazy"
]
}
},
"required": [
"path",
"expr"
]
}
},
"metaDerivations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": {
"type": "string"
},
"property": {
"type": "string"
},
"expr": {
"type": "string"
}
},
"required": [
"path",
"property",
"expr"
]
}
},
"constraints": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"expr": {
"type": "string"
},
"message": {
"type": "string"
},
"policy": {
"type": "string",
"enum": [
"rollback",
"flag"
]
},
"path": {
"type": "string"
}
},
"required": [
"id",
"expr"
]
}
},
"effects": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"executor": {
"type": "string",
"enum": [
"caller",
"server",
"llm",
"timer"
]
},
"trigger": {
"type": "string"
},
"dedupeKey": {
"type": "string"
},
"statusPath": {
"type": "string"
},
"emit": {
"type": "string"
},
"payload": {
"type": "object"
},
"request": {
"type": "object"
},
"requests": {
"type": "string"
},
"prompt": {
"type": "string"
},
"responseSchema": {
"type": "object"
},
"at": {
"type": "string"
},
"afterMs": {
"type": "string"
},
"response": {
"type": "object"
},
"policy": {
"type": "object"
}
},
"required": [
"id",
"executor",
"trigger"
]
}
},
"tests": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"given": {
"type": "object"
},
"expect": {
"type": "object"
}
},
"required": [
"expect"
]
}
},
"viewDefinition": {
"type": "object"
}
},
"required": [
"id",
"schema"
],
"description": "The candidate ModelSpec."
},
"mutations": {
"type": "object",
"description": "Optional field mutations to apply, keyed by canonical JSON Path (e.g. {\"$.price\": 10, \"$.qty\": 3}).",
"additionalProperties": true
}
},
"required": [
"spec"
]
}出力スキーマ
{
"type": "object",
"properties": {}
}🔴pair_browser
Pair this MCP session with a browser tab on the hosted Valem sandbox so both drive the same live model session. Mints a pairing on first call (or resumes an existing not-yet-approved one) and waits up to a minute for the developer to approve it. Returns {status:"paired"|"already_paired", namespaceId} once done, or {status:"pending", verificationUri, verificationUriComplete, userCode, expiresInSec} if the developer hasn't approved yet — show them verificationUriComplete when present (it already carries the confirmation code, so they only click Approve) and mention that the code on that screen should read userCode; fall back to verificationUri, which requires them to TYPE userCode. Then call this tool again (it resumes the SAME pairing, it does not mint a new one). Every other model tool (create_model, mutate, evolve_spec, get_state, explain, ...) fails with a clear error until pairing succeeds.
入力スキーマ
{
"type": "object",
"properties": {}
}コミュニティ
エビデンス