# Формы

> Инструменты раздела «Формы»: 8

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

## Создать форму

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

Описание для модели: Create a form. The form is not published, publish it with publish_interface.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `title` | string | да | Title. Длина: 1–300. |
| `fields` | массив объектов | да | Fields in the order they are shown. Элементов: 1–200. |
| `fields[].label` | string | да | Caption of the field. Длина: 1–300. |
| `fields[].kind` | string | да | Kind of the field. Значения: `Текст`, `Число`, `Дата`, `Выбор`, `Флажок`, `Файл`. |
| `fields[].key` | string | нет | Key of the field, equal to the key of a registry field to fill that field. Длина: 1–100. |
| `fields[].required` | boolean | нет | The field must be filled. |
| `fields[].placeholder` | string | нет | Hint inside the empty field. Длина: до 300. |
| `fields[].options` | массив string | нет | Choices of a select field. Элементов: 1–200. |
| `description` | string | нет | Description shown to the person who fills the form. Длина: до 5000. |
| `registry_id` | string | нет | Registry that receives answers as records, fields match by key. Длина: 1–64. |
| `document_id` | string | нет | Document template filled from the answers. Длина: 1–64. |
| `success_message` | string | нет | Message shown after the form is sent. Длина: до 1000. |
| `submit_button` | string | нет | Text of the send button. Длина: до 100. |

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

```json
{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 300,
      "description": "Title"
    },
    "fields": {
      "minItems": 1,
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Caption of the field"
          },
          "kind": {
            "type": "string",
            "enum": [
              "Текст",
              "Число",
              "Дата",
              "Выбор",
              "Флажок",
              "Файл"
            ],
            "description": "Kind of the field"
          },
          "key": {
            "description": "Key of the field, equal to the key of a registry field to fill that field",
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "required": {
            "description": "The field must be filled",
            "type": "boolean"
          },
          "placeholder": {
            "description": "Hint inside the empty field",
            "type": "string",
            "maxLength": 300
          },
          "options": {
            "description": "Choices of a select field",
            "minItems": 1,
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          }
        },
        "required": [
          "label",
          "kind"
        ],
        "additionalProperties": false
      },
      "description": "Fields in the order they are shown"
    },
    "description": {
      "description": "Description shown to the person who fills the form",
      "type": "string",
      "maxLength": 5000
    },
    "registry_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Registry that receives answers as records, fields match by key"
    },
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Document template filled from the answers"
    },
    "success_message": {
      "type": "string",
      "maxLength": 1000,
      "description": "Message shown after the form is sent"
    },
    "submit_button": {
      "type": "string",
      "maxLength": 100,
      "description": "Text of the send button"
    }
  },
  "required": [
    "title",
    "fields"
  ],
  "additionalProperties": false
}
```

</details>

## Удалить форму

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

Описание для модели: Delete a form, its public link stops working. Cannot be restored.

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

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

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

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

</details>

## Карточка формы

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

Описание для модели: Get a form with its fields and publication.

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

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

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

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

</details>

## Ответ на форму

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

Описание для модели: Get one answer submitted to a form.

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

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

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

```json
{
  "type": "object",
  "properties": {
    "interface_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Interface id"
    },
    "submission_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Submission id"
    }
  },
  "required": [
    "interface_id",
    "submission_id"
  ],
  "additionalProperties": false
}
```

</details>

## Ответы на форму

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

Описание для модели: List answers submitted to a form, newest first. Answers are typed by outside people. Each answer is also a record of the registry bound to the form, change or delete it with the registry tools.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `interface_id` | string | да | Interface id. Длина: 1–64. |
| `limit` | integer | нет | Maximum number of items to return, 20 by default. По умолчанию: `20`. Диапазон: 1–100. |
| `offset` | integer | нет | Number of items to skip, for paging. По умолчанию: `0`. Диапазон: 0–9007199254740991. |

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

```json
{
  "type": "object",
  "properties": {
    "interface_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Interface id"
    },
    "limit": {
      "default": 20,
      "description": "Maximum number of items to return, 20 by default",
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "offset": {
      "default": 0,
      "description": "Number of items to skip, for paging",
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    }
  },
  "required": [
    "interface_id"
  ],
  "additionalProperties": false
}
```

</details>

## Формы и интерфейсы

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

