# СБИС

> Инструменты раздела «СБИС»: 16

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

## Добавить файл в документ СБИС

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

Описание для модели: Add a file of the working folder to an SBIS draft document.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `document_id` | string | да | Id of the SBIS document. Длина: 1–100. |
| `path` | string | да | Path of the file in the working folder. Длина: 1–1000. |

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

```json
{
  "type": "object",
  "properties": {
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the SBIS document"
    },
    "path": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1000,
      "description": "Path of the file in the working folder"
    }
  },
  "required": [
    "document_id",
    "path"
  ],
  "additionalProperties": false
}
```

</details>

## Аннулировать документ в СБИС

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

Описание для модели: Offer to annul a signed SBIS document. The counterparty has to accept the annulment in SBIS.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `document_id` | string | да | Id of the SBIS document. Длина: 1–100. |
| `reason` | string | да | Reason of the annulment. Длина: 1–2000. |

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

```json
{
  "type": "object",
  "properties": {
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the SBIS document"
    },
    "reason": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "description": "Reason of the annulment"
    }
  },
  "required": [
    "document_id",
    "reason"
  ],
  "additionalProperties": false
}
```

</details>

## Подготовить документ в СБИС

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

Описание для модели: Create an outgoing SBIS document with files, not sent yet. Files come from the working folder. The document stays a draft until it is sent with execute_saby_action.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `kind` | string | да | Kind of the document. Значения: `Документ реализации`, `Договор`, `Счёт`, `Счёт-фактура`, `Акт сверки`, `Корректировочный документ`, `Заказ`. |
| `organization_inn` | string | да | Tax number of the own organization. |
| `organization_kpp` | string | нет | KPP of the own organization. |
| `counterparty_inn` | string | да | Tax number of the counterparty. |
| `counterparty_kpp` | string | нет | KPP of the counterparty. |
| `counterparty_name` | string | нет | Name of the counterparty. Длина: 1–500. |
| `number` | string | нет | Number of the document. Длина: 1–100. |
| `date` | string | нет | Date of the document, YYYY-MM-DD. |
| `sum` | number | нет | Sum of the document in rubles. Диапазон: от 0. |
| `comment` | string | нет | Comment for the counterparty. Длина: 1–2000. |
| `files` | массив string | да | Paths of files in the working folder. Элементов: 1–20. |

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

```json
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "Документ реализации",
        "Договор",
        "Счёт",
        "Счёт-фактура",
        "Акт сверки",
        "Корректировочный документ",
        "Заказ"
      ],
      "description": "Kind of the document"
    },
    "organization_inn": {
      "type": "string",
      "pattern": "^\\d{10}(\\d{2})?$",
      "description": "Tax number of the own organization"
    },
    "organization_kpp": {
      "description": "KPP of the own organization",
      "type": "string",
      "pattern": "^\\d{9}$"
    },
    "counterparty_inn": {
      "type": "string",
      "pattern": "^\\d{10}(\\d{2})?$",
      "description": "Tax number of the counterparty"
    },
    "counterparty_kpp": {
      "description": "KPP of the counterparty",
      "type": "string",
      "pattern": "^\\d{9}$"
    },
    "counterparty_name": {
      "description": "Name of the counterparty",
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    },
    "number": {
      "description": "Number of the document",
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "date": {
      "description": "Date of the document, YYYY-MM-DD",
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "sum": {
      "description": "Sum of the document in rubles",
      "type": "number",
      "minimum": 0
    },
    "comment": {
      "description": "Comment for the counterparty",
      "type": "string",
      "minLength": 1,
      "maxLength": 2000
    },
    "files": {
      "minItems": 1,
      "maxItems": 20,
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 1000
      },
      "description": "Paths of files in the working folder"
    }
  },
  "required": [
    "kind",
    "organization_inn",
    "counterparty_inn",
    "files"
  ],
  "additionalProperties": false
}
```

</details>

## Удалить документ в СБИС

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

Описание для модели: Move an SBIS document to deleted, it can be restored.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `document_id` | string | да | Id of the SBIS document. Длина: 1–100. |

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

```json
{
  "type": "object",
  "properties": {
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the SBIS document"
    }
  },
  "required": [
    "document_id"
  ],
  "additionalProperties": false
}
```

