# Методы Trivio MCP

> Всё, что ассистент может сделать в Trivio от вашего имени: что он читает, что меняет и где остановится и спросит вас.

35 методов в каталоге · 21 только читают данные · 14 в 7 действиях с подтверждением

- Страница подключения: `https://mcp.trivio.ru/`
- llms.txt для ИИ-агентов: `https://mcp.trivio.ru/llms.txt`

## Как работают действия

Без вашего «да» ничего не меняется.

1. **Ассистент готовит.** Проверяет правила, документы и бюджет, показывает итог и цену. На этом шаге ничего не сохраняется.
2. **Вы подтверждаете.** Отвечаете в чате, что согласны.
3. **Действие выполняется.** Один раз и ровно так, как вы видели. Если цена изменилась, ассистент спросит ещё раз.

Так работают создание поездки, сохранение профиля сотрудника, сохранение документа сотрудника, сохранение карты сотрудника, сохранение периода отсутствия, бронирование рейса и выписка билета. Остальные методы только читают данные.

## Рабочие цепочки

- **Найти и забронировать перелёт** — «Нужно в Петербург в среду, обратно в пятницу, с багажом»: `avia_search` → `avia_query_offers` → `avia_get_brands` → `avia_prepare_booking` → *ваше «да»* → `avia_confirm_booking`
- **Оформить командировку** — «Подготовь командировку в Казань для меня и Иванова»: `trip_prepare` → `employee_search` → `trip_search_field_values` → *ваше «да»* → `trip_confirm`
- **Выписать билет по брони** — «По каким броням горит тайм-лимит? Выпиши билет в Казань»: `desktop_summary` → `trip_get` → `avia_prepare_issue` → *ваше «да»* → `avia_confirm_issue`
- **Разобрать поездку и расходы** — «Сколько удержат за возврат билета и что с моим авансовым отчётом?»: `trip_list` → `trip_get` → `trip_service_get` → `advance_report_get`

## Профиль и компании

Ваш профиль, роль, компании, выбор рабочей компании, тревел-политики и суточные.

На экране согласия: «Чтение».

### Профиль и роль — `context_get`

Показывает ваш профиль, компанию, роль и то, что вам доступно.

- Спросите в чате: Кто я в Trivio и что мне здесь доступно?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: напрямую
- Параметры: нет
- Примеры вызова:
  - Verify caller context at conversation start: `{}`

### Рабочая компания — `company_select`

Показывает ваши компании и переключает рабочую для текущего диалога.

- Спросите в чате: Переключись на компанию «Альфа Логистик».
- Важно: Переключение действует только в этом диалоге.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: напрямую
- Параметры:
  - `company_id` (integer): Target company identifier (`>= 1`) to set as active in this dialog. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `query` (string): Substring query (`3..=120` chars, excluding bare legal forms) to filter or search companies.
- Примеры вызова:
  - Search accessible companies by name: `{"query": "Alpha"}`
  - Switch active dialog company by ID: `{"company_id": 10}`

### Тревел-политика и суточные — `policy_get`

Показывает, какие тревел-политики и суточные действуют для вас или вашего сотрудника.

- Спросите в чате: Какой у меня лимит на перелёт и какие суточные в Казани?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the active dialog company for this lookup. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `include_custom_rules` (boolean): Include corporate custom text travel policy rules (`custom_rules`), default `true`.
  - `include_daily_allowances` (boolean): Include corporate daily allowance rates (`daily_allowances`), default `true`.
  - `policies_offset` (integer): Zero-based pagination offset across loaded policies when a catalog exceeds 10 policies (default `0`). Pass `next_policies_offset` when `policies_has_more=true`.
  - `rule_query` (string): Optional case-insensitive filter (`1..=80` chars) matching policy rule codes/settings, daily allowances or excepted countries, custom rules, and taxi country overrides when output is truncated or a focused lookup is needed.
  - `rules_limit` (integer): Maximum number of rules returned per policy per page (`1..=50`, default `20`).
  - `rules_offset` (integer): Zero-based pagination offset into each policy's filtered rules list (default `0`). Pass the returned `next_rules_offset` when rules are truncated.
  - `scope` (enum): Scope of lookup: `effective` (default) returns ONLY the active travel policies and applicable daily allowances resolved for the current employee (or permitted `user_id`) via profile -> primary department -> company default; `company_catalog` (coordinators/managers only, cannot be combined with `user_id`) returns all travel policies and daily allowances configured in the active company. — `effective`, `company_catalog`
  - `service_type` (enum): Optional service category filter (`all`, `avia`, `hotel`, `train`, `rail`, `taxi`, `transfer`, `vip_hall`, `car_rental`, `aeroexpress`, or `bus`, default `all`). — `all`, `avia`, `hotel`, `train`, `rail`, `taxi`, `transfer`, `vip_hall`, `car_rental`, `aeroexpress`, `bus`
  - `user_id` (integer): Target employee user identifier (`>= 1`) to inspect effective policies for a specific traveler (regular employees may only inspect themselves; coordinators may inspect permitted colleagues). Pass only a `user_id` explicitly provided by the user or returned by `context_get` or `employee_search` in this conversation; never guess or reuse IDs from other conversations.
  - `values_offset` (integer): Zero-based pagination offset into long city/region/country lists inside rule settings such as `regionIdRL` or `countryCodeRL` (page size `25`, default `0`). Pass the returned `next_values_offset` when `list_values_has_more=true`.
- Примеры вызова:
  - Read effective flight travel policy for current user: `{"scope": "effective", "service_type": "avia"}`
  - Search colleague hotel rules and per diem for Moscow: `{"scope": "effective", "user_id": 20011, "service_type": "hotel", "rule_query": "Moscow", "include_daily_allowances": true, "include_custom_rules": true}`
  - List company-wide policy catalog (coordinators only): `{"scope": "company_catalog", "policies_offset": 0, "rules_limit": 20}`

**Руководство для модели**

```text
Reads active corporate travel policies, taxi restrictions, custom text guidelines, and daily allowance (per diem) rates.
Workflow:
1. Default `scope = "effective"` returns ONLY the active travel policies and applicable daily allowances resolved for the current employee (or a permitted colleague via `user_id`) following `profile -> primary department -> company default`.
2. Pass `scope = "company_catalog"` ONLY when explicitly asked to list all policies configured across the active company (coordinators/managers only; cannot be combined with `user_id`).
3. Narrow large policies before paginating: use `service_type` (`avia`, `hotel`, `train`, `rail`, `taxi`, `transfer`, `vip_hall`, `car_rental`, `aeroexpress`, `bus`) and `rule_query` (case-insensitive substring match across rule codes, city/region/country caps, daily allowances, custom text rules, and taxi country overrides).
4. Pagination: check `policies_has_more` (`policies_offset`), rules truncation (`rules_offset`, `rules_limit` 1..=50), and long list values (`values_offset`). Never claim a truncated rule list is complete.
5. Reporting requirement: always state the target employee, primary department, exact policy names, violation modes, and assignment source (profile, primary department, or company default).
```

## Поездки

Чтение поездок, услуг, согласований и авансовых отчётов, подготовка и сохранение поездки по подтверждению.

На экране согласия: «Чтение» или «Действия».

### Список поездок — `trip_list`

Находит поездки по датам, пассажиру, номеру брони или билета.

- Спросите в чате: Какие поездки у меня запланированы в этом месяце?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: напрямую
- Параметры:
  - `advance_report_not_submitted` (boolean): Return only trips with an unsubmitted advance report (available when `context_get` reports `enable_filter_ao_completed=true`).
  - `analytic_id` (integer): Corporate analytic category identifier (`>= 1`) from `trip_search_field_values`. Must be paired with `analytic_value` in a concrete company; never guess IDs or reuse IDs from other conversations.
  - `analytic_value` (string): Analytic value substring (`2..=120` chars, at least 2 non-quote chars). Must be paired with `analytic_id`.
  - `approval_filter` (enum): Filter by order approval progress (`in_progress` or `required`). — `in_progress`, `required`
  - `author_id` (integer): Trip author user identifier (`>= 1`). Pass only an `author_id` returned by `context_get`, `employee_search`, or another tool in this conversation; never guess or fabricate IDs.
  - `booking_ref` (string): Booking reference / PNR substring (`2..=40` chars, automatically uppercased).
  - `city_id` (integer): Destination city identifier (`>= 1`) from `trip_search_field_values`. Pass only a `city_id` returned by `trip_search_field_values`, `context_get`, or another tool in this conversation; never guess or reuse IDs from other conversations.
  - `company_id` (integer): Target company identifier (`>= 1`) overriding dialog active company for this lookup. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `company_name` (string): Substring query (`2..=120` chars) matching company name (useful in holding overview).
  - `created_date_from` (string): Filter trips created from calendar date (`YYYY-MM-DD`); includes empty drafts.
  - `created_date_to` (string): Filter trips created up to calendar date (`YYYY-MM-DD`); includes empty drafts.
  - `cursor_before_order_id` (integer): Cursor pagination marker: return orders strictly older than this `order_id` (`>= 1`). Pass only the exact cursor returned by the preceding `trip_list` call in this conversation; never fabricate or reuse cursors across conversations.
  - `exclude_drafts` (boolean): Exclude draft-only orders.
  - `flight_number` (string): Flight number substring (`2..=20` chars, e.g. `SU100`); hides empty drafts.
  - `limit` (integer): Maximum number of trips to return (`1..=15`, default `15`).
  - `only_my` (boolean): Return only trips created or participated in by the current user. Set true when the caller asks specifically for their own trips (especially for coordinators and managers who otherwise see all company or holding trips).
  - `order_id` (integer): Exact trip order identifier (`>= 1`). Pass only an `order_id` explicitly provided by the user or returned by a tool in this conversation; never guess or reuse IDs from other conversations.
  - `passenger_name` (string): Passenger full-name substring (`2..=120` chars, at least 2 non-whitespace chars).
  - `passenger_user_id` (integer): Filter by passenger user identifier (`>= 1`). Pass only a `user_id` returned by `context_get`, `employee_search`, or another tool in this conversation; never guess or fabricate IDs.
  - `query_title` (string): Substring query (`2..=120` chars) matching trip title/description.
  - `segment_departure` (string): Exact flight segment departure calendar date (`YYYY-MM-DD`) for avia services; hides empty drafts.
  - `service_id` (integer): Exact service identifier (`>= 1`) within an order (hides empty drafts). Pass only a `service_id` explicitly provided by the user or returned by a tool in this conversation; never guess or fabricate IDs.
  - `service_status` (enum): Filter by non-zero service status. — `reserved`, `ticketed`, `annulled`, `cancel_requested`, `cancelled`, `issuing`, `manual_check`, `exchanged`, `deleted`, `expired`, `cancelling`, `reserving`, `exchanging`
  - `service_type` (enum): Filter by service category. — `avia`, `hotel`, `transfer`, `train`, `aeroexpress`, `arbitrary`, `tour`, `visa`, `event`, `invitation`, `bus`, `insurance`, `taxi`, `business_travel_pass`, `vip_hall`, `car_rental`, `avia_insurance`
  - `ticket_number` (string): Issued ticket number substring (`3..=40` chars).
  - `trip_date_from` (string): Filter services from departure or check-in date (`YYYY-MM-DD`); hides empty drafts.
  - `trip_date_to` (string): Filter services up to departure or return date (`YYYY-MM-DD`); hides empty drafts.
- Примеры вызова:
  - List caller's non-draft trips: `{"only_my": true, "exclude_drafts": true, "limit": 10}`
  - Find a trip by PNR booking reference: `{"booking_ref": "AB12CD", "service_type": "avia"}`

### Карточка поездки — `trip_get`

Показывает поездку целиком: бюджет, шаги согласования и услуги.

- Спросите в чате: Покажи детали моей ближайшей поездки.
- Важно: Номера документов приходят замаскированными.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: напрямую
- Параметры:
  - `order_id` (integer, обязательный): Trip order identifier (`>= 1`) to inspect. Pass only an `order_id` explicitly provided by the user or returned by `trip_list` in this conversation; never guess or reuse IDs from other conversations.
  - `active_services_only` (boolean): Set `true` when the user asks for active/non-cancelled services only (excludes cancelled, annulled, deleted, expired, and exchanged services).
  - `passenger_name` (string): Case-insensitive substring query (`2..=120` chars) matching passenger full name on each service.
  - `service_status` (enum): Filter services by non-zero booking status. — `reserved`, `ticketed`, `annulled`, `cancel_requested`, `cancelled`, `issuing`, `manual_check`, `exchanged`, `deleted`, `expired`, `cancelling`, `reserving`, `exchanging`
  - `service_type` (enum): Filter services by category (`train` covers both domestic and European rail). — `avia`, `hotel`, `transfer`, `train`, `aeroexpress`, `arbitrary`, `tour`, `visa`, `event`, `invitation`, `bus`, `insurance`, `taxi`, `business_travel_pass`, `vip_hall`, `car_rental`, `avia_insurance`
  - `services_limit` (integer): Maximum number of services to return per page (`1..=50`, default `20`).
  - `services_offset` (integer): Zero-based pagination offset for the filtered service list (default `0`).
