Skip to main content
Glama

Оформление и оплата заказа

grocery_checkout
Destructive

Finalize grocery ordering with delivery and real payment. Validates stock availability, shows final sum, and charges only after user confirms the order.

Instructions

Полный чекаут: доставка → заказ → оплата. РЕАЛЬНЫЕ ДЕНЬГИ. app_id/point_id — из grocery_stores() (обязательны, тот же магазин что в корзине).

Если корзина просит больше остатка (count > countAvailable), тул останавливается ДО доставки: отвечает CART_QUANTITY_CONFLICT с перечнем SKU, заказ не создаётся и деньги не двигаются. Это проверка по инварианту корзины, а не расшифровка кода магазина. Уменьши до «в наличии» или замени (с согласия пользователя) и повтори.

Подтверждение — кнопка, не текст: тул сам делает предпросмотр (только бэкенд знает, во что пересчитаются весовые товары), показывает пользователю кнопки «Оформить заказ на N ₽ / Отмена» с ФИНАЛЬНОЙ суммой и оформляет заказ ровно на неё. Покажи состав корзины ДО вызова (кнопка называет только итог), но НЕ спрашивай «да/нет» текстом — согласие даёт кнопка. Клиент без элиситации получает отказ «ПЛАТЁЖ НЕ ВЫПОЛНЕН» — деньги там не двигаются вообще.

dry_run=True — ПРЕДПРОСМОТР: доводит до доставки и возвращает финальную сумму, НЕ создавая заказ и НЕ списывая деньги. Работает в любом клиенте. Нужен, если хочешь назвать пользователю итог и слот доставки заранее; для оплаты не обязателен — чекаут делает свой предпросмотр сам.

СЧЁТ СПИСАНИЯ по умолчанию — тот, которым пользователь последний раз платил за продукты В ПРИЛОЖЕНИИ (банк отдаёт его сам), а НЕ первый счёт с балансом. Хочешь другой — передай account_id из list_accounts(). Списанный счёт печатается в ответе.

expected_sum — необязательная сверка: сумма, которую ты уже называл пользователю (из dry_run). Если она разошлась с предпросмотром чекаута, кнопка покажет ОБЕ суммы («… было N — банк пересчитал»), а спишется та, что на кнопке. Банк дважды пересчитывает корзину уже ПОСЛЕ кнопки (веб-корзина, затем доставка); расхождение с суммой на кнопке (допуск 0.01 ₽) отменяет чекаут ДО создания заказа.

При неопределённом результате (заказ мог создаться) повтор БЛОКИРУЕТСЯ — сначала grocery_attempts() и проверь заказ в приложении. force=True — только если пользователь ЯВНО подтвердил, что прошлого заказа нет; кнопка при повторе показывается снова.

Реализация: тул асинхронный и запускает браузер Playwright в отдельном worker-потоке (asyncio.to_thread) — sync_playwright падает, если звать его внутри event-loop, а FastMCP крутит sync-тулы именно в loop. Если тул падает с Playwright-ошибкой — проверь python -m playwright install chromium (в окружении MCP).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNo
app_idNo
dry_runNo
point_idNo
account_idNo
expected_sumNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description goes far beyond annotations: it discloses that real money move, that a CART_QUANTITY_CONFLICT blocks the order before delivery and before any payment, that checkout makes its own backend-driven preview and only executes after a button confirmation, that the bank recomputes the cart after confirmation, that ambiguous results block retries, and that force only re-shows the confirmation button. This is exactly the behavioral context the agent needs for a destructive, non-idempotent operation. No contradiction with the annotations exists.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but every paragraph corresponds to a distinct decision an agent must make: high-level purpose, mandatory store identity, cart conflict handling, consent UI, dry-run behavior, account selection, multi-step idempotency guard, and failure diagnosis. It is front-loaded with the most critical fact: real money. This length is justified by the destructive nature of the tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a payment-completing tool with no parameter descriptions and a large sibling family, the description leaves almost nothing unknown: inputs, side effects, failure modes, retry policy, confirmation requirement, and even Playwright failure remediation. There is no need to describe the return format because an output schema is provided.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Despite 0% schema description coverage, the description covers all 6 parameters: app_id/point_id are explained as mandatory and sourced from grocery_stores(), dry_run is described as preview without order or payment, account_id is described as overriding the default app payment account, expected_sum is the previously announced sum for reconciliation, and force is scoped to the explicit-no-previous-order case. Without this, an agent would be heavily constrained by these fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool as the full grocery checkout flow: 'Полный чекаут: доставка → заказ → оплата'. It ties the tool to grocery context (корзина, grocery_stores, app_id/point_id) and emphasizes 'РЕАЛЬНЫЕ ДЕНЬГИ', which distinguishes it from non-payment grocery tools and from unrelated payment/purchase siblings such as train_pay, ticket_pay, and pay_bill.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives explicit usage rules: app_id/point_id must come from grocery_stores(), the cart must match the same store, dry_run is for preview, expected_sum verifies a previously quoted total, retries are blocked pending grocery_attempts(), force=True is allowed only after explicit user confirmation, and user consent must be via button rather than text. It directly tells the agent when and how to use the tool and what to do when the invocation is unsafe.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/icyberdeveloper/tbank-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server