</details>

## Скачать вложение СБИС

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

Описание для модели: Download an attachment of an SBIS document. stamped gives the PDF with the stamp of electronic signatures when SBIS has it.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `document_id` | string | да | Id of the SBIS document. Длина: 1–100. |
| `attachment_id` | string | да | Id of the attachment from get_saby_document. Длина: 1–100. |
| `stamped` | boolean | нет | True downloads the PDF with signature stamps. |

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

```json
{
  "type": "object",
  "properties": {
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the SBIS document"
    },
    "attachment_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the attachment from get_saby_document"
    },
    "stamped": {
      "description": "True downloads the PDF with signature stamps",
      "type": "boolean"
    }
  },
  "required": [
    "document_id",
    "attachment_id"
  ],
  "additionalProperties": false
}
```

</details>

## Выполнить действие в СБИС

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

Описание для модели: Sign, send or approve an SBIS document. Take the action from get_saby_document and the certificate from list_saby_certificates. Signing works with cloud certificates only, other certificates are used by the user in SBIS.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `document_id` | string | да | Id of the SBIS document. Длина: 1–100. |
| `action` | string | да | Name of the action from get_saby_document. Длина: 1–200. |
| `certificate` | string | нет | Thumbprint of a cloud certificate. Длина: 1–200. |

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

```json
{
  "type": "object",
  "properties": {
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the SBIS document"
    },
    "action": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Name of the action from get_saby_document"
    },
    "certificate": {
      "description": "Thumbprint of a cloud certificate",
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    }
  },
  "required": [
    "document_id",
    "action"
  ],
  "additionalProperties": false
}
```

</details>

## Контрагенты СБИС

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

Описание для модели: Find counterparties in SBIS by tax number or name.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `query` | string | да | Tax number or name. Длина: 1–200. |

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

```json
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Tax number or name"
    }
  },
  "required": [
    "query"
  ],
  "additionalProperties": false
}
```

</details>

## Сведения о контрагенте в СБИС

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

Описание для модели: Get SBIS details of a counterparty and its EDO connection. The details come from SBIS as is, the edo part tells whether documents can be exchanged electronically.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `inn` | string | да | Tax number of the counterparty. |
| `kpp` | string | нет | KPP of a branch. |

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

```json
{
  "type": "object",
  "properties": {
    "inn": {
      "type": "string",
      "pattern": "^\\d{10}(\\d{2})?$",
      "description": "Tax number of the counterparty"
    },
    "kpp": {
      "description": "KPP of a branch",
      "type": "string",
      "pattern": "^\\d{9}$"
    }
  },
  "required": [
    "inn"
  ],
  "additionalProperties": false
}
```

</details>

## Документ СБИС

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

Описание для модели: Get an SBIS document with attachments and available actions. actions lists what can be done with the document now, pass one of them to execute_saby_action.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `document_id` | string | да | Id of the SBIS document. Длина: 1–100. |

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

```json
{
  "type": "object",
  "properties": {
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the SBIS document"
    }
  },
  "required": [
    "document_id"
  ],
  "additionalProperties": false
}
```

</details>

## Пригласить контрагента в ЭДО

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

Описание для модели: Invite a counterparty to document exchange in SBIS.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `inn` | string | да | Tax number of the counterparty. |
| `kpp` | string | нет | KPP of a company. |
| `name` | string | нет | Name of the company or full name of a person. Длина: 1–500. |

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

```json
{
  "type": "object",
  "properties": {
    "inn": {
      "type": "string",
      "pattern": "^\\d{10}(\\d{2})?$",
      "description": "Tax number of the counterparty"
    },
    "kpp": {
      "description": "KPP of a company",
      "type": "string",
      "pattern": "^\\d{9}$"
    },
    "name": {
      "description": "Name of the company or full name of a person",
      "type": "string",
      "minLength": 1,
      "maxLength": 500
    }
  },
  "required": [
    "inn"
  ],
  "additionalProperties": false
}
```

</details>

## Сертификаты подписи в СБИС

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

Описание для модели: List electronic signature certificates available in SBIS.

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

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

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

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

</details>

## Документы СБИС

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

