Skip to main content
Glama

mark_order_placed

Confirm and finalize a completed Kroger order by marking the cart as placed, moving it to order history, and optionally adding notes for future reference.

Instructions

Mark the current cart as an order that has been placed and move it to order history. Use this after you've completed checkout on the Kroger website/app. Args: order_notes: Optional notes about the order Returns: Dictionary confirming the order was recorded

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
order_notesNo

Implementation Reference

  • The core handler function for the 'mark_order_placed' tool. It loads the current cart from local storage, validates it has items, creates an order record, appends it to order history, clears the current cart, and returns a success response with order details.
    @mcp.tool() async def mark_order_placed( order_notes: str = None, ctx: Context = None ) -> Dict[str, Any]: """ Mark the current cart as an order that has been placed and move it to order history. Use this after you've completed checkout on the Kroger website/app. Args: order_notes: Optional notes about the order Returns: Dictionary confirming the order was recorded """ try: cart_data = _load_cart_data() current_cart = cart_data.get("current_cart", []) if not current_cart: return { "success": False, "error": "No items in current cart to mark as placed" } # Create order record order_record = { "items": current_cart.copy(), "placed_at": datetime.now().isoformat(), "item_count": len(current_cart), "total_quantity": sum(item.get("quantity", 0) for item in current_cart), "notes": order_notes } # Load and update order history order_history = _load_order_history() order_history.append(order_record) _save_order_history(order_history) # Clear current cart cart_data["current_cart"] = [] cart_data["last_updated"] = datetime.now().isoformat() _save_cart_data(cart_data) return { "success": True, "message": f"Marked order with {order_record['item_count']} items as placed", "order_id": len(order_history), # Simple order ID based on history length "items_placed": order_record["item_count"], "total_quantity": order_record["total_quantity"], "placed_at": order_record["placed_at"] } except Exception as e: return { "success": False, "error": f"Failed to mark order as placed: {str(e)}" }
  • Registers the cart tools module, which includes the definition and registration of the mark_order_placed tool via the @mcp.tool() decorator inside cart_tools.register_tools(mcp).
    location_tools.register_tools(mcp) product_tools.register_tools(mcp) cart_tools.register_tools(mcp) info_tools.register_tools(mcp) profile_tools.register_tools(mcp) utility_tools.register_tools(mcp) auth_tools.register_tools(mcp)
  • Helper function to load order history from local JSON file, used by mark_order_placed.
    def _load_order_history() -> List[Dict[str, Any]]: """Load order history from file""" try: if os.path.exists(ORDER_HISTORY_FILE): with open(ORDER_HISTORY_FILE, 'r') as f: return json.load(f) except Exception: pass return []
  • Helper function to save order history to local JSON file, used by mark_order_placed.
    def _save_order_history(history: List[Dict[str, Any]]) -> None: """Save order history to file""" try: with open(ORDER_HISTORY_FILE, 'w') as f: json.dump(history, f, indent=2) except Exception as e: print(f"Warning: Could not save order history: {e}")
  • The register_tools function defines and registers all cart tools including mark_order_placed using @mcp.tool() decorators.
    def register_tools(mcp):

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/CupOfOwls/kroger-mcp'

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