# Автоматизации

> Инструменты раздела «Автоматизации»: 12

Подключение: `https://mcp.legalstack.ru/mcp/automation` или в составе общего подключения `https://mcp.legalstack.ru/mcp`.

## Удалить автоматизацию

`delete_automation` · необратимое действие

Описание для модели: Delete an automation. Cannot be restored.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `automation_id` | string | да | Automation id. Длина: 1–64. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "automation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Automation id"
    }
  },
  "required": [
    "automation_id"
  ],
  "additionalProperties": false
}
```

</details>

## Справочник действий автоматизаций

`describe_automation_nodes` · только чтение

Описание для модели: Describe actions available for building automations. Without arguments returns the index of categories and types together with the condition operators allowed per data type. With type returns its actions. With type and action returns the settings schema, the outputs and the output fields. The uses of a step is type.action.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `type` | string | нет | Type of the node, for example documents or tasks. Длина: 1–100. |
| `action` | string | нет | Key of the action within the type. Длина: 1–100. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "type": {
      "description": "Type of the node, for example documents or tasks",
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "action": {
      "description": "Key of the action within the type",
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    }
  },
  "additionalProperties": false
}
```

</details>

## Справочник триггеров автоматизаций

`describe_automation_triggers` · только чтение

Описание для модели: Describe triggers that start automations and their data. The uses of a trigger is manual, schedule, event or webhook; settings is the JSON schema of its with. For event the catalog lists the sources, the events and the data of each event; sourceId * means any source. A schedule without scheduleDataSource only fires at the time.

**Параметры**

Параметров нет.

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

</details>

## Устройство автоматизации

`get_automation` · только чтение

Описание для модели: Get an automation as steps and links, ready for editing. Pass the steps and links back to save_automation to change the automation, keep ref of untouched steps.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `automation_id` | string | да | Automation id. Длина: 1–64. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "automation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Automation id"
    }
  },
  "required": [
    "automation_id"
  ],
  "additionalProperties": false
}
```

</details>

## Журнал запуска автоматизации

`get_automation_run` · только чтение

Описание для модели: Get one run of an automation with the log of its steps. While the status says the run goes on, ask again later. Input and output of steps come only to those who may edit the automation; simulated steps of a test run did not touch any data.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `run_id` | string | да | Run id. Длина: 1–64. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "run_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Run id"
    }
  },
  "required": [
    "run_id"
  ],
  "additionalProperties": false
}
```

</details>

## История запусков автоматизации

`list_automation_runs` · только чтение

Описание для модели: List runs of an automation, newest first.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `automation_id` | string | да | Automation id. Длина: 1–64. |
| `limit` | integer | нет | Maximum number of items to return, 20 by default. По умолчанию: `20`. Диапазон: 1–200. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "automation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Automation id"
    },
    "limit": {
      "default": 20,
      "description": "Maximum number of items to return, 20 by default",
      "type": "integer",
      "minimum": 1,
      "maximum": 200
    }
  },
  "required": [
    "automation_id"
  ],
  "additionalProperties": false
}
```

</details>

## Список автоматизаций

`list_automations` · только чтение

Описание для модели: List automations of the team, optionally by status or text.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `query` | string | нет | Words from the name or the description. Длина: 1–200. |
| `status` | string | нет | Status of the automation. Значения: `Включена`, `Выключена`, `Черновик`. |
| `limit` | integer | нет | Maximum number of items to return, 50 by default. По умолчанию: `50`. Диапазон: 1–200. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "query": {
      "description": "Words from the name or the description",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "status": {
      "type": "string",
      "enum": [
        "Включена",
        "Выключена",
        "Черновик"
      ],
      "description": "Status of the automation"
    },
    "limit": {
      "default": 50,
      "description": "Maximum number of items to return, 50 by default",
      "type": "integer",
      "minimum": 1,
      "maximum": 200
    }
  },
  "additionalProperties": false
}
```

</details>

## Запустить автоматизацию

`run_automation` · изменяет данные

