Для AI-агентов: markdown этой страницы — /docs/mcp-dialogs.mdиндекс документации — /llms.txt
MCP: dialogs
Обновлено
Определения инструментов. Обновляйте tools/list после изменения прав. required_scopes: ALL.
add_comment
Add an operator comment (up to 2000 characters) to an entity: subject {kind, id}; subject kind is order, payment, inquiry, dialog, form_submission or booking. The author is the calling credential, shown to operators as the client agent. The caller also needs the write scope of the subject kind.
Scopes (ALL): ["dialogs:write"]. Risk: "write".
delete_comment
Delete a comment by its `id`. A credential deletes the comments it wrote itself; the owner (an OAuth grant of the owner) deletes any. The deletion is soft: the comment disappears from lists.
Scopes (ALL): ["dialogs:write"]. Risk: "destructive".
execute_message_changes
Apply exactly the changes prepared by prepare_message_changes: each message is edited or deleted in the customer's chat, and the team's copy in the dialog changes too. Each item reports its own result and its delivery, and delivery_counts totals the four statuses; ok: true means the messenger applied the change. Each message states its delivery: delivered (the messenger confirmed it), queued (in the sending queue, not delivered yet), unknown (the messenger may have accepted it and no answer will follow) or failed (it did not go out; the element is refused with the reason). Only delivered means it reached the customer: tell the owner that a queued message is waiting and that an unknown one may or may not have arrived, and never send either again. MESSAGE_NOT_FOUND means the message or the dialog is gone; MESSAGE_CHANGE_FAILED means the messenger refused and the message stays as it was; MESSAGE_CHANGE_INVALID means the new file can no longer be used and DIALOGS_SWITCHED_OFF that dialogs were switched off — nothing was changed for either; MESSAGE_CHANGE_UNCONFIRMED (delivery unknown) means the change may have been applied — read get_conversation before preparing it again. A preparation is applied once. Call this tool only after final human confirmation of the prepared scenario.
Scopes (ALL): ["dialogs:write"]. Risk: "destructive".
execute_reply_batch
Send exactly the batch prepared by prepare_reply_batch: each reply quotes the message you named, else answers the customer's last message (a proactive item or an entity card is a new message); the team sees a copy in the dialog. Sending never takes over a chat. Choosing the path: a personal text for each customer goes through prepare_reply_batch then execute_reply_batch; one identical message to a whole segment goes through broadcasts (create_broadcast). Each item reports its result and delivery; delivery_counts totals the four statuses; ok: true means delivered. Each message states its delivery: delivered (the messenger confirmed it), queued (in the sending queue, not delivered yet), unknown (the messenger may have accepted it and no answer will follow) or failed (it did not go out; the element is refused with the reason). Only delivered means it reached the customer: tell the owner that a queued message is waiting and that an unknown one may or may not have arrived, and never send either again. REPLY_DELIVERY_UNCONFIRMED means delivery queued: its outcome shows in get_conversation, or delivery unknown: the messenger may or may not have it and no confirmation will come — either way do not send it again; REPLY_IN_PROGRESS means the reply is still going out — call again later; REPLY_BATCH_USER_WROTE_AFTER_PREPARE means the customer wrote again before a reply to their last message went out (a reply that quotes a message you named is not held to it), so read the conversation and prepare again; REPLY_TARGET_NOT_FOUND means the message it answers is gone and nothing was sent; ENTITY_CARD_NOT_FOUND (the entity is gone or unavailable) and ENTITY_CARD_NOT_OPENED (its target opens nothing for them) sent nothing; ENTITY_CARD_UNAVAILABLE: they got an unavailable notice instead; do not resend. A repeat with the same preparation resends only refused replies. A file still being prepared refuses the whole call; repeat it in a minute. Call this tool only after final human confirmation of the prepared scenario.
Scopes (ALL): ["dialogs:write"]. Risk: "write".
get_conversation
Read a dialog by user_id. Messages include message_id, author, source, text and created_at.
Scopes (ALL): ["dialogs:read"]. Risk: "read".
get_message_stats
Read message attribution totals and by_source counts for your tenant, aggregated across operators.
Scopes (ALL): ["dialogs:read"]. Risk: "read".
get_operator_report
Report how your team handled dialogs in a window ('24h', '7d' default, '30d'): per operator by name and @username, dialogs taken, time from a customer's call to taking it, time to the first message, median and p90 reply time, and who waits for them now; plus open calls nobody took yet. Judge reply quality by reading get_user_timeline.
Scopes (ALL): ["dialogs:read"]. Risk: "read".
get_user_timeline
Read one customer's history by user_id as a time-ordered feed: messages with their author, products and events opened, orders and their statuses, calls for an operator, who took and released the dialog, and chat status changes. Entities read as [id] «title»; each line is in your team's language; a reply carries how long the other side waited. from/to are ISO times (default: the last seven days); pass next_cursor to read further.
Scopes (ALL): ["dialogs:read"]. Risk: "read".
list_comments
List the comments of one entity: subject_kind and subject_id (the `id` of the order, payment, inquiry, dialog, form submission or booking). Returns each with its `id`, author, source, text and time, paginated by after_id. Deleted comments are not shown. The caller also needs the read scope of the subject kind.
Scopes (ALL): ["dialogs:read"]. Risk: "read".
list_dialogs
List customer dialogs active in a window (window '24h' default or '7d', or since an ISO time at most seven days back) plus every open call for an operator. Each dialog has user_id, name, chat_status, the last customer and team message times, who waits for whom and how long, the open inquiry, the open order, cart items and products viewed. filter: awaiting_reply (the customer waits for you, longest wait first), awaiting_user, with_open_order, all. Pass next_cursor to read the next page.
Scopes (ALL): ["dialogs:read"]. Risk: "read".
prepare_message_changes
Prepare edits and deletions of messages your business already sent to customers, for a human to approve. Each item addresses one message by user_id and message_id (read them with get_conversation): kind 'edit' with edit {action: 'text' | 'caption' | 'media' | 'markup'} and its new text, caption, media (a ref media_finalize or media_import_files returned) or buttons, or kind 'delete'. Buttons take a style; web_app_url opens a Mini App only on a registered origin, else a plain link. Only a message the business sent can be changed; a missing message or one the customer wrote refuses the whole batch. The batch size follows your plan. The result is the exact batch with each customer's name. Show it to the owner or operator and call execute_message_changes only after they say to apply it. Nothing is changed here.
Scopes (ALL): ["dialogs:write"]. Risk: "write".
prepare_reply_batch
Prepare personal messages for a human to approve: a reply to each customer's last message, a proactive message, or a ready card of a product, event, chain or other entity. Choosing the path: a personal text for each customer goes through prepare_reply_batch then execute_reply_batch; one identical message to a whole segment goes through broadcasts (create_broadcast). Get recipients from sample_segment_audience or list_dialogs. Each item is one customer, by user_id: a message (kind 'message', the default) with text and/or media, caption, entities and buttons. Pass reply_to_message_id as a message_id from get_conversation for one of this customer's messages to answer it: the reply arrives as a quote. Pass reply_to_message_id: null to write first (a greeting, an offer): a new message that answers nothing; leave it out to answer the customer's last message. An entity_card item (kind 'entity_card') carries target (the entity shown, as in a button) and on_active for a chain the customer is already in; it answers nothing. Each button is {text} with exactly one of url, callback_data or web_app_url (https; a Mini App only on an origin registered for your business, see get_mini_app_links; else a plain link), plus an optional style (primary, success or danger) and icon_custom_emoji_id. Media are refs from media_finalize or media_import_files; upload a heavy file once, reuse it. The result is the exact batch: each customer's name, the content and reply_to_message_id — the message answered (null for a proactive item, an entity card, or no customer message). A message_id that is not a quotable message of that customer refuses the whole batch, nothing is prepared (REPLY_TARGET_NOT_FOUND names the items). A batch does not skip customers who opted out of promotions, because it carries personal messages and not promotion: promotional text to someone who opted out is at the owner's own risk. Show the batch to the owner or operator; call execute_reply_batch only after they say to send. Nothing is sent here.
Scopes (ALL): ["dialogs:write"]. Risk: "write".
release_chat
Release a dialog by user_id and restore configured AI routing.
Scopes (ALL): ["dialogs:write"]. Risk: "write".
take_chat
Take over a dialog by user_id and pause AI responses. Sending alone never takes over.
Scopes (ALL): ["dialogs:write"]. Risk: "write".