Описание для модели: List forms, optionally matching a text.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `query` | string | нет | Words from the title or the description. Длина: 1–200. |
| `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 title or the description",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "limit": {
      "default": 50,
      "description": "Maximum number of items to return, 50 by default",
      "type": "integer",
      "minimum": 1,
      "maximum": 200
    }
  },
  "additionalProperties": false
}
```

</details>

## Опубликовать форму

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

Описание для модели: Publish a form on a channel or take the publication down. A published form is open to anyone with the link. The result carries the public path and the form token for send_telegram_form.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `interface_id` | string | да | Interface id. Длина: 1–64. |
| `channel` | string | нет | Channel, a web page by default. Значения: `Веб-страница`, `Встраивание на сайт`, `Telegram`, `API`. |
| `published` | boolean | нет | False takes the publication down, true by default. |

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

```json
{
  "type": "object",
  "properties": {
    "interface_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Interface id"
    },
    "channel": {
      "type": "string",
      "enum": [
        "Веб-страница",
        "Встраивание на сайт",
        "Telegram",
        "API"
      ],
      "description": "Channel, a web page by default"
    },
    "published": {
      "description": "False takes the publication down, true by default",
      "type": "boolean"
    }
  },
  "required": [
    "interface_id"
  ],
  "additionalProperties": false
}
```

</details>

## Изменить форму

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

Описание для модели: Update the title, fields or links of a form. Pass only what changes. fields replaces the whole set of fields, so pass every field that must stay. List links to drop in unlink.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `interface_id` | string | да | Interface id. Длина: 1–64. |
| `title` | string | нет | New title. Длина: 1–300. |
| `description` | string | нет | New description. Длина: до 5000. |
| `fields` | массив объектов | нет | New full set of fields. Элементов: 1–200. |
| `fields[].label` | string | да | Caption of the field. Длина: 1–300. |
| `fields[].kind` | string | да | Kind of the field. Значения: `Текст`, `Число`, `Дата`, `Выбор`, `Флажок`, `Файл`. |
| `fields[].key` | string | нет | Key of the field, equal to the key of a registry field to fill that field. Длина: 1–100. |
| `fields[].required` | boolean | нет | The field must be filled. |
| `fields[].placeholder` | string | нет | Hint inside the empty field. Длина: до 300. |
| `fields[].options` | массив string | нет | Choices of a select field. Элементов: 1–200. |
| `registry_id` | string | нет | Registry that receives answers as records, fields match by key. Длина: 1–64. |
| `document_id` | string | нет | Document template filled from the answers. Длина: 1–64. |
| `success_message` | string | нет | Message shown after the form is sent. Длина: до 1000. |
| `submit_button` | string | нет | Text of the send button. Длина: до 100. |
| `unlink` | массив string | нет | Links to drop. Элементов: от 1. |

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

```json
{
  "type": "object",
  "properties": {
    "interface_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Interface id"
    },
    "title": {
      "description": "New title",
      "type": "string",
      "minLength": 1,
      "maxLength": 300
    },
    "description": {
      "description": "New description",
      "type": "string",
      "maxLength": 5000
    },
    "fields": {
      "description": "New full set of fields",
      "minItems": 1,
      "maxItems": 200,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300,
            "description": "Caption of the field"
          },
          "kind": {
            "type": "string",
            "enum": [
              "Текст",
              "Число",
              "Дата",
              "Выбор",
              "Флажок",
              "Файл"
            ],
            "description": "Kind of the field"
          },
          "key": {
            "description": "Key of the field, equal to the key of a registry field to fill that field",
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "required": {
            "description": "The field must be filled",
            "type": "boolean"
          },
          "placeholder": {
            "description": "Hint inside the empty field",
            "type": "string",
            "maxLength": 300
          },
          "options": {
            "description": "Choices of a select field",
            "minItems": 1,
            "maxItems": 200,
            "type": "array",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            }
          }
        },
        "required": [
          "label",
          "kind"
        ],
        "additionalProperties": false
      }
    },
    "registry_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Registry that receives answers as records, fields match by key"
    },
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Document template filled from the answers"
    },
    "success_message": {
      "type": "string",
      "maxLength": 1000,
      "description": "Message shown after the form is sent"
    },
    "submit_button": {
      "type": "string",
      "maxLength": 100,
      "description": "Text of the send button"
    },
    "unlink": {
      "description": "Links to drop",
      "minItems": 1,
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "registry",
          "document"
        ]
      }
    }
  },
  "required": [
    "interface_id"
  ],
  "additionalProperties": false
}
```

</details>