Описание для модели: Start one run of an automation by hand. Works for drafts too. The run goes on in the background, read its result with get_automation_run. In test mode reads run for real while writes and sends are simulated from the output schema and marked as such; without trigger_data the test takes the pinned sample of trigger data (the last real event or the sample set with set_automation_test_data).

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `automation_id` | string | да | Automation id. Длина: 1–64. |
| `mode` | string | нет | live runs every step, test simulates writes and sends. Значения: `live`, `test`. По умолчанию: `live`. |
| `trigger_data` | объект | нет | Data available to steps as trigger. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "automation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Automation id"
    },
    "mode": {
      "default": "live",
      "description": "live runs every step, test simulates writes and sends",
      "type": "string",
      "enum": [
        "live",
        "test"
      ]
    },
    "trigger_data": {
      "description": "Data available to steps as trigger",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "automation_id"
  ],
  "additionalProperties": false
}
```

</details>

## Сохранить автоматизацию

`save_automation` · изменяет данные · только для агентов платформы

Описание для модели: Create or change an automation from steps and links. Data references are {{ steps.ref.field }}, {{ trigger.field }} and {{ item }}. To change an automation take steps and links from get_automation and keep ref of untouched steps. Without steps only the name and the description change. A new automation is a draft, turn it on with set_automation_active after the user agrees.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `automation_id` | string | нет | Automation to change, empty to create a new one. Длина: 1–64. |
| `name` | string | нет | Name of the automation. Длина: 1–300. |
| `description` | string | нет | Description. Длина: до 5000. |
| `steps` | массив объектов | нет | Steps of the automation. Элементов: 1–200. |
| `steps[].ref` | string | да | Stable unique id of the step in latin letters, digits and underscore, not trigger, item, index or now. Длина: 1–60. |
| `steps[].uses` | string | да | What the step does, type.action for an action or the name of a trigger or logic. Длина: 1–120. |
| `steps[].label` | string | нет | Name of the step shown to people. Длина: до 200. |
| `steps[].with` | объект | нет | Settings of the action, strings may hold references. |
| `steps[].when` | объект | нет | Condition of a condition step: comparisons joined by all (and) or any (or). |
| `steps[].when.match` | string | нет | all: every condition must hold; any: at least one. Значения: `all`, `any`. По умолчанию: `all`. |
| `steps[].when.conditions` | массив объектов | да | Comparisons of the condition. Элементов: 1–50. |
| `steps[].when.conditions[].variable` | string | да | Reference to data without braces: trigger.<field>, <step ref>.<field>, item.<field>, now. Длина: 1–200. |
| `steps[].when.conditions[].operator` | string | да | Comparison operator from the operator catalog. Значения: `is`, `isNot`, `isOneOf`, `isNoneOf`, `isFilled`, `isEmpty`, `contains`, `notContains`, `beginsWith`, `endsWith`, `gt`, `gte`, `lt`, `lte`, `between`, `earlierThan`, `laterThan`, `on`, `earlierThanOrOn`, `laterThanOrOn`. |
| `steps[].when.conditions[].value` | string или number или boolean или массив string или number | нет | Literal to compare with; a list for isOneOf, isNoneOf and between; omitted for isFilled and isEmpty. |
| `steps[].when.conditions[].ref` | string | нет | Reference to compare with instead of a literal value. Длина: 1–200. |
| `steps[].forEach` | string | нет | Data to repeat over, for a loop step. Длина: до 2000. |
| `steps[].duration` | string | нет | ISO 8601 duration, for a wait step. Длина: до 60. |
| `steps[].onError` | string | нет | What an action does when it fails: stop the branch (default) or route to its error output. Значения: `stop`, `route`. |
| `links` | массив объектов | нет | Links between the steps. Элементов: до 500. |
| `links[].from` | string | да | ref of the source step. Длина: 1–60. |
| `links[].to` | string | да | ref of the target step. Длина: 1–60. |
| `links[].on` | string | нет | Output port: main by default; true or false for a condition; loop or done for a loop; done, rejected or timeout for an approval, a signature or an agent task; error for a step with onError route. Длина: до 30. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "automation_id": {
      "description": "Automation to change, empty to create a new one",
      "type": "string",
      "minLength": 1,
      "maxLength": 64
    },
    "name": {
      "description": "Name of the automation",
      "type": "string",
      "minLength": 1,
      "maxLength": 300
    },
    "description": {
      "description": "Description",
      "type": "string",
      "maxLength": 5000
    },
    "steps": {
      "description": "Steps of the automation",
      "minItems": 1,
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "Stable unique id of the step in latin letters, digits and underscore, not trigger, item, index or now"
          },
          "uses": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "What the step does, type.action for an action or the name of a trigger or logic"
          },
          "label": {
            "description": "Name of the step shown to people",
            "type": "string",
            "maxLength": 200
          },
          "with": {
            "description": "Settings of the action, strings may hold references",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "when": {
            "description": "Condition of a condition step: comparisons joined by all (and) or any (or)",
            "type": "object",
            "properties": {
              "match": {
                "default": "all",
                "description": "all: every condition must hold; any: at least one",
                "type": "string",
                "enum": [
                  "all",
                  "any"
                ]
              },
              "conditions": {
                "minItems": 1,
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "variable": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "Reference to data without braces: trigger.<field>, <step ref>.<field>, item.<field>, now"
                    },
                    "operator": {
                      "type": "string",
                      "enum": [
                        "is",
                        "isNot",
                        "isOneOf",
                        "isNoneOf",
                        "isFilled",
                        "isEmpty",
                        "contains",
                        "notContains",
                        "beginsWith",
                        "endsWith",
                        "gt",
                        "gte",
                        "lt",
                        "lte",
                        "between",
                        "earlierThan",
                        "laterThan",
                        "on",
                        "earlierThanOrOn",
                        "laterThanOrOn"
                      ],
                      "description": "Comparison operator from the operator catalog"
                    },
                    "value": {
                      "description": "Literal to compare with; a list for isOneOf, isNoneOf and between; omitted for isFilled and isEmpty",
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 2000
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "boolean"
                            }
                          ]
                        },
                        {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 2000
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    "ref": {
                      "description": "Reference to compare with instead of a literal value",
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "variable",
                    "operator"
                  ],
                  "additionalProperties": false
                },
                "description": "Comparisons of the condition"
              }
            },
            "required": [
              "conditions"
            ],
            "additionalProperties": false
          },
          "forEach": {
            "description": "Data to repeat over, for a loop step",
            "type": "string",
            "maxLength": 2000
          },
          "duration": {
            "description": "ISO 8601 duration, for a wait step",
            "type": "string",
            "maxLength": 60
          },
          "onError": {
            "description": "What an action does when it fails: stop the branch (default) or route to its error output",
            "type": "string",
            "enum": [
              "stop",
              "route"
            ]
          }
        },
        "required": [
          "ref",
          "uses"
        ],
        "additionalProperties": false
      }
    },
    "links": {
      "description": "Links between the steps",
      "maxItems": 500,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "ref of the source step"
          },
          "to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "ref of the target step"
          },
          "on": {
            "description": "Output port: main by default; true or false for a condition; loop or done for a loop; done, rejected or timeout for an approval, a signature or an agent task; error for a step with onError route",
            "type": "string",
            "maxLength": 30
          }
        },
        "required": [
          "from",
          "to"
        ],
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
```