- Примеры вызова:
  - Inspect active services in a trip order: `{"order_id": 26695, "active_services_only": true, "services_limit": 20}`

### Детали услуги — `trip_service_get`

Раскрывает услугу в поездке: из чего складывается цена, сегменты, багаж, штрафы за возврат.

- Спросите в чате: Сколько я потеряю, если сдам билет в Казань?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `order_id` (integer, обязательный): Trip order identifier (`>= 1`). Pass only an `order_id` explicitly provided by the user or returned by `trip_list` or `trip_get` in this conversation; never guess or reuse IDs from other conversations.
  - `service_ids` (integer[], обязательный): List of 1 to 5 service identifiers (`>= 1` each) within the order to inspect in detail. Pass only exact `service_id` values returned by `trip_get` for this `order_id`; never guess or reuse service IDs from other orders or conversations.
  - `fare_rules_offset_chars` (integer): Zero-based character offset (`0..=128000`) for paginating long post-booking fare rule texts (page size `4000` chars) when `include_fare_rules=true`.
  - `fare_rules_section` (enum): Section of post-booking avia fare rules to return when `include_fare_rules=true`: `penalties` (default), `restrictions`, or `full`. — `penalties`, `restrictions`, `full`
  - `include_fare_rules` (boolean): Fetch post-booking airline fare rules (`avia.tarif`, `serviceId > 0`) for non-arbitrary avia services in `service_ids`. Default `false` to keep normal detail calls fast.
- Примеры вызова:
  - Inspect booked service pricing and post-booking fare rules: `{"order_id": 26695, "service_ids": [8550866], "include_fare_rules": true, "fare_rules_section": "penalties"}`

### Что требует внимания — `desktop_summary`

Собирает то, что ждёт вашего решения: согласования, брони с истекающим тайм-лимитом и запросы на отмену.

- Спросите в чате: Что ждёт моего согласования и по каким броням горит тайм-лимит?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the active dialog company for this lookup. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `limit` (integer): Maximum number of items returned per section (`1..=50`, default `15`).
  - `offset` (integer): Zero-based pagination offset into each requested queue (`trip_approvals`, `expense_approvals`, `deadlines`, `cancel_requests`, default `0`). Pass `next_offset` when `has_more=true`.
  - `section` (enum): Operational section to inspect (`all`, `approvals`, `deadlines`, or `cancel_requests`, default `all`). — `all`, `approvals`, `deadlines`, `cancel_requests`
- Примеры вызова:
  - Load all operational queues for today: `{"section": "all", "limit": 15}`

### Авансовые отчёты — `advance_report_list`

Находит авансовые отчёты: ваши и те, что ждут вашего согласования.

- Спросите в чате: Покажи мои авансовые отчёты за ноябрь.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `author_id` (integer): Report creator user identifier (`>= 1`). Pass only an `author_id` returned by `context_get`, `employee_search`, or another tool in this conversation; never guess or reuse IDs from other conversations.
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the active dialog company for this lookup. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `created_date_from` (string): Filter reports created from calendar date (`YYYY-MM-DD`).
  - `created_date_to` (string): Filter reports created up to calendar date (`YYYY-MM-DD`).
  - `cursor_from_id` (integer): Cursor pagination marker (`>= 1`) from the preceding `advance_report_list` response. Pass only the exact `next_cursor_from_id` returned in this conversation; never fabricate or reuse cursors across conversations.
  - `limit` (integer): Maximum number of advance reports to return (`1..=15`, default `15`).
  - `needs_approval` (boolean): Return only advance reports currently awaiting the caller's approval.
  - `on_approval` (boolean): Return only advance reports currently in approval workflow.
  - `only_mine` (boolean): Return only advance reports belonging to the current user.
  - `order_date_from` (string): Filter reports by trip/expense period start date (`YYYY-MM-DD`).
  - `order_date_to` (string): Filter reports by trip/expense period end date (`YYYY-MM-DD`).
  - `order_id` (integer): Filter in-trip advance reports by exact business trip order identifier (`>= 1`; `core` excludes standalone without-trip reports when `order_id` is set — use `order_passenger_id` to find a standalone report in the list or pass its `order_id` directly to `advance_report_get`). Pass only an `order_id` explicitly provided by the user or returned by a tool in this conversation; never guess or reuse IDs from other conversations.
  - `order_passenger_id` (integer): Filter by exact advance report passenger record identifier (`>= 1`). Pass only an `order_passenger_id` returned by `advance_report_list` or `desktop_summary` in this conversation; never guess or reuse IDs from other conversations.
  - `passenger_name` (string): Employee full-name substring (`2..=120` chars, at least 2 non-whitespace chars).
  - `query_purpose` (string): Substring query (`2..=120` chars) matching standalone report purpose (`aim`).
  - `query_title` (string): Substring query (`2..=120` chars) matching report title.
  - `report_number` (string): Substring query (`1..=120` chars) matching advance report string number.
  - `user_id` (integer): Filter by employee user identifier (`>= 1`). Pass only a `user_id` explicitly provided by the user or returned by `context_get` or `employee_search` in this conversation; never guess or reuse IDs from other conversations.
- Примеры вызова:
  - List advance reports awaiting approval: `{"needs_approval": true, "limit": 10}`

### Авансовый отчёт — `advance_report_get`

Показывает отчёт по поездке: суточные, расходы, чеки и итог к выплате или возврату.

- Спросите в чате: Сколько мне должны по отчёту за поездку в Казань?
- Важно: Чеки показываются списком, сами файлы ассистент не получает.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `order_id` (integer, обязательный): Trip or standalone advance report order identifier (`>= 1`). Pass only an `order_id` explicitly provided by the user or returned by `advance_report_list`, `trip_list`, `trip_get`, or `desktop_summary` in this conversation; never guess or reuse IDs from other conversations.
  - `expense_type` (enum): Optional expense row category filter (`all`, `daily`, `prepayment`, or `expenses`, default `all`). Currency totals still reflect all items in the report. — `all`, `daily`, `prepayment`, `expenses`
  - `limit` (integer): Maximum number of expense rows to return per page (`1..=50`, default `30`).
  - `offset` (integer): Zero-based pagination offset for the filtered expense rows (default `0`). Pass `next_expenses_offset` when `expenses_has_more=true`.
  - `receipts_offset` (integer): Zero-based pagination offset for attached receipt metadata (page size `30`, default `0`). Pass `next_receipts_offset` when `receipts_has_more=true`.
  - `user_id` (integer): Optional employee user identifier (`>= 1`) when inspecting a multi-passenger trip's expenses. Pass only a `user_id` explicitly provided by the user or returned by `context_get`, `employee_search`, or `trip_get` in this conversation; never guess or reuse IDs from other conversations.
  - `without_trip` (boolean): Set `true` for standalone advance reports without a trip or `false` for trip expenses; omit to auto-detect.
- Примеры вызова:
  - Read itemized advance report expenses and totals: `{"order_id": 26695, "expense_type": "all", "limit": 30}`

### Справочники для поездки — `trip_search_field_values`

Подбирает значения для полей поездки: города, страны, центры затрат, способы оплаты.

- Спросите в чате: На какой центр затрат можно оформить эту поездку?
- Важно: Номера карт оплаты приходят замаскированными.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `field_kind` (enum, обязательный): Reference dictionary category to search. — `city`, `country`, `analytic`, `organisation`, `transport_payment`, `accommodation_payment`, `weekend_reason`, `payment_card`
  - `analytic_id` (integer): Cost center analytic identifier (`>= 1`, required when `field_kind` is `analytic`). Pass only an `analytic_id` returned by `trip_prepare` in this conversation; never guess IDs.
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the active dialog company. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess IDs.
  - `contact_person_id` (integer): Contact person user identifier (`>= 1`, optional when `field_kind` is `payment_card`). Pass only a `user_id` returned by `context_get` or `employee_search` in this conversation; never guess IDs.
  - `limit` (integer): Maximum number of options to return (`1..=25`, default `15`).
  - `query` (string): Search substring (`>= 2` chars required for `city`; optional for other categories, max 120 chars).
- Примеры вызова:
  - Find destination city ID: `{"field_kind": "city", "query": "Kazan", "limit": 10}`
  - Search cost center values for an analytic: `{"field_kind": "analytic", "analytic_id": 12, "query": "Sales", "limit": 15}`

### Создание поездки — два шага

Пока вы не подтвердили шаг 2, ничего не сохраняется, не бронируется и не списывается.

#### Шаг 1 · проверка: Подготовка поездки — `trip_prepare`

Проверяет, чего не хватает для создания поездки, и собирает черновик.

