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).

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

Args:
    params (CheckDeliveryInput):
        - city (str): Canonical city name (e.g. 'Colombo 03', 'Galle')
        - 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)
        - 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
    }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +}
  2. 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."
  3. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already mark it read-only/non-destructive, but the description adds substantial behavior the annotations cannot carry: fee depends on cart+currency, LKR fees are capped at 25% of item value (min LKR 300, 50% for remote cities) while USD is fixed, an unknown product_id is silently ignored, and the `reason` text must not be interpreted. This is exactly the kind of non-obvious trait an agent needs.

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 answer, but the block is long and the Args section duplicates the input schema's own descriptions nearly verbatim, plus it repeats the full output schema already declared in the tool definition. Some sentences (same-day rule, perishable warning) earn their place; others are redundant.

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 an output schema and rich annotations, the description covers everything an agent needs: fee-basis semantics ('cart'/'max'/'fixed'), the product_id/item_deliverable interaction, date fallback via next_available_date, and the warning that a no-product_id check may differ from one with it.

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 schema itself is richly described, and the prose Args section largely restates it, so marginal value is limited. It does add genuine semantics beyond the schema, e.g. that `cart` must match the lines sent to create_order and that omitting it yields an 'up to' rather than exact fee.

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?

States a specific verb+resource+scope: checks delivery feasibility of a city on a date and returns the delivery fee. It is clearly distinguishable from siblings, and explicitly frames itself as the pre-flight check that predicts what kapruka_create_order will charge.

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?

Gives explicit when-to-use rules (pass `cart` for the exact fee, pass `product_id` whenever a product is named, check `item_deliverable` before relying on it) and a when-not-to: do not attempt kapruka_create_order with the same city when `item_deliverable` is false. Alternatives are named (deliverable_cities, island-wide alternative).

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.