Skip to main content
Glama
grammy-mcp
by louietyj

answerPreCheckoutQuery

Respond to Telegram pre-checkout queries within 10 seconds by confirming or declining orders, using human-readable error messages to explain any failure to proceed.

Instructions

Once the user has confirmed their payment and shipping details, the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query. Use this method to respond to such pre-checkout queries. On success, True is returned. Note: The Bot API must receive an answer within 10 seconds after the pre-checkout query was sent.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "pre_checkout_query_id": "<pre_checkout_query_id>",
      "ok": "<ok>"
    },
    "name": "answerPreCheckoutQuery"
  }
}

Input Schema

NameRequiredDescriptionDefault
okYesSpecify True if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order. Use False if there are any problems.
error_messageNoRequired if ok is False. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user.
pre_checkout_query_idYesUnique identifier for the query to be answered

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.9/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false and openWorldHint=true, and the description adds genuinely new behavioral facts: a hard 10-second answer deadline and that True is returned on success. The deadline in particular is critical operational context that no structured field carries. It does not explain what happens if the deadline is missed.

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

Conciseness4/5

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

Three short sentences that are front-loaded with the trigger and the action, followed by the return value and a clearly separated timing note. Every sentence carries information; only the phrasing of the first sentence is slightly indirect.

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

Completeness4/5

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

For a three-parameter mutation with no output schema, the description covers the trigger, the response semantics, and the critical 10-second constraint. What remains unstated — failure behavior after the deadline and how it differs from answerShippingQuery — is minor but non-zero.

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

Parameters3/5

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

Schema description coverage is 100%, with ok, error_message, and pre_checkout_query_id all documented including the conditional requirement that error_message is needed when ok is False. The description adds no parameter-level meaning beyond the schema, so the baseline of 3 applies.

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

Purpose4/5

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

States a specific verb and resource: 'Use this method to respond to such pre-checkout queries,' and explains the triggering Update field pre_checkout_query. It is clear what the tool does, though it does not explicitly contrast itself with the sibling answerShippingQuery.

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

Usage Guidelines4/5

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

Gives a concrete trigger condition — the Bot API sends an Update with pre_checkout_query once the user confirms payment and shipping details — so an agent knows exactly when to call it. It stops short of naming alternatives such as answerShippingQuery or stating when not to use it.

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

Deploy Server

Other Tools