program.check
Check a program before it runs: names, procedures, inputs, the capability and the effects
MCPCLI- Package
- @procedures/compiler · README
- Path
["program","check"]- CLI
mark program check --program <any>- MCP tool
program.checkon thedev-toolsserver- As data
{"$proc":["program","check"],"input":{}}- Tags
- compiler, raw-input
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/compiler/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["program","check"], { program: "<program>" });
console.log(JSON.stringify(result));From the command line
$ mark program check --program <any>
As data, in a program
{ "$proc": ["program", "check"], "input": { "program": "<program>" } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
program | any | yes | The program: a call ({ $proc, input }). The procedure reads it as data: nothing in it starts. | |
capability | object | no | The capability of the run. Absent: the capability of the caller. | |
mode | "exec" | "body" | no | exec (the default): the program runs as client.exec runs it. body: as the body of a defined procedure, with input in scope. |
Output
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
ok | boolean | yes | True when no diagnostic is an error: then the host can start the program | |
effects | object | yes | The effects that a run can have (the upper bound) | |
mustEffects | object | yes | The effects of each run in which no call fails (the lower bound) | |
diagnostics | object[] | yes | The problems, in the order of the program | |
registryHash | string | yes | The hash of the manifest that the check used |
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"program": {
"description": "The program: a call ({ $proc, input }). The procedure reads it as data: nothing in it starts."
},
"capability": {
"type": "object",
"properties": {
"clearance": {
"description": "The clearance of the run"
},
"effects": {
"description": "The effects that the calls can have. Absent: all effects.",
"type": "object",
"properties": {
"reads": {
"description": "The resources that a call can read: names, or \"any\"",
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string",
"const": "any"
}
]
},
"writes": {
"description": "The resources that a call can change: names, or \"any\". An empty list: no change.",
"anyOf": [
{
"type": "array",
"items": {
"type": "string"
}
},
{
"type": "string",
"const": "any"
}
]
},
"destructive": {
"description": "False: a call cannot start a destructive procedure",
"type": "boolean"
}
}
},
"deadline": {
"description": "The deadline (the static check does not use it)",
"type": "number"
}
},
"description": "The capability of the run. Absent: the capability of the caller."
},
"mode": {
"description": "exec (the default): the program runs as client.exec runs it. body: as the body of a defined procedure, with input in scope.",
"type": "string",
"enum": [
"exec",
"body"
]
}
},
"required": [
"program"
]
},
"output": {
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"description": "True when no diagnostic is an error: then the host can start the program"
},
"effects": {
"type": "object",
"properties": {
"reads": {
"description": "The resources that a run can read. Absent: not known.",
"type": "array",
"items": {
"type": "string"
}
},
"writes": {
"description": "The resources that a run can change. Absent: not known.",
"type": "array",
"items": {
"type": "string"
}
},
"destructive": {
"description": "True: a call can delete or overwrite data",
"type": "boolean"
},
"idempotent": {
"description": "True: each call that changes data is idempotent",
"type": "boolean"
}
},
"additionalProperties": false,
"description": "The effects that a run can have (the upper bound)"
},
"mustEffects": {
"type": "object",
"properties": {
"reads": {
"type": "array",
"items": {
"type": "string"
},
"description": "The resources that each run reads"
},
"writes": {
"type": "array",
"items": {
"type": "string"
},
"description": "The resources that each run changes"
}
},
"required": [
"reads",
"writes"
],
"additionalProperties": false,
"description": "The effects of each run in which no call fails (the lower bound)"
},
"diagnostics": {
"type": "array",
"items": {
"type": "object",
"properties": {
"severity": {
"type": "string",
"enum": [
"error",
"warning",
"info"
],
"description": "An error stops the program"
},
"code": {
"type": "string",
"description": "The code of the problem, for example unknown-name"
},
"message": {
"type": "string",
"description": "The text of the problem"
},
"pointer": {
"type": "string",
"description": "The JSON pointer of the part of the program"
}
},
"required": [
"severity",
"code",
"message",
"pointer"
],
"additionalProperties": false
},
"description": "The problems, in the order of the program"
},
"registryHash": {
"type": "string",
"description": "The hash of the manifest that the check used"
}
},
"required": [
"ok",
"effects",
"mustEffects",
"diagnostics",
"registryHash"
],
"additionalProperties": false
}
}