- Спросите в чате: Подготовь командировку в Казань на следующую неделю.
- Важно: Ничего не сохраняет.
- Доступ: `mcp:prepare` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_prepare`
- Параметры:
  - `allow_weekend_booking` (boolean): Allow staying over the nearest weekend before or after the approved trip dates when company pre-approval enables this option.
  - `analytics` (object[]): Cost center / analytic values to set or update on this draft (merged by `analytic_id`).
  - `analytics[].analytic_id` (integer, обязательный): Analytic identifier (`>= 1`). Pass only an `analytic_id` returned by `trip_prepare` in this conversation; never guess or reuse IDs from other conversations.
  - `analytics[].value` (string): String value (`1..=255` chars) for free-text analytics or label of a selected list value.
  - `analytics[].value_id` (integer): Selected list option identifier (`>= 1`) for list-type analytics. Pass only a `value_id` returned by `trip_prepare` or `trip_search_field_values(field_kind="analytic")` in this conversation; never guess IDs.
  - `approval_comment` (string): Optional comment for approvers (`0..=255` chars).
  - `booking_context` (object): Optional context of a selected travel service to find matching pre-approved trips before creating a new one (pass `passenger_user_ids` alongside when the traveler is known).
  - `booking_context.end_date` (string, обязательный): Service end date (`YYYY-MM-DD`).
  - `booking_context.service_type` (string, обязательный): Service type being booked (for example `avia`, `hotel`, or `rail`).
  - `booking_context.start_date` (string, обязательный): Service start date (`YYYY-MM-DD`).
  - `booking_context.city_id` (integer): Optional destination city identifier (`>= 1`). Pass only a `city_id` returned by a tool in this conversation; never guess IDs.
  - `booking_context.force_create_new` (boolean): Set `true` only after the user explicitly declined matching approved trips and wants to create a new trip.
  - `booking_context.price` (number): Optional expected service price (non-negative decimal) for remaining pre-approval budget matching.
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the active dialog company for a new trip. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess IDs.
  - `contact_person_id` (integer): Contact person user identifier (`>= 1`) for the trip. Pass only a `user_id` explicitly provided by the user or returned by `context_get` or `employee_search` in this conversation; never guess IDs.
  - `departure_city_id` (integer): Departure city identifier (`>= 1`) when required by company rules. Pass only a `city_id` explicitly provided by the user or returned by `context_get` or `trip_search_field_values(field_kind="city")` in this conversation; never guess IDs.
  - `draft_id` (string): Existing in-memory draft handle from a prior `trip_prepare` response in this conversation. Pass only the exact `draft_id` returned in this conversation; never guess or reuse `draft_id` across conversations.
  - `end_date` (string): Trip end date (`YYYY-MM-DD`) when dates control is required without destination places.
  - `order_id` (integer): Existing trip order identifier (`>= 1`) to edit (omit when creating a new trip). Pass only an `order_id` explicitly provided by the user or returned by `trip_list` or `trip_get` in this conversation; never guess or reuse IDs.
  - `passenger_user_ids` (integer[]): List of passenger user identifiers (`>= 1` each, up to 50). Pass only `user_id` values explicitly provided by the user or returned by `context_get` or `employee_search` in this conversation; never guess or fabricate IDs.
  - `payment_card_id` (integer): Saved payment card identifier (`>= 1`) when `payment_method` is `card`. Pass only a `card_id` returned by `trip_prepare` or `trip_search_field_values(field_kind="payment_card")` in this conversation; never guess IDs.
  - `payment_method` (enum): Trip payment method (`bill`, `card`, `abstract_corporate_card`, or `abstract_personal_card`). — `bill`, `card`, `abstract_corporate_card`, `abstract_personal_card`
  - `places` (object[]): Destination places list (`1..=20` items) when cities control is active (replaces the full `places` list on draft update — pass all destinations when adding another place).
  - `places[].end_date` (string, обязательный): Departure / end date from this destination (`YYYY-MM-DD`).
  - `places[].start_date` (string, обязательный): Arrival / start date in this destination (`YYYY-MM-DD`).
  - `places[].trip_purpose` (string, обязательный): Business purpose of visiting this destination (`1..=255` chars).
  - `places[].accommodation_payment_method` (string): Accommodation payment method option (`1..=255` chars) when required by company form settings.
  - `places[].destination_city_id` (integer): Destination city identifier (`>= 1`, when `type = 0`). Pass only a `city_id` explicitly provided by the user or returned by `trip_search_field_values(field_kind="city")` or `context_get` in this conversation; never guess or reuse IDs from other conversations.
  - `places[].destination_country_id` (integer): Destination country identifier (`>= 1`, required when `type = 1`). Pass only a country ID explicitly provided by the user or returned by `trip_search_field_values(field_kind="country")` in this conversation; never guess IDs.
  - `places[].destination_name` (string): Custom destination name (required when `type = 1`, `1..=255` chars).
  - `places[].destination_organisation` (string): Host organisation name (`1..=255` chars), optional or required per company pre-approval form settings (use `trip_search_field_values` with `field_kind="organisation"` for presets, or pass custom text).
  - `places[].id` (integer): Existing place record identifier (`>= 1`) when editing an existing order; omit for new places. Pass only an ID returned by `trip_prepare` for this order; never guess IDs.
  - `places[].transport_payment_method` (string): Transport payment method option (`1..=255` chars) when required by company form settings.
  - `places[].type` (integer): Location type: `0` for a catalog city (default) or `1` for a custom location name.
  - `start_date` (string): Trip start date (`YYYY-MM-DD`) when dates control is required without destination places.
  - `travel_budget` (number): Requested pre-approval travel budget limit (non-negative decimal in company currency).
  - `trip_name` (string): Trip title or short description (`0..=255` chars).
  - `weekend_works` (object[]): Weekend work records for travelers (`0..=50` items) when company enables weekend work tracking (replaces the full `weekend_works` list on draft update — pass all weekend entries when adding another day).
  - `weekend_works[].compensation` (enum, обязательный): Compensation type (`restDay` or `doublePayment`). — `restDay`, `doublePayment`
  - `weekend_works[].date` (string, обязательный): Weekend work calendar date (`YYYY-MM-DD`).
  - `weekend_works[].reason` (string, обязательный): Justification or reason for weekend work (`1..=255` chars).
  - `weekend_works[].user_id` (integer, обязательный): Passenger user identifier (`>= 1`). Pass only a `user_id` explicitly provided by the user or returned by `context_get` or `employee_search` in this conversation; never guess IDs.
  - `weekend_works[].rest_day` (string): Compensatory day-off date (`YYYY-MM-DD`), required when `compensation` is `restDay`.
- Примеры вызова:
  - Discover required company fields before asking the user: `{}`
  - Prepare a new trip with destination place and cost center: `{"trip_name": "Client workshop", "passenger_user_ids": [20011], "payment_method": "bill", "places": [{"type": 0, "destination_city_id": 49, "start_date": "2026-12-10", "end_date": "2026-12-12", "trip_purpose": "Client meetings"}], "analytics": [{"analytic_id": 12, "value_id": 304}]}`
  - Open an existing trip order for editing without calling trip_get: `{"order_id": 26695, "approval_comment": "Updated travel dates"}`
  - Check matching pre-approved trips before creating a new one: `{"passenger_user_ids": [20011], "booking_context": {"service_type": "avia", "city_id": 49, "start_date": "2026-12-10", "end_date": "2026-12-12", "price": 18500}}`

**Руководство для модели**

```text
Server-driven read-only trip draft evaluator (writes nothing to DB).
Workflow:
1. Run `trip_prepare` via `tool_prepare` FIRST with `{}` (or user-provided details) when creating a trip or checking required fields. Required fields depend strictly on company rules — some allow an empty draft. Never ask for route, dates, title, or passengers beforehand.
2. Clarity: separate REQUIRED (`missing_fields`, with inline options or lookups via `employee_search` / `trip_search_field_values`) from OPTIONAL (`optional_fields`, skippable). If an empty draft is `READY`, state nothing is mandatory and offer to save as-is or add optional fields. NEVER guess, fabricate, or prefill missing required values (especially `trip_purpose`, analytics/cost centers, or weekend reasons) — if dates or budget were given without purpose, ask again explicitly instead of inventing placeholders like "Trip from A to B".
3. Refinement: reuse `draft_id` on follow-up calls so fields merge incrementally. `analytics` merge by `analytic_id`, while `places` and `weekend_works` replace the full array — send the complete list when adding items.
4. Edit order: invoke `trip_prepare` via `tool_prepare` with `order_id` directly (skip `trip_get`). Only orders awaiting approval (`status = 1`) cannot be edited.
5. Lookups: use `trip_search_field_values` via `tool_read` (`city`, `country` for `places[].type = 1`, `analytic` + `analytic_id`, `organisation`, `transport_payment`, `accommodation_payment`, `weekend_reason`, `payment_card`) when IDs or presets are needed or requested. `payment_method = card` requires `payment_card_id`.
6. Route & weekends: pass `places` (`type: 0` with `destination_city_id`, or `type: 1` with `destination_name` + `destination_country_id`, plus `start_date`, `end_date`, `trip_purpose`) when cities control is active, or top-level `start_date`/`end_date` for dates-only control. Never claim a departure city is saved unless `departure_city` is in `resolved_draft`. Briefly note multiple places are supported (without nagging). Ask about weekend work ONLY when `weekend_work=true` for actual dates overlapping Sat/Sun (multiple entries: date, reason, `doublePayment` or `restDay` + `rest_day`, or skip) — NEVER claim weekend overlap before dates exist or for weekdays only.
7. Pre-approved orders: when booking a service, pass `booking_context` + `passenger_user_ids`. If `CHOOSE_APPROVED_ORDER_OR_CREATE`, show matches and set `force_create_new = true` only after user declines.
8. Two-phase save: when `status = READY`, before confirming: (a) present the exact resolved summary (company, contact, payment, passengers, actual saved places, dates, budget, purpose, cost centers, approver comment); (b) warn explicitly if saving starts/restarts pre-approval or notifies passengers (`starts_pre_approval` / `restarts_pre_approval` / `sends_passenger_notifications`); (c) ALWAYS list all remaining `optional_fields` concisely (title, host organisation, "stay over weekends" toggle unlocking tickets on nearest weekends before/after approved dates, approver comment, optional cost centers, plus extra `payment_options` if >1), offering preset lookups or saving as-is. Wait for explicit approval in a separate turn before calling `trip_confirm` via `tool_confirm` — never call it in the same turn as `trip_prepare`.
```

#### Шаг 2 · действие: Создание поездки — `trip_confirm`

Создаёт или обновляет поездку по подготовленному черновику после вашего «да».

- Спросите в чате: Да, создавай.
- Важно: Если по правилам компании нужно согласование, согласующим уйдёт уведомление.
- Доступ: `mcp:prepare` · Меняет данные · Повторный вызов безопасен
- В приложении: через `tool_confirm`
- Параметры:
  - `quote_token` (string, обязательный): One-time confirmation quote token returned by `trip_prepare` when `status=READY`. Pass only the exact `quote_token` returned in this conversation after the user explicitly confirmed the summary; never guess or reuse tokens across conversations.
- Примеры вызова:
  - Save prepared trip after explicit user confirmation: `{"quote_token": "QT_0001"}`

## Сотрудники и отделы

Поиск и просмотр сотрудников и отделов, а также обновление профиля, документов, бонусных и личных ЖД-карт, отсутствий и аналитик после подтверждения.

На экране согласия: «Чтение» или «Действия».

### Поиск сотрудников и гостей — `employee_search`

Находит коллег и гостей по имени, почте или логину, чтобы добавить их в поездку.

- Спросите в чате: Найди в моей компании коллегу по фамилии Иванов.
- Важно: Телефон, почту и дату рождения ассистент не видит — только то, заполнены ли они. Документы приходят замаскированными.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `company_id` (integer): Target company identifier (`>= 1`) overriding dialog active company for this lookup. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `department_id` (integer): Optional department or group identifier (`>= 1`) within the company. Pass only a `department_id` explicitly provided by the user or returned in this conversation; never guess or reuse IDs from other conversations.
  - `limit` (integer): Maximum number of active employees to return (`1..=20`, default `10`).
  - `query` (string): Search query (`0..=120` chars) matching full name (Cyrillic or Latin), email, or login (employee tab numbers are not supported). Omit to list accessible employees up to `limit`.
- Примеры вызова:
  - Find colleague by full name: `{"query": "Ivanov", "limit": 10}`

### Карточка сотрудника — `employee_get`

Показывает карточку профиля сотрудника: отделы, настройки, документы, бонусные и ЖД-дисконтные карты, отсутствия и структурные аналитики.

- Спросите в чате: Покажи мой профиль, сроки действия документов, бонусные карты и периоды отсутствия.
- Важно: Основной и дополнительный телефоны, почта, документы, бонусные и личные ЖД-карты приходят замаскированными; сырые контакты, логин и дата рождения скрыты.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `absences_limit` (integer): Maximum number of absence periods to return per page (`1..=50`, default `20`).
  - `absences_offset` (integer): Zero-based pagination offset for the absence periods section (default `0`).
  - `bonus_cards_limit` (integer): Maximum number of loyalty cards to return per page (`1..=50`, default `20`).
  - `bonus_cards_offset` (integer): Zero-based pagination offset for the loyalty cards section (default `0`).
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the dialog active company for this lookup. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `documents_limit` (integer): Maximum number of documents to return per page (`1..=50`, default `20`).
  - `documents_offset` (integer): Zero-based pagination offset for the documents section (default `0`).
  - `rail_discounts_limit` (integer): Maximum number of rail discount cards to return per page (`1..=50`, default `20`).
  - `rail_discounts_offset` (integer): Zero-based pagination offset for the European rail discount cards section (default `0`).
  - `sections` (enum[]): Sections to load (default `["all"]`). Specify a subset such as `["summary", "documents"]` or `["absences"]` to inspect only specific parts of the profile. — `all`, `summary`, `documents`, `bonus_cards`, `rail_discounts`, `absences`, `analytics`
  - `user_id` (integer): Target employee identifier (`>= 1`). Omit to inspect the caller's own profile. Pass only a `user_id` explicitly provided by the user or returned by `context_get`, `employee_search`, `department_list`, or `department_get` in this conversation; never guess or reuse IDs from other conversations.
- Примеры вызова:
  - Inspect caller's own full profile: `{}`
  - Inspect colleague documents and absences only: `{"user_id": 20015, "sections": ["summary", "documents", "absences"]}`

### Отделы компании — `department_list`

Показывает список отделов активной компании с руководителями и числом сотрудников.

- Спросите в чате: Какие отделы есть в компании и кто ими руководит?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the dialog active company for this lookup. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `limit` (integer): Maximum number of departments to return per page (`1..=50`, default `25`).
  - `offset` (integer): Zero-based pagination offset for the department list (default `0`).
  - `query` (string): Optional case-insensitive search substring (`0..=120` chars) matching department name or department head name.
- Примеры вызова:
  - List departments in active company: `{"limit": 25}`

### Состав отдела — `department_get`

Показывает руководителя отдела и постраничный список его сотрудников с поиском по имени и должности.

- Спросите в чате: Кто работает в отделе продаж и кто там руководитель?
- Важно: Обычные сотрудники видят только свой отдел; контакты и даты рождения участников не передаются.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `department_id` (integer, обязательный): Department identifier (`>= 1`) to inspect. Pass only a `department_id` explicitly provided by the user or returned by `department_list`, `employee_get`, or `employee_search` in this conversation; never guess or reuse IDs from other conversations.
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the dialog active company for this lookup. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `include_inactive` (boolean): Set `true` to include inactive, expired, or locked members alongside active department members (default `false`).
  - `member_search` (string): Optional case-insensitive substring (`0..=120` chars) filtering department members by full name or job title.
  - `members_limit` (integer): Maximum number of members to return per page (`1..=50`, default `25`).
  - `members_offset` (integer): Zero-based pagination offset for the filtered member list (default `0`).
- Примеры вызова:
  - Inspect department head and active members: `{"department_id": 21, "members_limit": 25}`

### Сохранение профиля сотрудника — два шага

Пока вы не подтвердили шаг 2, ничего не сохраняется, не бронируется и не списывается.

#### Шаг 1 · проверка: Предпроверка правки профиля — `employee_profile_prepare`

Проверяет права, правила ФИО/даты рождения, маски телефонов по странам и справочники, собирая сводку изменений профиля, контактов и аналитик без записи на портал.

- Спросите в чате: Подготовь изменение моей должности на «Ведущий аналитик» и домашнего города на Казань.
- Важно: Ничего не сохраняет; предупреждает о сбросе 2FA при смене телефона или почты и уважает скрытие ПДн.
- Доступ: `mcp:prepare` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_prepare`
- Параметры:
  - `analytics` (object[]): Optional structural analytics updates (`1..=50` entries) applied via `user.setAnalyticMass`. Requires editor permission (`user_can_edit=1`), non-agency company, and non-private mode; allowed alone even when `hide_employee_pii` is enabled.
  - `analytics[].analytic_id` (integer, обязательный): Structural analytic identifier (`>= 1`) belonging to the target employee's active company. Pass only an `analytic_id` returned by `employee_get` in this conversation; never guess or reuse IDs across conversations.
  - `analytics[].value` (string): New value for the analytic (`null`, `""`, or `"#noanalitic#"` clears an optional analytic; required analytics cannot be cleared; list analytics must match an allowed option).
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the dialog active company for this edit. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs across conversations.
  - `phone_update` (object): Optional primary phone update applied via `user.setUserPhone` with duplicate-phone detection (`PHONE_DUPLICATE`). Blocked when `hide_employee_pii` is enabled.
  - `phone_update.phone_number` (string, обязательный): Full phone number including country code (for example `+79990001122`, `7..=15` digits).
  - `phone_update.allow_duplicate_phone` (boolean): Set `true` only after the user explicitly confirmed overriding a `PHONE_DUPLICATE` conflict returned by `employee_profile_confirm`.
  - `phone_update.country` (string): Optional phone country ISO-2 code, name, or directory ID (inferred from calling code or profile if omitted).
  - `profile_patch` (object): Optional personal, contact, and profile field updates applied via `user.setUser` (`read-merge-write`). Blocked when `hide_employee_pii` is enabled.
  - `profile_patch.additional_email` (string): Additional contact email (`""` marks existing additional email for deletion).
  - `profile_patch.additional_phone` (string): Additional contact phone number (`""` marks existing additional phone for deletion).
  - `profile_patch.additional_phone_country` (string): Optional phone country ISO-2 code, name, or ID for `additional_phone`.
  - `profile_patch.base_country` (string): Base country for multi-currency expenses (ISO-2 code, name, or ID; allowed only when company multi-currency expenses are enabled).
  - `profile_patch.base_currency` (string): Base currency for multi-currency expenses (ISO-3 code such as `RUB`, `AED`, `USD`, or currency ID; allowed only when company multi-currency expenses are enabled).
  - `profile_patch.birth_date` (string): Date of birth in `YYYY-MM-DD` format (`1900-01-01` through today).
  - `profile_patch.citizenship_country` (string): Citizenship country ISO-2 code, country name, or directory ID resolved via `info.getCountryList`.
  - `profile_patch.clear_home_city` (boolean): Set `true` to clear the employee's home departure city (`userHomeCityId = 0`); cannot be combined with `home_city` or `home_city_id`.
  - `profile_patch.email` (string): Primary contact email address (`""` clears email). Changing email resets email-based 2FA if enabled.
  - `profile_patch.first_name` (string): Employee first name (`1..=100` chars, letters, spaces, and hyphens only; no digits; no leading/trailing hyphen).
  - `profile_patch.first_name_lat` (string): Latin first name (`1..=100` ASCII Latin letters, spaces, and hyphens; allowed only on Russian point of sale or when translit override is enabled).
  - `profile_patch.home_city` (string): Home departure city name query (`2..=120` chars) resolved via `hotelmulti.fastSearch` (`city`/`City`).
  - `profile_patch.home_city_id` (integer): Exact home city `place_id` (`>= 1`) returned by a prior `employee_profile_prepare` clarification response or `employee_get`. Pass only a `home_city_id` returned in this conversation; never guess or reuse IDs across conversations.
  - `profile_patch.last_name` (string): Employee last name (`1..=100` chars, letters, spaces, and hyphens only; no digits; single `-` allowed).
  - `profile_patch.last_name_lat` (string): Latin last name (`1..=100` ASCII Latin letters, spaces, and hyphens; allowed only on Russian point of sale or when translit override is enabled).
  - `profile_patch.main_phone` (string): Primary phone number updated directly via `user.setUser` (`""` clears; do not combine with `phone_update`). Changing phone resets SMS/phone 2FA if enabled.
  - `profile_patch.main_phone_country` (string): Optional phone country ISO-2 code, name, or ID for `main_phone`.
  - `profile_patch.middle_name` (string): Employee middle name (`0..=100` chars; pass empty string `""` to clear; no digits).
  - `profile_patch.personnel_number` (string): Employee personnel / payroll number (`0..=255` chars; `""` clears; blocked when hidden by company policy).
  - `profile_patch.position` (string): Job title / position (`0..=255` chars; `""` clears).
  - `profile_patch.sex` (enum): Employee gender (`M` or `F`). — `M`, `F`
  - `user_id` (integer): Target employee identifier (`>= 1`; omit to edit the caller's own profile). Pass only a `user_id` explicitly provided by the user or returned by `context_get`, `employee_search`, `employee_get`, or `department_get` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Prepare updating caller's own job title and home city: `{"profile_patch": {"position": "Senior Analyst", "home_city": "Moscow"}}`
  - Prepare duplicate-checked phone update for colleague: `{"user_id": 20015, "phone_update": {"phone_number": "+79990001122", "country": "RU"}}`
  - Prepare updating structural analytics (editor only): `{"user_id": 20015, "analytics": [{"analytic_id": 701, "value": "CC-4100"}]}`

**Руководство для модели**

```text
1. Two-phase profile update (`employee_profile_prepare` -> user review -> `employee_profile_confirm`): `employee_profile_prepare` is strictly read-only, validates permissions, `UserRuleList` name/birth-date rules, country phone masks, company settings (`company_hide_personnel_number`, `company_is_multi_currency_expenses`), live directories (countries, currencies, home cities, structural analytics), and returns a diff (masked existing values, normalized proposed values for review) with 2FA reset warnings and a one-time `quote_token`.
2. `hide_employee_pii` gate: when enabled, `profile_patch` and `phone_update` are blocked with `POLICY_DENIED`, while authorized editors (`user_can_edit=1`, non-agency, non-private) may still update structural `analytics` alone without reading or exposing PII.
3. Phone duplicates & 2FA: use `phone_update` for duplicate-checked main phone updates (`allow_duplicate_phone=false` by default). If `employee_profile_confirm` returns `status=phone_duplicate_conflict`, zero writes occurred; ask the user explicitly before re-preparing with `allow_duplicate_phone=true`. Always highlight 2FA reset warnings before confirmation.
4. Excluded scope: personal UI settings (locale/currency/timezone), `user_mark_to_delete` (lock/unlock), login/password/SSO, roles, departments, and travel policies are preserved unchanged and cannot be edited by this tool.
```

#### Шаг 2 · действие: Сохранение профиля сотрудника — `employee_profile_confirm`

Сохраняет подготовленные изменения профиля, телефона и структурных аналитик после вашего подтверждения.

- Спросите в чате: Да, сохраняй изменения профиля.
- Важно: Перед записью сверяет актуальность профиля на портале и останавливается при дубликате телефона без частичных записей.
- Доступ: `mcp:confirm` · Меняет данные · Повторный вызов безопасен
- В приложении: через `tool_confirm`
- Параметры:
  - `quote_token` (string, обязательный): One-time confirmation token returned by `employee_profile_prepare` in this conversation. Pass only the exact `quote_token` returned after the user explicitly confirmed the prepared diff; never guess or reuse tokens across conversations.
  - `target_user_id` (integer, обязательный): Exact target employee `user_id` (`>= 1`) quoted by `employee_profile_prepare`, echoed for explicit confirmation. Pass only the exact `target_user_id` returned by `employee_profile_prepare` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Confirm prepared employee profile update: `{"quote_token": "qt_example_token", "target_user_id": 20015}`

**Руководство для модели**

```text
1. Two-phase profile update (`employee_profile_prepare` -> user review -> `employee_profile_confirm`): `employee_profile_prepare` is strictly read-only, validates permissions, `UserRuleList` name/birth-date rules, country phone masks, company settings (`company_hide_personnel_number`, `company_is_multi_currency_expenses`), live directories (countries, currencies, home cities, structural analytics), and returns a diff (masked existing values, normalized proposed values for review) with 2FA reset warnings and a one-time `quote_token`.
2. `hide_employee_pii` gate: when enabled, `profile_patch` and `phone_update` are blocked with `POLICY_DENIED`, while authorized editors (`user_can_edit=1`, non-agency, non-private) may still update structural `analytics` alone without reading or exposing PII.
3. Phone duplicates & 2FA: use `phone_update` for duplicate-checked main phone updates (`allow_duplicate_phone=false` by default). If `employee_profile_confirm` returns `status=phone_duplicate_conflict`, zero writes occurred; ask the user explicitly before re-preparing with `allow_duplicate_phone=true`. Always highlight 2FA reset warnings before confirmation.
4. Excluded scope: personal UI settings (locale/currency/timezone), `user_mark_to_delete` (lock/unlock), login/password/SSO, roles, departments, and travel policies are preserved unchanged and cannot be edited by this tool.
```

### Сохранение документа сотрудника — два шага

Пока вы не подтвердили шаг 2, ничего не сохраняется, не бронируется и не списывается.

#### Шаг 1 · проверка: Предпроверка документа сотрудника — `employee_document_prepare`

Проверяет права, маску номера, сроки действия, возрастные пороги и ИИН для создания, обновления или удаления документа без записи на портал.

- Спросите в чате: Подготовь добавление моего загранпаспорта РФ 721234567 сроком действия до 2032-05-10.
- Важно: Ничего не сохраняет; маскирует текущие значения, показывает новый нормализованный номер и ИИН для сверки, и полностью блокируется при скрытии ПДн.
- Доступ: `mcp:prepare` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_prepare`
- Параметры:
  - `action` (enum, обязательный): Document mutation action (`create`, `update`, or `delete`). — `create`, `update`, `delete`
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the dialog active company for this edit. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs across conversations.
  - `document_fields` (object): Document field values for `create` or `update` (omit when `action=delete`).
  - `document_fields.date_of_expiry` (string): Document expiry date in `YYYY-MM-DD` format (required for `Z`, `I`, `KZP`, `KZZ`; ignored for `P`).
  - `document_fields.date_of_issue` (string): Document issue date in `YYYY-MM-DD` format (required for `KZP`; must be strictly earlier than `date_of_expiry`).
  - `document_fields.document_number` (string): Document number matching the type mask (`P`: 10 digits, `Z`: 9 digits, `I`: 2..16 Latin/digits, `KZP`: 9 digits, `KZZ`: 1 letter + 8 digits; required on `create`).
  - `document_fields.document_type` (enum): Document type code (`P`, `Z`, `S`, `I`, `KZP`, `KZZ`; required when `action=create`). — `P`, `Z`, `S`, `I`, `KZP`, `KZZ`
  - `document_fields.first_name` (string): First name as printed in the document (`Z`, `I`, `KZP`, `KZZ`; cleared by core for `P` and `S`).
  - `document_fields.issued_by` (string): Issuing authority text (`0..=255` chars; `""` clears).
  - `document_fields.issuing_country` (string): Issuing country ISO-2 code, country name, or directory ID resolved via `info.getCountryList` (stored by core only for `I` and `S`; ignored for `P`, `Z`, `KZP`, `KZZ`; cannot be cleared once set).
  - `document_fields.last_name` (string): Last name as printed in the document (`Z`, `I`, `KZP`, `KZZ`; cleared by core for `P` and `S`).
  - `document_fields.middle_name` (string): Middle name as printed in the document (`Z`, `I`, `KZP`, `KZZ`; cleared by core for `P` and `S`).
  - `document_fields.resident_number` (string): 12-digit Kazakhstan resident identification number (IIN; required for `KZP` and `KZZ`, optional 0 or 12 digits for `I`).
  - `document_id` (integer): Existing document identifier (`>= 1`; required for `update` and `delete`, omit for `create`). Pass only a `document_id` returned by `employee_get(sections=["documents"])` in this conversation; never guess or reuse IDs across conversations.
  - `user_id` (integer): Target employee identifier (`>= 1`; omit to manage the caller's own documents). Pass only a `user_id` explicitly provided by the user or returned by `context_get`, `employee_search`, `employee_get`, or `department_get` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Prepare adding a Russian international passport: `{"action": "create", "document_fields": {"document_type": "Z", "document_number": "721234567", "date_of_expiry": "2032-05-10", "first_name": "IVAN", "last_name": "PETROV"}}`
  - Prepare soft-deleting an existing employee document: `{"user_id": 20015, "action": "delete", "document_id": 9101}`

**Руководство для модели**

```text
1. Two-phase document management (`employee_document_prepare` -> user review -> `employee_document_confirm`): `employee_document_prepare` is strictly read-only, enforces `hide_employee_pii=false` and profile access scope, validates all 6 document types (`P`, `Z`, `S`, `I`, `KZP`, `KZZ` including number masks, expiry/issue dates, age >= 14 for `P` / >= 16 for `KZP`, 12-digit IIN for `KZP`/`KZZ`, max 2 foreign documents `I`), and issues a one-time `quote_token` with a diff (masked existing values, normalized proposed number/IIN for review).
2. Ownership & concurrent-edit safety: `update` and `delete` require a `document_id` belonging to `target_user_id`; `employee_document_confirm` re-reads live documents and aborts with `BUSINESS_CONFLICT` if documents changed on the portal since `prepare`.
```

#### Шаг 2 · действие: Сохранение документа сотрудника — `employee_document_confirm`

Создаёт, обновляет или помечает на удаление документ сотрудника после вашего подтверждения.

- Спросите в чате: Да, сохрани этот документ в профиле.
- Важно: Перед записью повторно сверяет список документов сотрудника на портале от конкурентных правок.
- Доступ: `mcp:confirm` · Меняет данные · Повторный вызов безопасен · Действие необратимо
- В приложении: через `tool_confirm`
- Параметры:
  - `quote_token` (string, обязательный): One-time confirmation token returned by `employee_document_prepare` in this conversation. Pass only the exact `quote_token` returned after the user explicitly confirmed the preview; never guess or reuse tokens across conversations.
  - `target_user_id` (integer, обязательный): Exact target employee `user_id` (`>= 1`) quoted by `employee_document_prepare`, echoed for explicit confirmation. Pass only the exact `target_user_id` returned by `employee_document_prepare` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Confirm prepared employee document change: `{"quote_token": "qt_doc_example", "target_user_id": 20015}`

**Руководство для модели**

```text
1. Two-phase document management (`employee_document_prepare` -> user review -> `employee_document_confirm`): `employee_document_prepare` is strictly read-only, enforces `hide_employee_pii=false` and profile access scope, validates all 6 document types (`P`, `Z`, `S`, `I`, `KZP`, `KZZ` including number masks, expiry/issue dates, age >= 14 for `P` / >= 16 for `KZP`, 12-digit IIN for `KZP`/`KZZ`, max 2 foreign documents `I`), and issues a one-time `quote_token` with a diff (masked existing values, normalized proposed number/IIN for review).
2. Ownership & concurrent-edit safety: `update` and `delete` require a `document_id` belonging to `target_user_id`; `employee_document_confirm` re-reads live documents and aborts with `BUSINESS_CONFLICT` if documents changed on the portal since `prepare`.
```

### Сохранение карты сотрудника — два шага

Пока вы не подтвердили шаг 2, ничего не сохраняется, не бронируется и не списывается.

#### Шаг 1 · проверка: Предпроверка карты сотрудника — `employee_card_prepare`

Проверяет права, перевозчика, формат номера, тир «Аэрофлота» и правила личных ЖД-карт без записи на портал.

- Спросите в чате: Подготовь добавление моей карты Аэрофлот Бонус с уровнем Gold.
- Важно: Управляет бонусными картами и только личными ЖД-картами сотрудника (общекорпоративные ЖД-скидки компании не затрагиваются); блокируется при скрытии ПДн.
- Доступ: `mcp:prepare` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_prepare`
- Параметры:
  - `action` (enum, обязательный): Card mutation action (`upsert` to add/update or `delete` to soft-delete). — `upsert`, `delete`
  - `card_kind` (enum, обязательный): Card category (`bonus` for airline/RZD-Bonus cards, or `rail_discount` for personal employee rail discount cards only). — `bonus`, `rail_discount`
  - `card_id` (integer): Existing bonus `card_id` or personal rail `assignment_id` (`>= 1`; omit to create on `upsert`, required on `delete`). Pass only a `card_id` returned by `employee_get` in this conversation; never guess or reuse IDs across conversations.
  - `card_payload` (object): Card fields for `action=upsert` (omit when `action=delete`).
  - `card_payload.card_number` (string): Loyalty card number using Latin letters and digits only (`/^[A-Za-z0-9]+$/`, `1..=64` chars; `card_kind=bonus` only).
  - `card_payload.card_number_code` (string): Personal rail card number/code (required when the card requires a code or is a rail loyalty program; exactly 12 digits for `BahnBonus`; `card_kind=rail_discount` only).
  - `card_payload.carrier` (string): Airline IATA code (e.g. `SU`, `S7`, `EK`, `RZHDB`), carrier name, or directory ID resolved via `info.getAirlineList` (`card_kind=bonus` only; required when adding a new bonus card).
  - `card_payload.rail_card_id` (integer): Personal rail discount catalog card identifier (`>= 1`) from `card.getRailDiscountCards('pax', userId)` (`card_kind=rail_discount` only; required when assigning a new personal rail card). Pass only a `rail_card_id` returned in this conversation; never guess or reuse IDs across conversations.
  - `card_payload.tier` (string): Aeroflot (`SU`) loyalty tier (`Basic`, `Basic Plus`, `Basic Pro`, `Silver`, `Gold`, `Platinum`, `Infinite Pro`, `Infinite`; `""` clears; `card_kind=bonus` with `SU` only).
  - `card_payload.validity_from` (string): Optional personal rail card validity start date in `YYYY-MM-DD` format (`""` clears; `card_kind=rail_discount` only).
  - `card_payload.validity_until` (string): Optional personal rail card validity end date in `YYYY-MM-DD` format (`""` clears; `card_kind=rail_discount` only).
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the dialog active company for this edit. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs across conversations.
  - `user_id` (integer): Target employee identifier (`>= 1`; omit to manage the caller's own cards). Pass only a `user_id` explicitly provided by the user or returned by `context_get`, `employee_search`, `employee_get`, or `department_get` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Prepare adding an Aeroflot loyalty card with tier: `{"card_kind": "bonus", "action": "upsert", "card_payload": {"carrier": "SU", "card_number": "123456789", "tier": "Gold"}}`
  - Prepare assigning a personal rail discount card: `{"user_id": 20015, "card_kind": "rail_discount", "action": "upsert", "card_payload": {"rail_card_id": 102, "card_number_code": "708000000001"}}`

**Руководство для модели**

```text
1. Two-phase card management (`employee_card_prepare` -> user review -> `employee_card_confirm`): supports `card_kind=bonus` (airline mile cards and RZD-Bonus via `card.setCards`) and `card_kind=rail_discount` (STRICTLY personal employee rail discount/loyalty assignments `user_id > 0` via `card.setRailDiscounts`; company-wide corporate rail discounts are excluded).
2. Rules & gates: both kinds require `hide_employee_pii=false`. `bonus` validates carrier via `info.getAirlineList`, alphanumeric number, Aeroflot (`SU`) loyalty tier (`Basic`..`Infinite`), mile-card policy flags (`company_can_use_mile_cards` / `user_can_use_mile_cards` / MainCoordinator+), and catches duplicates during `prepare`. `rail_discount` requires `user_can_edit=1` and `rail_discounts_available=true`, validates `rail_card_id` against `pax` catalog and 12-digit `BahnBonus` code.
```

#### Шаг 2 · действие: Сохранение карты сотрудника — `employee_card_confirm`

Добавляет, обновляет или удаляет бонусную либо личную ЖД-дисконтную карту сотрудника после вашего подтверждения.

- Спросите в чате: Да, сохрани эту бонусную карту.
- Важно: Перед записью перепроверяет актуальный список карт сотрудника и переносит номер карты при мягком удалении.
- Доступ: `mcp:confirm` · Меняет данные · Повторный вызов безопасен · Действие необратимо
- В приложении: через `tool_confirm`
- Параметры:
  - `quote_token` (string, обязательный): One-time confirmation token returned by `employee_card_prepare` in this conversation. Pass only the exact `quote_token` returned after the user explicitly confirmed the preview; never guess or reuse tokens across conversations.
  - `target_user_id` (integer, обязательный): Exact target employee `user_id` (`>= 1`) quoted by `employee_card_prepare`, echoed for explicit confirmation. Pass only the exact `target_user_id` returned by `employee_card_prepare` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Confirm prepared employee card change: `{"quote_token": "qt_card_example", "target_user_id": 20015}`

**Руководство для модели**

```text
1. Two-phase card management (`employee_card_prepare` -> user review -> `employee_card_confirm`): supports `card_kind=bonus` (airline mile cards and RZD-Bonus via `card.setCards`) and `card_kind=rail_discount` (STRICTLY personal employee rail discount/loyalty assignments `user_id > 0` via `card.setRailDiscounts`; company-wide corporate rail discounts are excluded).
2. Rules & gates: both kinds require `hide_employee_pii=false`. `bonus` validates carrier via `info.getAirlineList`, alphanumeric number, Aeroflot (`SU`) loyalty tier (`Basic`..`Infinite`), mile-card policy flags (`company_can_use_mile_cards` / `user_can_use_mile_cards` / MainCoordinator+), and catches duplicates during `prepare`. `rail_discount` requires `user_can_edit=1` and `rail_discounts_available=true`, validates `rail_card_id` against `pax` catalog and 12-digit `BahnBonus` code.
```

### Сохранение периода отсутствия — два шага

Пока вы не подтвердили шаг 2, ничего не сохраняется, не бронируется и не списывается.

#### Шаг 1 · проверка: Предпроверка периода отсутствия — `employee_absence_prepare`

Проверяет даты отпуска, отсутствие пересечений и права на назначение заместителя без записи на портал.

- Спросите в чате: Подготовь мой отпуск с 2027-07-01 по 2027-07-14.
- Важно: Ничего не сохраняет; ловит пересечения периодов заранее и не даёт обычному сотруднику менять заместителя.
- Доступ: `mcp:prepare` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_prepare`
- Параметры:
  - `action` (enum, обязательный): Absence mutation action (`create`, `update`, or `delete`). — `create`, `update`, `delete`
  - `absence_id` (integer): Existing absence period identifier (`>= 1`; required for `update` and `delete`, omit for `create`). Pass only an `absence_id` returned by `employee_get(sections=["absences"])` in this conversation; never guess or reuse IDs across conversations.
  - `clear_substitute` (boolean): Set `true` to remove the assigned deputy on `update` (not allowed for `Employee` role; cannot be combined with `substitute_user_id`).
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the dialog active company for this edit. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs across conversations.
  - `end_date` (string): Absence end date in `YYYY-MM-DD` format (required on `create`; must be `>= start_date`).
  - `start_date` (string): Absence start date in `YYYY-MM-DD` format (required on `create`; cannot be in the past on `create`).
  - `substitute_user_id` (integer): Active colleague `user_id` (`>= 1`) in the same company acting as deputy during the absence (not allowed for standard `Employee` role; omit to leave unchanged or unassigned). Pass only a `substitute_user_id` returned by `employee_search` or `department_get` in this conversation; never guess or reuse IDs across conversations.
  - `user_id` (integer): Target employee identifier (`>= 1`; omit to manage the caller's own absence periods). Pass only a `user_id` explicitly provided by the user or returned by `context_get`, `employee_search`, `employee_get`, or `department_get` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Prepare creating an absence period: `{"action": "create", "start_date": "2027-07-01", "end_date": "2027-07-14"}`
  - Prepare updating a colleague absence with a deputy: `{"user_id": 20015, "action": "update", "absence_id": 7678, "end_date": "2027-07-20", "substitute_user_id": 20022}`

**Руководство для модели**

```text
1. Two-phase absence management (`employee_absence_prepare` -> user review -> `employee_absence_confirm`): strictly read-only pre-check validates clean `YYYY-MM-DD` dates (`start_date <= end_date`), prevents past start dates (`min(today, existing_start)` on update), catches overlaps against all active periods, and validates deputy permissions/company/activity.
2. Deputy rules: standard `Employee` role cannot assign, change, or clear `substitute_user_id`. Editors may assign an active colleague from the same company (not self) or clear via `clear_substitute=true`.
```

#### Шаг 2 · действие: Сохранение периода отсутствия — `employee_absence_confirm`

Добавляет, обновляет или удаляет период отсутствия сотрудника после вашего подтверждения.

- Спросите в чате: Да, сохрани период отпуска.
- Важно: Перед записью сверяет актуальный список отсутствий на портале и отправляет чистые даты без дублирования времени.
- Доступ: `mcp:confirm` · Меняет данные · Повторный вызов безопасен · Действие необратимо
- В приложении: через `tool_confirm`
- Параметры:
  - `quote_token` (string, обязательный): One-time confirmation token returned by `employee_absence_prepare` in this conversation. Pass only the exact `quote_token` returned after the user explicitly confirmed the preview; never guess or reuse tokens across conversations.
  - `target_user_id` (integer, обязательный): Exact target employee `user_id` (`>= 1`) quoted by `employee_absence_prepare`, echoed for explicit confirmation. Pass only the exact `target_user_id` returned by `employee_absence_prepare` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Confirm prepared employee absence change: `{"quote_token": "qt_absence_example", "target_user_id": 20015}`

**Руководство для модели**

```text
1. Two-phase absence management (`employee_absence_prepare` -> user review -> `employee_absence_confirm`): strictly read-only pre-check validates clean `YYYY-MM-DD` dates (`start_date <= end_date`), prevents past start dates (`min(today, existing_start)` on update), catches overlaps against all active periods, and validates deputy permissions/company/activity.
2. Deputy rules: standard `Employee` role cannot assign, change, or clear `substitute_user_id`. Editors may assign an active colleague from the same company (not self) or clear via `clear_substitute=true`.
```

## Авиабилеты

Поиск авиабилетов, тарифы и опции, бронирование и выписка билетов после подтверждения.

На экране согласия: «Чтение» или «Действия».

### Поиск рейсов — `avia_search`

Ищет рейсы по маршруту и датам и сразу сверяет их с тревел-политикой.

- Спросите в чате: Найди прямые рейсы из Москвы в Санкт-Петербург на следующую среду и обратно в пятницу.
- Доступ: `mcp:read` · Только читает · Обращается к авиакомпаниям и поставщикам
- В приложении: через `tool_read`
- Параметры:
  - `segments` (object[], обязательный): Route legs (`1` = one-way, `2` = round-trip or open-jaw, `3..=6` = multi-segment) in chronological order.
  - `segments[].departure_date` (string, обязательный): Departure date in ISO format (`YYYY-MM-DD`, today or later).
  - `segments[].destination` (string, обязательный): Arrival city or airport name (English, Russian, German, Chinese, Arabic) or 3-letter IATA code (e.g. `LED`, `Istanbul`). For other languages, pass IATA code or English name.
  - `segments[].origin` (string, обязательный): Departure city or airport name (English, Russian, German, Chinese, Arabic) or 3-letter IATA code (e.g. `MOW`, `Moscow`). For other languages, pass IATA code or English name.
  - `adults` (integer): Adult passenger count (`1..=7`, default `1`) when searching anonymously without `passenger_user_ids` and without `order_id`.
  - `cabin_class` (enum): Cabin service class (`economy`, `comfort`, `business`, or `first`, default `economy`). — `economy`, `comfort`, `business`, `first`
  - `children` (integer): Child passenger count (`0..=6`, ages 2 to 11) for anonymous search; total `adults + children + infants` must not exceed `7`.
  - `company_id` (integer): Target company identifier (`>= 1`) overriding the active dialog company when `order_id` is omitted. Pass only a `company_id` explicitly provided by the user or returned by `context_get` or `company_select` in this conversation; never guess or reuse IDs from other conversations.
  - `direct_only` (boolean): Set `true` when the user asks for direct/nonstop flights only (shows nonstop offers in the initial top-5 showcase while keeping connecting offers in the snapshot).
  - `infants` (integer): Infant passenger count without seat (`0..=6`, under 2 years) for anonymous search; cannot exceed `adults`.
  - `order_id` (integer): Existing trip order identifier (`>= 1`) to inherit company, passengers, and allowed route radius. Pass only an `order_id` explicitly provided by the user or returned by `trip_list` or `trip_get` in this conversation; never guess or reuse IDs from other conversations.
  - `passenger_user_ids` (integer[]): Employee or guest user identifiers (`1..=7` items, each `>= 1`) for travel policy and passenger age calculation. Required for coordinators when `context_get` reports `allow_anonymous_search=false` and `order_id` is omitted (pass the caller's own `user_id` from `context_get` when searching for the current user, or look up colleagues via `employee_search`). Pass only `user_id` values explicitly provided by the user or returned by `context_get`, `employee_search`, or `trip_get` in this conversation; never guess or fabricate IDs.
- Примеры вызова:
  - Round-trip economy search for a specific traveler: `{"segments": [{"origin": "MOW", "destination": "LED", "departure_date": "2026-12-10"}, {"origin": "LED", "destination": "MOW", "departure_date": "2026-12-12"}], "cabin_class": "economy", "passenger_user_ids": [20011], "direct_only": true}`
  - Multi-segment business search bound to an existing order: `{"segments": [{"origin": "Moscow", "destination": "Dubai", "departure_date": "2026-12-10"}, {"origin": "Dubai", "destination": "Istanbul", "departure_date": "2026-12-13"}, {"origin": "Istanbul", "destination": "Moscow", "departure_date": "2026-12-16"}], "cabin_class": "business", "order_id": 26695}`

**Руководство для модели**

```text
Runs live airline search across all stops and carriers and saves a deduplicated snapshot under `search_id` (valid for follow-up queries and options).
Workflow:
1. Route legs (`segments`): 1 leg = one-way, 2 legs = round-trip or open-jaw, 3..=6 legs = multi-segment, strictly chronological (`YYYY-MM-DD`, today or later). Pass city/airport names (English, Russian, German, Chinese, Arabic) or 3-letter IATA codes directly — no separate airport lookup tool is needed.
2. Passengers & strict anonymous-search policy:
   - If `order_id` is provided, company, passengers, and allowed route corridor are inherited from the order.
   - If `order_id` is omitted and `context_get` reports `allow_anonymous_search = false`, coordinators MUST pass `passenger_user_ids` (pass the caller's own `user_id` from `context_get` for self-travel, or look up colleagues with `employee_search` via `tool_read`).
   - Regular employees may search only for themselves (`adults = 1` or their own `user_id`).
   - Anonymous counts (`adults`, `children`, `infants`) apply only when both `order_id` and `passenger_user_ids` are omitted (total <= 7, `infants <= adults`).
3. `direct_only = true`: shows nonstop flights in the initial top-5 showcase while still keeping connecting offers inside the saved snapshot.
4. Follow-up steps: NEVER repeat `avia_search` to filter, sort, or paginate the same route/dates/cabin/passengers — invoke `avia_query_offers` via `tool_read` with `search_id` (zero upstream calls). Use `avia_get_brands`, `avia_get_fare_rules`, `avia_get_seatmap`, and `avia_get_ancillaries` via `tool_read` to inspect individual short codes `F1..Fn`.
```

### Фильтр и сортировка — `avia_query_offers`

Отбирает и сортирует найденные рейсы: по цене, пересадкам, времени, багажу, авиакомпании.

- Спросите в чате: Оставь варианты с багажом до 20 000 рублей и отсортируй по времени вылета.
- Важно: Работает по уже найденным вариантам и новый поиск не запускает.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `search_id` (string, обязательный): Saved flight search snapshot handle from `avia_search` (for example `AS_0001`). Pass only a `search_id` returned by `avia_search` in this conversation; never guess or reuse IDs across conversations.
  - `airlines` (string[]): Inclusive IATA/ICAO carrier codes (`SU`, `S7`, `DP`): every segment of every leg must match one of these carriers.
  - `baggage_included` (boolean): Filter by checked baggage inclusion (`true` = baggage included on all segments, `false` = baggage not included).
  - `exclude_airlines` (string[]): Carrier codes (`DP`, `UT`) to exclude if present as marketing, operating, or validating carrier on any segment.
  - `flight_number` (string): Flight number filter across segments (accepts `"1549"`, `"0015"`, `"SU 1549"`, `"SU1549"`, `"S7 1005"`).
  - `in_policy_only` (boolean): When `true`, keep only offers compliant with corporate travel policy (`in_policy`).
  - `limit` (integer): Maximum offers to return per page (`1..=15`, default `5`).
  - `max_duration_minutes` (integer): Maximum leg duration in minutes (`>= 1`, checked against the longest route leg).
  - `max_price` (number): Maximum display price per offer in display currency (strictly positive decimal).
  - `max_stops` (integer): Maximum stops allowed on any route leg (`0` = nonstop only, up to `3`).
  - `max_transfer_minutes` (integer): Maximum layover duration at any single transfer in minutes (`>= 1`; nonstop offers pass).
  - `no_airport_change` (boolean): When `true`, exclude offers requiring airport change during a transfer.
  - `no_overnight_transfer` (boolean): When `true`, exclude offers with overnight transfers.
  - `offset` (integer): Zero-based pagination offset (default `0`).
  - `outbound_arrival_airports` (string[]): Allowed arrival airport 3-letter IATA codes for leg 1 (outbound).
  - `outbound_arrival_time` (string): Outbound arrival local time window in `HH:MM-HH:MM` 24h format.
  - `outbound_departure_airports` (string[]): Allowed departure airport 3-letter IATA codes for leg 1 (outbound), e.g. `["SVO", "VKO"]`.
  - `outbound_departure_time` (string): Outbound departure local time window in `HH:MM-HH:MM` 24h format (wraps midnight if start > end, e.g. `22:00-05:00`).
  - `refundable` (boolean): Filter by refundability (`true` = free or paid refund allowed, `false` = strictly non-refundable; unknown states excluded when set).
  - `return_arrival_airports` (string[]): Allowed arrival airport IATA codes for leg 2 (return); valid only for round-trip searches.
  - `return_arrival_time` (string): Return arrival local time window (`HH:MM-HH:MM`); valid only for round-trip searches.
  - `return_departure_airports` (string[]): Allowed departure airport IATA codes for leg 2 (return); valid only for round-trip searches.
  - `return_departure_time` (string): Return departure local time window (`HH:MM-HH:MM`); valid only for round-trip searches.
  - `single_ticket_only` (boolean): When `true`, exclude split/merged one-way combinations (`mergeOW`); when `false`, return only merged offers.
  - `sort_by` (enum): Sort criterion (`recommended`, `price`, `duration`, `departure_time`, `arrival_time`; default `recommended`). — `recommended`, `price`, `duration`, `departure_time`, `arrival_time`
  - `sort_order` (enum): Sort direction (`asc` or `desc`; default `asc`). — `asc`, `desc`
  - `transfer_airports` (string[]): Require at least one layover passing through one of these 3-letter IATA transfer airports.
- Примеры вызова:
  - Direct morning flights with baggage sorted by price: `{"search_id": "AS_0001", "max_stops": 0, "baggage_included": true, "outbound_departure_time": "07:00-12:00", "sort_by": "price", "sort_order": "asc", "limit": 5}`
  - Policy-compliant single-ticket offers without overnight transfers: `{"search_id": "AS_0001", "max_price": 45000, "exclude_airlines": ["DP"], "no_overnight_transfer": true, "no_airport_change": true, "refundable": true, "in_policy_only": true, "single_ticket_only": true, "sort_by": "duration", "offset": 0, "limit": 5}`

**Руководство для модели**

```text
Instant in-memory filtering, sorting, and pagination over an existing `avia_search` snapshot (`search_id`, 0 upstream calls). Short offer codes `F1..Fn` stay permanently stable across all queries.
Key filter semantics:
- Stops & price: `max_stops = 0` keeps nonstop flights only; `max_price` filters client `display_price`.
- Carriers: `airlines` requires EVERY segment of EVERY leg to match the list; `exclude_airlines` rejects any offer where the carrier appears as marketing, operating, or validating carrier.
- Airports & time windows: `outbound_departure_airports` / `outbound_arrival_airports` filter leg 1; `return_departure_airports` / `return_arrival_airports` and `return_*_time` are valid only for round-trip searches. Time windows use 24h local `HH:MM-HH:MM` and support midnight wrap (e.g. `22:00-05:00`).
- Transfers & comfort: `max_duration_minutes` checks the longest leg; `max_transfer_minutes` checks every layover (nonstop passes); `no_overnight_transfer = true` and `no_airport_change = true` drop inconvenient layovers.
- Fare & policy flags: `baggage_included` requires checked baggage on all segments; `refundable` uses honest 4-state matching (`true` = free/paid refund, `false` = strictly non-refundable, unknown excluded when set); `in_policy_only = true` keeps only compliant offers; `single_ticket_only = true` excludes split `mergeOW` pairs (`false` keeps only `mergeOW`).
- Zero matches rule: if strict filters return 0 offers, report the zero match honestly together with the returned available minimums — never silently drop user filters.
- Pagination: respect `has_more` and advance via `offset` (`limit` 1..=15, default 5).
```

### Тарифы рейса — `avia_get_brands`

Сравнивает тарифы одного рейса: багаж, возврат, обмен и разницу в цене.

- Спросите в чате: Чем отличаются тарифы у первого варианта?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен · Обращается к авиакомпаниям и поставщикам
- В приложении: через `tool_read`
- Параметры:
  - `flight_id` (string, обязательный): Short flight offer code from `avia_search` or `avia_query_offers` (for example `F1`). Pass only a `flight_id` returned for this `search_id` in this conversation; never guess or reuse codes across conversations.
  - `search_id` (string, обязательный): Saved flight search snapshot handle from `avia_search` (for example `AS_0001`). Pass only a `search_id` returned by `avia_search` in this conversation; never guess or reuse IDs across conversations.
- Примеры вызова:
  - Compare fare brands for flight F1: `{"search_id": "AS_0001", "flight_id": "F1"}`

### Правила тарифа — `avia_get_fare_rules`

Показывает правила авиакомпании: штрафы за возврат и обмен, ограничения.

- Спросите в чате: Можно ли сдать этот билет и сколько удержат?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен · Обращается к авиакомпаниям и поставщикам
- В приложении: через `tool_read`
- Параметры:
  - `flight_id` (string, обязательный): Short flight offer code from `avia_search` or `avia_query_offers` (for example `F1`). Pass only a `flight_id` returned for this `search_id` in this conversation; never guess or reuse codes across conversations.
  - `search_id` (string, обязательный): Saved flight search snapshot handle from `avia_search` (for example `AS_0001`). Pass only a `search_id` returned by `avia_search` in this conversation; never guess or reuse IDs across conversations.
  - `brand_ids` (string[]): Optional fare brand codes from `avia_get_brands` (for example `["B2"]` for a single ticket, or `["B1_L1", "B2_L2"]` for a merged one-way offer — one code per leg; omit to inspect the base offer fare). Pass only `brand_ids` returned by `avia_get_brands` for this `flight_id` in this conversation; never guess or reuse codes across conversations.
  - `offset_chars` (integer): Zero-based character offset for paginating long fare rule texts (page size `4000` chars, default `0`). Pass `next_offset_chars` when `has_more=true`.
  - `section` (enum): Fare rules section to return (`penalties` default, `restrictions`, or `full`). — `penalties`, `restrictions`, `full`
- Примеры вызова:
  - Read refund and exchange penalties for brand B2: `{"search_id": "AS_0001", "flight_id": "F1", "brand_ids": ["B2"], "section": "penalties", "offset_chars": 0}`

### Карта мест — `avia_get_seatmap`

Показывает схему салона: свободные места, цены и что разрешает тревел-политика.

- Спросите в чате: Есть свободные места у окна ближе к началу салона?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен · Обращается к авиакомпаниям и поставщикам
- В приложении: через `tool_read`
- Параметры:
  - `flight_id` (string, обязательный): Short flight offer code from `avia_search` or `avia_query_offers` (for example `F1`). Pass only a `flight_id` returned for this `search_id` in this conversation; never guess or reuse codes across conversations.
  - `search_id` (string, обязательный): Saved flight search snapshot handle from `avia_search` (for example `AS_0001`). Pass only a `search_id` returned by `avia_search` in this conversation; never guess or reuse IDs across conversations.
  - `brand_ids` (string[]): Optional fare brand codes from `avia_get_brands` (for example `["B2"]` for a single ticket, or `["B1_L1", "B2_L2"]` for a merged one-way offer — one code per leg). Pass only `brand_ids` returned by `avia_get_brands` for this `flight_id` in this conversation; never guess or reuse codes across conversations.
  - `filter` (enum): Seat filter applied to the returned rows (`all`, `free`, `window`, `aisle`, or `extra_legroom`; default `all`). — `all`, `free`, `window`, `aisle`, `extra_legroom`
  - `order_id` (integer): Optional existing trip order identifier (`>= 1`) used to resolve concrete passengers when the original `avia_search` was anonymous. Pass only an `order_id` explicitly provided by the user or returned by `trip_list` or `trip_get` in this conversation; never guess or reuse IDs from other conversations.
  - `passenger_user_ids` (integer[]): Optional employee or guest user identifiers (`1..=7` items, each `>= 1`) supplying concrete passengers when the original search was anonymous. Pass only `user_id` values explicitly provided by the user or returned by `context_get`, `employee_search`, or `trip_get` in this conversation; never guess or fabricate IDs.
  - `row_from` (integer): First cabin row number to include (inclusive; up to 10 rows returned per call). Pass `next_row_from` when `has_more_rows=true`.
  - `row_to` (integer): Last cabin row number to include (inclusive; clamped to at most 10 rows per call).
  - `segment_index` (integer): 1-based flight segment index across all route legs to inspect (default `1`). Switch using `segments_summary`.
- Примеры вызова:
  - Inspect window seats in rows 1 to 10 of segment 1: `{"search_id": "AS_0001", "flight_id": "F1", "segment_index": 1, "filter": "window", "row_from": 1, "row_to": 10}`

### Багаж и допуслуги — `avia_get_ancillaries`

Показывает, что можно добавить к билету: багаж, питание, Аэроэкспресс, страховку.

- Спросите в чате: Сколько стоит добавить багаж 23 кг?
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен · Обращается к авиакомпаниям и поставщикам
- В приложении: через `tool_read`
- Параметры:
  - `flight_id` (string, обязательный): Short flight offer code from `avia_search` or `avia_query_offers` (for example `F1`). Pass only a `flight_id` returned for this `search_id` in this conversation; never guess or reuse codes across conversations.
  - `search_id` (string, обязательный): Saved flight search snapshot handle from `avia_search` (for example `AS_0001`). Pass only a `search_id` returned by `avia_search` in this conversation; never guess or reuse IDs across conversations.
  - `brand_ids` (string[]): Optional fare brand codes from `avia_get_brands` (for example `["B2"]` for a single ticket, or `["B1_L1", "B2_L2"]` for a merged one-way offer — one code per leg). Pass only `brand_ids` returned by `avia_get_brands` for this `flight_id` in this conversation; never guess or reuse codes across conversations.
  - `category` (enum): Add-on category filter (`all`, `baggage`, `carry_on`, `meal`, `aeroexpress`, `insurance`, or `other`; default `all`). — `all`, `baggage`, `carry_on`, `meal`, `aeroexpress`, `insurance`, `other`
  - `limit` (integer): Maximum number of add-ons to return per page (`1..=20`, default `10`).
  - `offset` (integer): Zero-based pagination offset into the filtered add-ons list (default `0`). Pass `next_offset` when `has_more=true`.
  - `order_id` (integer): Optional existing trip order identifier (`>= 1`) used to resolve concrete passengers when the original `avia_search` was anonymous. Pass only an `order_id` explicitly provided by the user or returned by `trip_list` or `trip_get` in this conversation; never guess or reuse IDs from other conversations.
  - `passenger_user_ids` (integer[]): Optional employee or guest user identifiers (`1..=7` items, each `>= 1`) supplying concrete passengers when the original search was anonymous. Pass only `user_id` values explicitly provided by the user or returned by `context_get`, `employee_search`, or `trip_get` in this conversation; never guess or fabricate IDs.
- Примеры вызова:
  - List all available flight add-ons in one call: `{"search_id": "AS_0001", "flight_id": "F1", "category": "all", "offset": 0, "limit": 20}`
  - List available baggage add-ons for flight F1: `{"search_id": "AS_0001", "flight_id": "F1", "category": "baggage", "offset": 0, "limit": 10}`

**Руководство для модели**

```text
Loads flight add-ons (extra baggage, meals, Moscow Aeroexpress, and flight insurance) for a `flight_id` from an existing `avia_search` snapshot.
Workflow:
1. Default `category: "all"` returns baggage, meals, Aeroexpress, and insurance together in a single call — NEVER make four separate per-category calls when the user asks about all or multiple add-on types.
2. Narrow `category` (`baggage`, `meal`, `aeroexpress`, `insurance`) ONLY when the user specifically asks about one category.
3. Respect pagination (`has_more`, advance `offset` with `limit` 1..=50) and report passenger/segment eligibility limits, VAT disclaimer, and travel policy rules honestly.
```

### Бронирование рейса — два шага

Пока вы не подтвердили шаг 2, ничего не сохраняется, не бронируется и не списывается.

#### Шаг 1 · проверка: Проверка перед бронированием — `avia_prepare_booking`

Проверяет пассажиров, документы, тревел-политику и бюджет и показывает итоговую цену.

- Спросите в чате: Забронируй первый вариант для меня.
- Важно: Ничего не бронирует. Номера документов показываются замаскированными.
- Доступ: `mcp:prepare` · Только читает · Повторный вызов безопасен · Обращается к авиакомпаниям и поставщикам
- В приложении: через `tool_prepare`
- Параметры:
  - `flight_id` (string, обязательный): Short flight offer code from `avia_search` or `avia_query_offers` (for example `F1`). Pass only a `flight_id` returned for this `search_id` in this conversation; never guess or reuse codes across conversations.
  - `order_id` (integer, обязательный): Existing trip order identifier (`>= 1`) with active passengers to bind this flight booking. Pass only an `order_id` explicitly provided by the user or returned by `trip_list`, `trip_get`, or `trip_confirm` in this conversation; never guess or reuse IDs across conversations.
  - `search_id` (string, обязательный): Saved flight search snapshot handle from `avia_search` (for example `AS_0001`). Pass only a `search_id` returned by `avia_search` in this conversation; never guess or reuse IDs across conversations.
  - `allow_duplicates` (boolean): Set `true` only after the user explicitly confirmed proceeding despite a duplicate-service warning returned by `avia_prepare_booking`.
  - `ancillary_selections` (object[]): Optional flight add-on selections from `avia_get_ancillaries` (`1..=30` entries).
  - `ancillary_selections[].ancillary_id` (string, обязательный): Short add-on handle returned by `avia_get_ancillaries` (for example `A1`, `A1_L1`, or `A2_L2`). Pass only an exact `ancillary_id` returned by `avia_get_ancillaries` for this `search_id` and `flight_id` in this conversation; never guess or reuse codes across conversations.
  - `ancillary_selections[].quantity` (integer): Optional unit quantity (`1..=10`) for Aeroexpress or countable carrier add-ons.
  - `ancillary_selections[].user_ids` (integer[]): Optional subset of passenger user identifiers (`1..=7` items, each `>= 1`) receiving this add-on (defaults to all eligible passengers on the order). Pass only `user_id` values from this trip order in this conversation; never guess or fabricate IDs.
  - `brand_ids` (string[]): Optional fare brand codes from `avia_get_brands` (for example `["B2"]` for a single ticket, or `["B1_L1", "B2_L2"]` for a merged one-way offer — one code per leg; omit for the base offer fare). Pass only `brand_ids` returned by `avia_get_brands` for this `flight_id` in this conversation; never guess or reuse codes across conversations.
  - `document_overrides` (object[]): Optional explicit passenger document overrides (`1..=7` entries) when overriding automatic route document selection.
  - `document_overrides[].document_id` (integer, обязательный): Passenger travel document identifier (`>= 1` to select a document returned by `employee_search`, `context_get`, or `avia_prepare_booking`, or `0` to omit an optional document when `documentIsRequired=false`). Never guess or reuse IDs across conversations.
  - `document_overrides[].user_id` (integer, обязательный): Passenger user identifier (`>= 1`). Pass only a `user_id` belonging to this trip order in this conversation; never guess or fabricate IDs.
  - `seat_selections` (object[]): Optional cabin seat selections from `avia_get_seatmap` (`1..=50` entries).
  - `seat_selections[].seat_id` (string, обязательный): Short seat handle returned by `avia_get_seatmap` (for example `S_1_08A`). Pass only an exact `seat_id` returned by `avia_get_seatmap` for this `search_id` and `flight_id` in this conversation; never guess or reuse codes across conversations.
  - `seat_selections[].user_id` (integer, обязательный): Passenger user identifier (`>= 1`). Pass only a `user_id` from the trip order, `context_get`, `employee_search`, or `avia_get_seatmap` in this conversation; never guess or fabricate IDs.
  - `travel_policy_violation_reason` (string): Justification for booking an out-of-policy flight (`10..=250` raw characters, single line, no HTML) when required by company travel policy; must be provided by the user.
  - `vessel_country` (string): Vessel flag country name or ISO code (`1..=120` chars) required only for seaman (`SEA`) tariffs.
  - `vessel_name` (string): Vessel name (`1..=120` chars) required only for seaman (`SEA`) tariffs.
- Примеры вызова:
  - Pre-check base flight booking for an existing order: `{"search_id": "AS_0001", "flight_id": "F1", "order_id": 26695}`
  - Pre-check booking with fare brand, seat, add-on, and policy justification: `{"search_id": "AS_0001", "flight_id": "F1", "order_id": 26695, "brand_ids": ["B2"], "seat_selections": [{"user_id": 20011, "seat_id": "S_1_08A"}], "ancillary_selections": [{"ancillary_id": "A1", "user_ids": [20011], "quantity": 1}], "travel_policy_violation_reason": "Direct morning flight required for client meeting"}`

**Руководство для модели**

```text
Strictly read-only flight booking pre-check that validates every business rule and issues a one-time `quote_token` without writing to the portal or GDS.
Prerequisites & parameters:
1. Required: `search_id` and `flight_id` from this conversation, plus an existing `order_id` that already has active passengers. If no trip exists or the order has no passengers, create or update the trip first via `trip_prepare` (`tool_prepare`) + `trip_confirm` (`tool_confirm`) (this tool never mutates order passengers).
2. Optional fare & service choices:
   - `brand_ids`: short codes from `avia_get_brands` (single ticket: `["B2"]`; split `mergeOW` offer: one code per leg such as `["B1_L1", "B2_L2"]` — never pass a partial list).
   - `seat_selections`: array of `{user_id, seat_id}` from `avia_get_seatmap`.
   - `ancillary_selections`: array of `{ancillary_id, user_ids?, quantity?}` from `avia_get_ancillaries`.
   - `document_overrides`: array of `{user_id, document_id}` when overriding automatic route document matching.
3. Special compliance barriers:
   - Seaman (`SEA`) tariffs require `vessel_name` and `vessel_country`.
   - Out-of-policy flights requiring justification need user-provided `travel_policy_violation_reason` (10..=250 raw chars, single line, no HTML).
   - Duplicate-service warnings block until the user explicitly approves retrying with `allow_duplicates: true`.
4. Two-phase confirmation, upsells & loyalty status: present full price breakdown, masked passenger documents, time limit, and warnings to the user. In one concise sentence, mention ONLY the options shown in `available_upsells` as actually available (alternative brands, seats, add-ons, Aeroexpress, insurance — never pitch policy-blocked or unavailable options). Clearly state each passenger's loyalty card match for the flight's carrier (`auto:<carrier>` applied automatically from profile vs missing for this carrier, noting it can be added before ticketing via `employee_card_prepare` / `employee_card_confirm` or on the portal). Wait for explicit confirmation in a separate turn, then call `avia_confirm_booking` via `tool_confirm` echoing exact `quote_token`, `confirmed_total_amount`, and `confirmed_currency`.
```

#### Шаг 2 · действие: Бронирование рейса — `avia_confirm_booking`

Бронирует рейс и добавляет его в поездку после вашего «да».

- Спросите в чате: Да, бронируй.
- Важно: Бронь ещё не билет: выписка — отдельное действие со своим подтверждением.
- Доступ: `mcp:confirm` · Меняет данные · Повторный вызов безопасен · Обращается к авиакомпаниям и поставщикам
- В приложении: через `tool_confirm`
- Параметры:
  - `confirmed_currency` (string, обязательный): Exact 3-letter ISO currency code quoted by `avia_prepare_booking` (for example `RUB`, `AED`, `USD`).
  - `confirmed_total_amount` (number, обязательный): Exact total booking amount quoted by `avia_prepare_booking` (`total_amount`), echoed for explicit financial confirmation.
  - `quote_token` (string, обязательный): One-time confirmation token returned by `avia_prepare_booking` in this conversation. Pass only the exact `quote_token` returned after the user explicitly confirmed the booking summary; never guess or reuse tokens across conversations.
- Примеры вызова:
  - Confirm flight reservation echoing exact quoted amount and currency: `{"quote_token": "QT_BOOK_01", "confirmed_total_amount": 18500, "confirmed_currency": "RUB"}`

### Выписка билета — два шага

Пока вы не подтвердили шаг 2, ничего не сохраняется, не бронируется и не списывается.

#### Шаг 1 · проверка: Проверка перед выпиской — `avia_prepare_issue`

Проверяет бронь, тайм-лимит и оплату и называет точную сумму к списанию.

- Спросите в чате: Выпиши билет по брони в Казань.
- Важно: Ничего не выписывает и не списывает.
- Доступ: `mcp:prepare` · Только читает · Повторный вызов безопасен · Обращается к авиакомпаниям и поставщикам
- В приложении: через `tool_prepare`
- Параметры:
  - `order_id` (integer, обязательный): Existing trip order identifier (`>= 1`) containing the reserved flight service. Pass only an `order_id` explicitly provided by the user or returned by `trip_list`, `trip_get`, or `avia_confirm_booking` in this conversation; never guess or reuse IDs across conversations.
  - `service_id` (integer, обязательный): Reserved flight service identifier (`>= 1`) within the order to issue tickets for. Pass only an exact `service_id` returned by `trip_get` or `avia_confirm_booking` for this `order_id` in this conversation; never guess or reuse IDs across conversations.
  - `accept_reprice` (boolean): Set `true` only after the user explicitly accepted a new price reported by `avia_confirm_issue` (`status=PRICE_CHANGED`) to prepare forced reprice ticketing (`force=1`).
- Примеры вызова:
  - Check ticketing readiness and prepare buyout quote: `{"order_id": 26695, "service_id": 8550866}`
  - Prepare re-quoted issuance after user accepted PRICE_CHANGED: `{"order_id": 26695, "service_id": 8550866, "accept_reprice": true}`

**Руководство для модели**

```text
Strictly read-only pre-check before irreversible ticket issuance and financial charge.
Workflow:
1. Invoke `avia_prepare_issue` via `tool_prepare` (instead of `trip_service_get`) whenever the user asks whether a reserved flight can be issued, why ticketing is blocked, or wants to buy out a reserved flight (`order_id`, `service_id`).
2. Checks performed without charging: ticketing permission, order and service status, `ISSUE` action flag, buyout time limit (>= 180s remaining), browser 3DS payment requirement (chat ticketing is blocked when browser 3DS is required), saved card validity, company debt/balance, linked add-ons, and pending reprice status.
3. Reprice handling: if `avia_confirm_issue` later returns `status = PRICE_CHANGED`, show the updated price to the user and wait for explicit acceptance before re-invoking `avia_prepare_issue` via `tool_prepare` with `accept_reprice: true` to obtain a fresh `quote_token`.
4. Two-phase irreversible confirmation: present exact final charge, currency, and any surcharge/add-ons. Wait for explicit confirmation in a separate turn before calling `avia_confirm_issue` via `tool_confirm` echoing `quote_token`, `confirmed_total_amount`, and `confirmed_currency`.
```

#### Шаг 2 · действие: Выписка билета — `avia_confirm_issue`

Выписывает билет и списывает деньги после вашего «да».

- Спросите в чате: Да, выписывай.
- Важно: Отменить нельзя. Если цена изменилась, ассистент остановится и спросит ещё раз.
- Доступ: `mcp:confirm` · Меняет данные · Повторный вызов безопасен · Обращается к авиакомпаниям и поставщикам · Действие необратимо
- В приложении: через `tool_confirm`
- Параметры:
  - `confirmed_currency` (string, обязательный): Exact 3-letter ISO currency code quoted by `avia_prepare_issue` (for example `RUB`, `AED`, `USD`).
  - `confirmed_total_amount` (number, обязательный): Exact total ticket issuance amount quoted by `avia_prepare_issue` (`total_amount`), echoed for explicit financial confirmation.
  - `quote_token` (string, обязательный): One-time confirmation token returned by `avia_prepare_issue` in this conversation. Pass only the exact `quote_token` returned after the user explicitly confirmed the final ticket issuance amount; never guess or reuse tokens across conversations.
- Примеры вызова:
  - Irreversibly issue tickets echoing exact quoted amount and currency: `{"quote_token": "QT_ISSUE_01", "confirmed_total_amount": 16338, "confirmed_currency": "RUB"}`

## Служебное

Диагностика подключения.

Доступно при любом уровне доступа.

### Проверка связи — `server_ping`

Проверяет, что сервер отвечает.

- Спросите в чате: Проверь, отвечает ли Trivio.
- Доступ: `mcp:read` · Только читает · Повторный вызов безопасен
- В приложении: через `tool_read`
- Параметры:
  - `echo` (string): Optional connectivity echo tag.
- Примеры вызова:
  - Verify MCP server transport connectivity: `{"echo": "health"}`

## Что видно в приложении

Режим сервера: компактный.

Приложению не показывают все 35 методов разом: их описания занимали бы заметную часть памяти ассистента в каждом ответе. Вместо этого оно получает короткий список: 4 частых метода напрямую и 5 инструментов-посредников, через которые ассистент находит и вызывает остальные. Возможности и права те же, меняется только путь вызова.

- Только чтение — 7: `context_get`, `company_select`, `trip_list`, `trip_get`, `tools_catalog`, `tool_describe`, `tool_read`
- Чтение и оформление — 9: `context_get`, `company_select`, `trip_list`, `trip_get`, `tools_catalog`, `tool_describe`, `tool_read`, `tool_prepare`, `tool_confirm`

Числа считаются из каталога сервера для доступа ко всем разделам. Если на экране согласия отключить раздел, его методы из списка пропадут.

### Как читать запрос на подтверждение

Перед действием приложение спросит разрешения и покажет имя посредника. Что именно произойдёт, написано внутри запроса.

1. `tool` — настоящий метод. Здесь это Выписка билета `avia_confirm_issue`.
2. `arguments` — с чем он вызывается. Сумма и валюта должны совпадать с тем, что ассистент показал в чате.
3. Не включайте «Всегда разрешать» для `tool_confirm`: приложение запоминает разрешение по имени инструмента и перестанет показывать этот запрос перед любым действием, включая необратимые.

### Инструменты-посредники

#### Оглавление методов — `tools_catalog`

Показывает ассистенту список методов, доступных с вашими правами.

- Когда вы его увидите: В начале задачи, когда ассистент ищет подходящий метод: например, перед первым поиском рейсов.
- Виден при любом уровне доступа
- Параметры:
  - `domain` (enum): Optional domain filter (`context`, `trips`, `avia`, `people`, or `service`). — `context`, `trips`, `avia`, `people`, `service`
  - `query` (string): Optional case-insensitive English keyword filter (`1..=80` chars; the catalog index is English-only — pass English words, filter by `domain`, or omit `query` to view all permitted tools in one call).
  - `tier` (enum): Optional risk/execution tier filter (`read`, `prepare`, or `confirm`). — `read`, `prepare`, `confirm`

#### Описание метода — `tool_describe`

Отдаёт ассистенту точные параметры и примеры для выбранных методов.

- Когда вы его увидите: Перед первым вызовом незнакомого метода и после ошибки в параметрах.
- Виден при любом уровне доступа
- Параметры:
  - `tools` (string[], обязательный): Exact tool names (`1..=5` items) from `tools_catalog` or the primary catalog to inspect.

#### Вызов метода чтения — `tool_read`

Вызывает метод, который только читает данные: поиск рейсов, политики, отчёты.

- Когда вы его увидите: Почти в каждой задаче. Ничего не меняет и не списывает.
- Через него вызываются: `policy_get`, `employee_search`, `employee_get`, `department_list`, `department_get`, `trip_service_get`, `desktop_summary`, `advance_report_list`, `advance_report_get`, `trip_search_field_values`, `avia_search`, `avia_query_offers`, `avia_get_brands`, `avia_get_fare_rules`, `avia_get_seatmap`, `avia_get_ancillaries`, `server_ping` и 4 прямых метода
- Виден при любом уровне доступа
- Параметры:
  - `tool` (string, обязательный): Exact target tool name from `tools_catalog` matching this executor tier.
  - `arguments` (object): JSON object of target tool arguments matching `input_schema` from `tool_describe` (defaults to `{}`).

#### Вызов проверки — `tool_prepare`

Запускает шаг 1 действия: проверку перед созданием поездки, бронированием или выпиской.

- Когда вы его увидите: Когда вы просите что-то оформить. Ассистент проверяет правила и показывает итог. На этом шаге ничего не сохраняется.
- Через него вызываются: `employee_profile_prepare`, `employee_document_prepare`, `employee_card_prepare`, `employee_absence_prepare`, `trip_prepare`, `avia_prepare_booking`, `avia_prepare_issue`
- Виден при доступе «Чтение и оформление»
- Параметры:
  - `tool` (string, обязательный): Exact target tool name from `tools_catalog` matching this executor tier.
  - `arguments` (object): JSON object of target tool arguments matching `input_schema` from `tool_describe` (defaults to `{}`).

#### Вызов подтверждения — `tool_confirm`

Выполняет шаг 2 после вашего «да»: создаёт поездку, бронирует рейс или выписывает билет.

- Когда вы его увидите: Только после того, как вы подтвердили итог в чате.
- Важно: Проверяйте поле `tool` в запросе и не включайте «Всегда разрешать»: приложение перестанет спрашивать перед всеми этими действиями, включая необратимые. Сервер при этом выполнит только то, что прошло шаг проверки.
- Через него вызываются: `employee_profile_confirm`, `employee_document_confirm`, `employee_card_confirm`, `employee_absence_confirm`, `trip_confirm`, `avia_confirm_booking`, `avia_confirm_issue`
- Виден при доступе «Чтение и оформление»
- Параметры:
  - `tool` (string, обязательный): Exact target tool name from `tools_catalog` matching this executor tier.
  - `arguments` (object): JSON object of target tool arguments matching `input_schema` from `tool_describe` (defaults to `{}`).

### Весь каталог сразу

Разработчикам и приложениям с собственным поиском по инструментам удобнее плоский список: все 35 методов видны напрямую, без посредников. Добавьте к адресу сервера `?tools=all`. Вход, права и подтверждения работают так же.

`https://mcp.trivio.ru/mcp?tools=all`

То же самое делает заголовок `X-Mcp-Tools-Mode: all`.

Точные схемы параметров клиент получает от сервера при подключении.
