Skip to main content
Glama

view_order_history

Access and review the history of placed orders through the Kroger MCP Server. View recent transactions marked as placed within the system, up to a specified limit (1-50), returning structured order details.

Instructions

View the history of placed orders. Note: This tool can only see orders that were explicitly marked as placed via this MCP server. The Kroger API does not provide permission to query the actual order history from Kroger's systems. Args: limit: Number of recent orders to show (1-50) Returns: Dictionary containing order history

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • The main handler function for the 'view_order_history' tool. It loads order history from a local JSON file, applies limits and sorting, computes summary statistics, and returns the results. Uses local storage since Kroger API does not expose order history.
    @mcp.tool() async def view_order_history( limit: int = 10, ctx: Context = None ) -> Dict[str, Any]: """ View the history of placed orders. Note: This tool can only see orders that were explicitly marked as placed via this MCP server. The Kroger API does not provide permission to query the actual order history from Kroger's systems. Args: limit: Number of recent orders to show (1-50) Returns: Dictionary containing order history """ try: # Ensure limit is within bounds limit = max(1, min(50, limit)) order_history = _load_order_history() # Sort by placed_at date (most recent first) and limit sorted_orders = sorted(order_history, key=lambda x: x.get("placed_at", ""), reverse=True) limited_orders = sorted_orders[:limit] # Calculate summary stats total_orders = len(order_history) total_items_all_time = sum(order.get("item_count", 0) for order in order_history) total_quantity_all_time = sum(order.get("total_quantity", 0) for order in order_history) return { "success": True, "orders": limited_orders, "showing": len(limited_orders), "summary": { "total_orders": total_orders, "total_items_all_time": total_items_all_time, "total_quantity_all_time": total_quantity_all_time } } except Exception as e: return { "success": False, "error": f"Failed to view order history: {str(e)}" }
  • The registration block in the main server file where cart_tools.register_tools(mcp) is called, which in turn registers the view_order_history tool via its @mcp.tool() decorator.
    # Register all tools from the modules 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 the order history data from the local JSON file, used by view_order_history.
    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 []

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