</details>

## Включить или выключить автоматизацию

`set_automation_active` · изменяет данные

Описание для модели: Turn an automation on or off. An automation that is on fires by its triggers and acts for real.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `automation_id` | string | да | Automation id. Длина: 1–64. |
| `active` | boolean | да | True turns the automation on, false turns it off. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "automation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Automation id"
    },
    "active": {
      "type": "boolean",
      "description": "True turns the automation on, false turns it off"
    }
  },
  "required": [
    "automation_id",
    "active"
  ],
  "additionalProperties": false
}
```

</details>

## Задать данные для теста автоматизации

`set_automation_test_data` · изменяет данные

Описание для модели: Pin trigger data used by test runs of an automation. Keys follow the trigger fields from describe_automation_triggers. Leave data out to drop the manual sample and fall back to the last real event. Binary content is never pinned.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `automation_id` | string | да | Automation id. Длина: 1–64. |
| `data` | объект | нет | Trigger data for test runs; without it the manual sample is dropped. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "automation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Automation id"
    },
    "data": {
      "description": "Trigger data for test runs; without it the manual sample is dropped",
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": {}
    }
  },
  "required": [
    "automation_id"
  ],
  "additionalProperties": false
}
```

</details>

## Проверить автоматизацию

`validate_automation` · только чтение

Описание для модели: Check an automation or a draft of steps without saving. Pass steps and links to check a draft, or automation_id to check a saved automation.

**Параметры**

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `automation_id` | string | нет | Automation id. Длина: 1–64. |
| `steps` | массив объектов | нет | Steps of the draft. Элементов: 1–200. |
| `steps[].ref` | string | да | Stable unique id of the step in latin letters, digits and underscore, not trigger, item, index or now. Длина: 1–60. |
| `steps[].uses` | string | да | What the step does, type.action for an action or the name of a trigger or logic. Длина: 1–120. |
| `steps[].label` | string | нет | Name of the step shown to people. Длина: до 200. |
| `steps[].with` | объект | нет | Settings of the action, strings may hold references. |
| `steps[].when` | объект | нет | Condition of a condition step: comparisons joined by all (and) or any (or). |
| `steps[].when.match` | string | нет | all: every condition must hold; any: at least one. Значения: `all`, `any`. По умолчанию: `all`. |
| `steps[].when.conditions` | массив объектов | да | Comparisons of the condition. Элементов: 1–50. |
| `steps[].when.conditions[].variable` | string | да | Reference to data without braces: trigger.<field>, <step ref>.<field>, item.<field>, now. Длина: 1–200. |
| `steps[].when.conditions[].operator` | string | да | Comparison operator from the operator catalog. Значения: `is`, `isNot`, `isOneOf`, `isNoneOf`, `isFilled`, `isEmpty`, `contains`, `notContains`, `beginsWith`, `endsWith`, `gt`, `gte`, `lt`, `lte`, `between`, `earlierThan`, `laterThan`, `on`, `earlierThanOrOn`, `laterThanOrOn`. |
| `steps[].when.conditions[].value` | string или number или boolean или массив string или number | нет | Literal to compare with; a list for isOneOf, isNoneOf and between; omitted for isFilled and isEmpty. |
| `steps[].when.conditions[].ref` | string | нет | Reference to compare with instead of a literal value. Длина: 1–200. |
| `steps[].forEach` | string | нет | Data to repeat over, for a loop step. Длина: до 2000. |
| `steps[].duration` | string | нет | ISO 8601 duration, for a wait step. Длина: до 60. |
| `steps[].onError` | string | нет | What an action does when it fails: stop the branch (default) or route to its error output. Значения: `stop`, `route`. |
| `links` | массив объектов | нет | Links of the draft. Элементов: до 500. |
| `links[].from` | string | да | ref of the source step. Длина: 1–60. |
| `links[].to` | string | да | ref of the target step. Длина: 1–60. |
| `links[].on` | string | нет | Output port: main by default; true or false for a condition; loop or done for a loop; done, rejected or timeout for an approval, a signature or an agent task; error for a step with onError route. Длина: до 30. |

