Skip to main content
Glama

kapruka_check_delivery

Read-only

Check whether Kapruka can deliver to a given city on a given date, and the delivery fee.

Returns whether the requested date is available (if not, the next available
date plus reason) and the delivery fee the checkout will charge.

THE FEE DEPENDS ON THE CART AND THE CURRENCY — the city's base rate is not
what checkout charges. Sri Lankan customers (LKR) pay the city rate capped
by the cart value (25% of the item value, at least LKR 300; some remote
cities 50%), so a small cart to a far city pays far less than the rate.
Overseas customers (USD) pay a fixed USD fee per city, whatever the cart.
Pass `currency` and the `cart` you are about to order and the answer gives
the EXACT fee kapruka_create_order will charge ("Delivery fee for this
cart"). Without a cart, an LKR answer gives only the MOST the fee can be
("up to"). One shipment per order: the fee covers the whole cart.

Pass `product_id` whenever the customer has named a product: the answer then
also checks that ITEM's delivery scope (restaurant food, hotel cakes and
liquor only reach selected cities, typically the Colombo area). With a
product_id, `available` is true only if the date is open AND the item is
deliverable to that city. When `item_deliverable` is false, offer the
customer one of the returned `deliverable_cities` or an island-wide
alternative — do not attempt kapruka_create_order with the same city, it
will be rejected. An unknown product_id is silently ignored (no item fields
in the result), so check `item_deliverable` is present before relying on it.

