← All procedures

client.conditional

Conditional execution (if/then/else)

MCPCLIbrowser
Package
@procedures/client · README
Path
["client","conditional"]
CLI
mark client conditional
MCP tool
client.conditional on the dev-tools server
As data
{"$proc":["client","conditional"],"input":{}}
Tags
core, control-flow, runs-refs

Try it in the Composer →

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY, allCoreProcedures } from "@procedures/client";

for (const procedure of allCoreProcedures) {
  if (!PROCEDURE_REGISTRY.has(procedure.path)) PROCEDURE_REGISTRY.register(procedure);
}

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["client","conditional"], { condition: "<condition>", then: "<then>" });
console.log(JSON.stringify(result));

From the command line

$ mark client conditional

As data, in a program

{
  "$proc": ["client", "conditional"],
  "input": { "condition": "<condition>", "then": "<then>" }
}

Input

FieldTypeRequired
conditionunknownyes
thenunknownyes
elseunknownno

Output

The schema does not list fields (any).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "condition": {
        "description": "The condition: a value or a call. A truthy result runs then, a falsy one runs else."
      },
      "then": {
        "description": "The program for a truthy condition"
      },
      "else": {
        "description": "The program for a falsy condition (default: undefined)"
      }
    },
    "additionalProperties": {}
  },
  "output": {
    "description": "The value of the chosen branch: its shape depends on the program"
  }
}