<details>
<summary>JSON Schema параметров</summary>

```json
{
  "type": "object",
  "properties": {
    "automation_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Automation id"
    },
    "steps": {
      "description": "Steps of the draft",
      "minItems": 1,
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "ref": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "Stable unique id of the step in latin letters, digits and underscore, not trigger, item, index or now"
          },
          "uses": {
            "type": "string",
            "minLength": 1,
            "maxLength": 120,
            "description": "What the step does, type.action for an action or the name of a trigger or logic"
          },
          "label": {
            "description": "Name of the step shown to people",
            "type": "string",
            "maxLength": 200
          },
          "with": {
            "description": "Settings of the action, strings may hold references",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          },
          "when": {
            "description": "Condition of a condition step: comparisons joined by all (and) or any (or)",
            "type": "object",
            "properties": {
              "match": {
                "default": "all",
                "description": "all: every condition must hold; any: at least one",
                "type": "string",
                "enum": [
                  "all",
                  "any"
                ]
              },
              "conditions": {
                "minItems": 1,
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "variable": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200,
                      "description": "Reference to data without braces: trigger.<field>, <step ref>.<field>, item.<field>, now"
                    },
                    "operator": {
                      "type": "string",
                      "enum": [
                        "is",
                        "isNot",
                        "isOneOf",
                        "isNoneOf",
                        "isFilled",
                        "isEmpty",
                        "contains",
                        "notContains",
                        "beginsWith",
                        "endsWith",
                        "gt",
                        "gte",
                        "lt",
                        "lte",
                        "between",
                        "earlierThan",
                        "laterThan",
                        "on",
                        "earlierThanOrOn",
                        "laterThanOrOn"
                      ],
                      "description": "Comparison operator from the operator catalog"
                    },
                    "value": {
                      "description": "Literal to compare with; a list for isOneOf, isNoneOf and between; omitted for isFilled and isEmpty",
                      "anyOf": [
                        {
                          "anyOf": [
                            {
                              "type": "string",
                              "maxLength": 2000
                            },
                            {
                              "type": "number"
                            },
                            {
                              "type": "boolean"
                            }
                          ]
                        },
                        {
                          "maxItems": 100,
                          "type": "array",
                          "items": {
                            "anyOf": [
                              {
                                "type": "string",
                                "maxLength": 2000
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    "ref": {
                      "description": "Reference to compare with instead of a literal value",
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    }
                  },
                  "required": [
                    "variable",
                    "operator"
                  ],
                  "additionalProperties": false
                },
                "description": "Comparisons of the condition"
              }
            },
            "required": [
              "conditions"
            ],
            "additionalProperties": false
          },
          "forEach": {
            "description": "Data to repeat over, for a loop step",
            "type": "string",
            "maxLength": 2000
          },
          "duration": {
            "description": "ISO 8601 duration, for a wait step",
            "type": "string",
            "maxLength": 60
          },
          "onError": {
            "description": "What an action does when it fails: stop the branch (default) or route to its error output",
            "type": "string",
            "enum": [
              "stop",
              "route"
            ]
          }
        },
        "required": [
          "ref",
          "uses"
        ],
        "additionalProperties": false
      }
    },
    "links": {
      "description": "Links of the draft",
      "maxItems": 500,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "ref of the source step"
          },
          "to": {
            "type": "string",
            "minLength": 1,
            "maxLength": 60,
            "description": "ref of the target step"
          },
          "on": {
            "description": "Output port: main by default; true or false for a condition; loop or done for a loop; done, rejected or timeout for an approval, a signature or an agent task; error for a step with onError route",
            "type": "string",
            "maxLength": 30
          }
        },
        "required": [
          "from",
          "to"
        ],
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
```

</details>
