# onf_operate_variable

Atomically increment a number, append array items, compareAndSet an exact JSON value, or updatePath through existing JSON containers. Requires current expectedRevision; validates the complete pinned type and commits once. No automatic retry

Canonical URL: https://opennodeflow.dev/wiki/tool-onf-operate-variable/
JSON reference: https://opennodeflow.dev/wiki/tool-onf-operate-variable/index.json
Source snapshot: 2026-10-23

Atomically increment a number, append array items, compareAndSet an exact JSON value, or updatePath through existing JSON containers. Requires current expectedRevision; validates the complete pinned type and commits once. No automatic retry after an uncertain response. Known redacted content cannot be written back.

[Agent workflow authoring](/wiki/mcp-workflow-authoring/) · [All MCP tools](/wiki/mcp-tools/)

## Inputs

| Field | Required | Contract |
| --- | --- | --- |
| `operation` | Yes | One of: increment, append, compareAndSet, updatePath |
| `expectedRevision` | Yes | integer |
| `amount` | No | number |
| `items` | No | Array of Structured value |
| `expectedValue` | No | Structured value |
| `value` | No | Structured value |
| `path` | No | Array of string or integer |
| `variableId` | Yes | string |

## Exact input schema


```json
{
  "type": "object",
  "properties": {
    "operation": {
      "type": "string",
      "enum": [
        "increment",
        "append",
        "compareAndSet",
        "updatePath"
      ]
    },
    "expectedRevision": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "amount": {
      "type": "number"
    },
    "items": {
      "maxItems": 10000,
      "type": "array",
      "items": {}
    },
    "expectedValue": {},
    "value": {},
    "path": {
      "minItems": 1,
      "maxItems": 32,
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "string",
            "minLength": 1,
            "maxLength": 120
          },
          {
            "type": "integer",
            "minimum": 0,
            "maximum": 9999
          }
        ]
      }
    },
    "variableId": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_.-]{1,120}$"
    }
  },
  "required": [
    "operation",
    "expectedRevision",
    "variableId"
  ]
}
```


## MCP annotations

- `readOnlyHint`: `false`
- `destructiveHint`: `false`
- `idempotentHint`: `false`
- `openWorldHint`: `false`

Annotations describe tool behavior; they are not an authorization boundary.

## Calling this tool

Use the exact registered name `onf_operate_variable` through a compatible MCP client. Start with discovery and read the current object before a change. Pass the documented revision or version guards where required. A JSON Schema default is not a substitute for reading the tool contract.

See [connection setup](/wiki/mcp-connect/) and [agent safety](/wiki/agent-safety/) for transport, permissions and uncertain-action recovery.

---

## Documentation provenance

- `server/variable-tools.ts`

This page describes maintained source, not a live inventory or an authorization to perform actions.