Описание для модели: List incoming or outgoing SBIS documents by event date. Shows documents as the SBIS registry does. Pages start from 0, when next_page is set ask for it.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `section` | string | да | Section of the registry. Значения: `Входящие`, `Исходящие`, `Ответы контрагентов`. |
| `from` | string | нет | First date of events, YYYY-MM-DD. |
| `to` | string | нет | Last date of events, YYYY-MM-DD. |
| `page` | integer | нет | Page number from 0. По умолчанию: `0`. Диапазон: 0–9007199254740991. |
| `page_size` | integer | нет | Documents on a page. По умолчанию: `25`. Диапазон: 1–200. |

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

```json
{
  "type": "object",
  "properties": {
    "section": {
      "type": "string",
      "enum": [
        "Входящие",
        "Исходящие",
        "Ответы контрагентов"
      ],
      "description": "Section of the registry"
    },
    "from": {
      "description": "First date of events, YYYY-MM-DD",
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "to": {
      "description": "Last date of events, YYYY-MM-DD",
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "page": {
      "default": 0,
      "description": "Page number from 0",
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "page_size": {
      "default": 25,
      "description": "Documents on a page",
      "type": "integer",
      "minimum": 1,
      "maximum": 200
    }
  },
  "required": [
    "section"
  ],
  "additionalProperties": false
}
```

</details>

## Организации в СБИС

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

Описание для модели: List own organizations connected to SBIS.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `refresh` | boolean | нет | True reads the list from SBIS again instead of the saved one. |

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

```json
{
  "type": "object",
  "properties": {
    "refresh": {
      "description": "True reads the list from SBIS again instead of the saved one",
      "type": "boolean"
    }
  },
  "additionalProperties": false
}
```

</details>

## Отклонить документ в СБИС

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

Описание для модели: Reject an incoming SBIS document with a reason.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `document_id` | string | да | Id of the SBIS document. Длина: 1–100. |
| `reason` | string | да | Reason shown to the counterparty. Длина: 1–2000. |

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

```json
{
  "type": "object",
  "properties": {
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the SBIS document"
    },
    "reason": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "description": "Reason shown to the counterparty"
    }
  },
  "required": [
    "document_id",
    "reason"
  ],
  "additionalProperties": false
}
```

</details>

## Восстановить документ в СБИС

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

Описание для модели: Restore a deleted SBIS document.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `document_id` | string | да | Id of the SBIS document. Длина: 1–100. |

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

```json
{
  "type": "object",
  "properties": {
    "document_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100,
      "description": "Id of the SBIS document"
    }
  },
  "required": [
    "document_id"
  ],
  "additionalProperties": false
}
```

</details>

## Поиск документов СБИС

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

Описание для модели: Search SBIS documents by kind, direction and document date.

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

| Параметр | Тип | Обязательный | Описание |
| --- | --- | --- | --- |
| `kind` | string | да | Kind of documents. Значения: `Документ реализации`, `Договор`, `Счёт`, `Счёт-фактура`, `Акт сверки`, `Корректировочный документ`, `Заказ`. |
| `direction` | string | да | Direction of documents. Значения: `Входящий`, `Исходящий`. |
| `from` | string | нет | First document date, YYYY-MM-DD. |
| `to` | string | нет | Last document date, YYYY-MM-DD. |
| `page` | integer | нет | Page number from 0. По умолчанию: `0`. Диапазон: 0–9007199254740991. |
| `page_size` | integer | нет | Documents on a page. По умолчанию: `25`. Диапазон: 1–200. |

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

```json
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "Документ реализации",
        "Договор",
        "Счёт",
        "Счёт-фактура",
        "Акт сверки",
        "Корректировочный документ",
        "Заказ"
      ],
      "description": "Kind of documents"
    },
    "direction": {
      "type": "string",
      "enum": [
        "Входящий",
        "Исходящий"
      ],
      "description": "Direction of documents"
    },
    "from": {
      "description": "First document date, YYYY-MM-DD",
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "to": {
      "description": "Last document date, YYYY-MM-DD",
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
    },
    "page": {
      "default": 0,
      "description": "Page number from 0",
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "page_size": {
      "default": 25,
      "description": "Documents on a page",
      "type": "integer",
      "minimum": 1,
      "maximum": 200
    }
  },
  "required": [
    "kind",
    "direction"
  ],
  "additionalProperties": false
}
```

</details>