product_id also selects the SAME-DAY rule the checkout applies to that item:
vendor-delivered items (restaurant food) can go today until late afternoon;
ordinary items move to the next date; ordinary same-day is only possible early
in the morning near Colombo. So a check without product_id can differ from one
with it — always pass it once an item is chosen. When `available` is false,
offer `next_available_date`. Do not interpret the `reason` text (it is the
website's wording and may say slots are full when the real cause is the cutoff).

ECONOMY DELIVERY (cheaper courier, a few days instead of a chosen date) is
worked out from the `cart` (and `gift_message`, which you should pass when
there is one). When the answer shows an economy option, offer it to the
customer as the cheaper choice, quoting its fee, promise wording and
"expected by" date as given; if they take it, call kapruka_create_order with
`delivery.type: "economy"` (the order is dated for you). When the answer says
the order goes by economy delivery, that is the ONLY option for these items:
tell the customer and order with `delivery.type: "economy"`. When economy is
not shown, do not mention it.

Perishable codes (CAKE*, FLOWER*, COMBO*) additionally get a freshness
warning when the chosen delivery date is more than 1 day out.

INTERNATIONAL GIFTS (store products from kapruka_gift_country_products): pass
product_id or cart (no city needed) and, for Australia / the UAE, `zone`. The
answer is that country's delivery: available or not, the fee for the whole order,
and the earliest date (3 days ahead; used when delivery_date is omitted).

Args:
    params (CheckDeliveryInput):
        - city (str): Canonical city name (e.g. 'Colombo 03', 'Galle'); not needed for
          international gift store products
        - zone (Optional[str]): international gifts in Australia / the UAE
        - delivery_date (Optional[str]): YYYY-MM-DD; defaults to today (LK time)
        - product_id (Optional[str]): Check the city against this item's delivery scope
        - currency (Optional[str]): LKR (default) or USD/GBP/AUD/EUR (charged in USD)
        - cart (Optional[list]): [{product_id, quantity, icing_text?}] for the exact fee
        - other_items_total (Optional[float]): LKR value of items not in `cart` (custom cake quote)
        - gift_message (Optional[str]): the order's gift message, for the economy rule
        - response_format (str): 'markdown' (default) or 'json'

Returns:
    str: Delivery feasibility + fee in the requested format.

    JSON schema:
    {
      "city": str,
      "now": str,                       # ISO timestamp, Sri Lanka time
      "checked_date": str,              # YYYY-MM-DD
      "available": bool,                # date open AND (if product_id) item deliverable
      "delivery_fee": number,           # what checkout charges (see fee_basis)
      "fee_currency": "LKR" | "USD",
      "fee_basis": "cart" | "max" | "fixed",  # exact for the cart | LKR without a cart: the most it can be | USD: same for any cart
      "fee_items_value": number,        # LKR item value the fee was computed from (fee_basis=cart)
      "fee_cart_error": str,            # the cart could not be priced (fee falls back to max)
      "rate": number,                   # the city's BASE rate (LKR) — not the checkout fee
      "currency": "LKR",
      "reason": str | null,             # date-block message, else "This item is not delivered to <City>."
      "next_available_date": str|null,  # only for date blocks
      "item_deliverable": bool,         # only when product_id resolved to a real product
      "deliverable_cities": [str],      # only when item_deliverable=false (capped at 60)
      "perishable_warning": str | null, # populated when product_id is perishable
      "economy": {                      # only with `cart`
        "available": bool,              # false: say nothing about economy
        "forced": bool,                 # true: economy is the ONLY option
        "fee": number, "currency": "LKR",
        "promise": str,                 # quote as given
        "delivery_date": str,           # "expected by" date; create_order uses it
        "saving": number | null         # vs the standard fee
      }
    }

Input Schema

NameRequiredDescriptionDefault
paramsYes

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed8 schema fields changed
    • addedInput schema / $defs / CheckDeliveryInput / properties / city / anyOf
      Added value: +[
      +  {
      +    "maxLength": 100,
      +    "minLength": 2,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • addedInput schema / $defs / CheckDeliveryInput / properties / city / default
      Added value: +null
    • changedInput schema / $defs / CheckDeliveryInput / properties / city / description
      Previous value: -"Canonical city name (use kapruka_list_delivery_cities to find one). Examples: 'Colombo 03', 'Anuradhapura', 'Galle'."New value: +"Canonical Sri Lanka city name (use kapruka_list_delivery_cities to find one). Examples: 'Colombo 03', 'Anuradhapura', 'Galle'. Required, except for international gift store products (their country comes from the item)."
    • removedInput schema / $defs / CheckDeliveryInput / properties / city / maxLength
      Removed value: -100
    • removedInput schema / $defs / CheckDeliveryInput / properties / city / minLength
      Removed value: -2
    • removedInput schema / $defs / CheckDeliveryInput / properties / city / type
      Removed value: -"string"
    • addedInput schema / $defs / CheckDeliveryInput / properties / zone
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maxLength": 60,
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "International gifts only: the recipient's zone in Australia or the UAE, from kapruka_gift_countries (e.g. 'Dubai', 'Dandenong').",
      +  "title": "Zone"
      +}
    • removedInput schema / $defs / CheckDeliveryInput / required
      Removed value: -[
      -  "city"
      -]
  2. Changed1 schema field changed
    • addedInput schema / $defs / CheckDeliveryInput / properties / gift_message
      Added value: +{
      +  "anyOf": [
      +    {
      +      "maxLength": 300,
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "The gift message you will send to kapruka_create_order, if any. Pass it with `cart` so the economy delivery option is worked out the way checkout will.",
      +  "title": "Gift Message"
      +}
  3. Changed4 schema fields changed
    • addedInput schema / $defs / CheckDeliveryInput / properties / cart
      Added value: +{
      +  "anyOf": [
      +    {
      +      "items": {
      +        "$ref": "#/$defs/DeliveryCartLine"
      +      },
      +      "maxItems": 30,
      +      "type": "array"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "The items the customer is buying (product_id, quantity, optional icing_text) — the same lines you will send to kapruka_create_order. With it the answer gives the EXACT delivery fee checkout will charge; without it, only the most it can be.",
      +  "title": "Cart"
      +}
    • addedInput schema / $defs / CheckDeliveryInput / properties / currency
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "The currency the customer will check out in (LKR or USD; GBP/AUD/EUR check out in USD). Decides which delivery fee applies: Sri Lankan customers pay a fee capped by the cart value, overseas customers a fixed USD fee. Default LKR.",
      +  "title": "Currency"
      +}
    • addedInput schema / $defs / CheckDeliveryInput / properties / other_items_total
      Added value: +{
      +  "anyOf": [
      +    {
      +      "minimum": 0,
      +      "type": "number"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "LKR value of items not listed in `cart` (e.g. a quoted custom cake's total). Added to the cart value for the fee.",
      +  "title": "Other Items Total"
      +}
    • addedInput schema / $defs / DeliveryCartLine
      Added value: +{
      +  "description": "A catalogue cart line, the same shape kapruka_create_order takes.\n\nCustom cake lines cannot be priced here; pass the quote's total as\n`other_items_total` instead.",
      +  "properties": {
      +    "icing_text": {
      +      "anyOf": [
      +        {
      +          "maxLength": 120,
      +          "type": "string"
      +        },
      +        {
      +          "type": "null"
      +        }
      +      ],
      +      "default": null,
      +      "description": "Set when the cake carries icing text — the checkout adds a small charge for it.",
      +      "title": "Icing Text"
      +    },
      +    "product_id": {
      +      "maxLength": 50,
      +      "minLength": 3,
      +      "pattern": "^[A-Za-z0-9_\\-]+$",
      +      "title": "Product Id",
      +      "type": "string"
      +    },
      +    "quantity": {
      +      "default": 1,
      +      "maximum": 99,
      +      "minimum": 1,
      +      "title": "Quantity",
      +      "type": "integer"
      +    }
      +  },
      +  "required": [
      +    "product_id"
      +  ],
      +  "title": "DeliveryCartLine",
      +  "type": "object"
      +}
  4. Changed2 schema fields changed
    • changedInput schema / $defs / CheckDeliveryInput / properties / product_id / anyOf
      Previous value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "maxLength": 80,
      +    "type": "string"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / $defs / CheckDeliveryInput / properties / product_id / description
      Previous value: -"Optional product ID. If provided and the product looks perishable (cake/flower/combo codes), a freshness warning is added when the chosen date is more than 1 day out."New value: +"Product ID to check the city AGAINST THAT ITEM'S delivery scope. Food, hotel cakes and liquor only reach selected cities — always pass this when a customer names a product and a city, and only promise delivery if `available` is true. Also adds a freshness warning for perishable codes (cake/flower/combo) when the date is >1 day out."
  5. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already declare readOnlyHint/openWorldHint, so the bar is lower, yet the description adds real behavioral context: the fee is cart- and currency-dependent (25% cap, LKR 300 floor, 50% for some remote cities, fixed USD abroad), an unknown product_id is silently ignored so `item_deliverable` must be checked for presence, the same-day cutoff differs by vendor-delivered items, and the `reason` text must not be interpreted. These are non-obvious failure modes an agent could not infer from annotations or schema.

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

Conciseness3/5

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

Front-loaded with the core purpose, and the mid-section prose on fee mechanics is dense and earns its place. However the trailing 'Args' and 'Returns' blocks restate the input schema and the full output schema verbatim, which is redundant given `has output schema: true`. The result is far longer than needed for an agent that can read the structured fields.

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 tool with fee logic, per-item delivery scope, currency branching, economy shipping, perishables and an international-gifts path, the description covers every branch an agent must handle, including the international case where no city is needed and a `zone` substitute applies. Nothing required to call it correctly is missing.

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

Parameters4/5

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

The nested schema already documents every field, and the description's Args block largely restates it. Where it earns credit is the added semantics: `cart`+`currency` change the answer from 'up to' to the exact fee, `other_items_total` covers custom cakes that cannot be priced as cart lines, and `gift_message` feeds the economy rule. Useful additions, though much is duplicated from the schema.

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?

Opens with a specific verb+resource+scope: 'Check whether Kapruka can deliver to a given city on a given date, and the delivery fee.' That is immediately distinguishable from siblings like kapruka_create_order (writes), kapruka_list_delivery_cities (enumerates cities) and kapruka_track_order. The description also names the downstream action it gates, so an agent can place it in the workflow without opening another schema.

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?

Explicit routing throughout: pass `product_id` whenever a customer names a product; pass `cart` and `currency` to get the exact checkout fee; if `item_deliverable` is false, 'do not attempt kapruka_create_order with the same city, it will be rejected' and instead offer `deliverable_cities`. It also states when to offer economy delivery (only when the answer shows it) and when to stay silent ('When economy is not shown, do not mention it'). When/when-not and the alternative action are both spelled out.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.