Skip to main content
Glama
CupOfOwls

Kroger MCP Server

get_location_details

Retrieve detailed information about a specific Kroger store location using its unique identifier, including store hours, services, and contact details.

Instructions

    Get detailed information about a specific Kroger store location.
    
    Args:
        location_id: The unique identifier for the store location
    
    Returns:
        Dictionary containing detailed location information
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
location_idYes

Implementation Reference

  • Implements the core logic for the get_location_details tool: fetches location data from Kroger API, formats departments and address, handles errors.
    @mcp.tool()
    async def get_location_details(
        location_id: str,
        ctx: Context = None
    ) -> Dict[str, Any]:
        """
        Get detailed information about a specific Kroger store location.
        
        Args:
            location_id: The unique identifier for the store location
        
        Returns:
            Dictionary containing detailed location information
        """
        if ctx:
            await ctx.info(f"Getting details for location {location_id}")
        
        client = get_client_credentials_client()
        
        try:
            location_details = client.location.get_location(location_id)
            
            if not location_details or "data" not in location_details:
                return {
                    "success": False,
                    "message": f"Location {location_id} not found"
                }
            
            loc = location_details["data"]
            
            # Format department information
            departments = []
            for dept in loc.get("departments", []):
                dept_info = {
                    "department_id": dept.get("departmentId"),
                    "name": dept.get("name"),
                    "phone": dept.get("phone")
                }
                
                # Add department hours
                if "hours" in dept and "monday" in dept["hours"]:
                    monday = dept["hours"]["monday"]
                    if monday.get("open24", False):
                        dept_info["hours_monday"] = "Open 24 hours"
                    elif "open" in monday and "close" in monday:
                        dept_info["hours_monday"] = f"{monday['open']} - {monday['close']}"
                
                departments.append(dept_info)
            
            # Format the response
            address = loc.get("address", {})
            result = {
                "success": True,
                "location_id": loc.get("locationId"),
                "name": loc.get("name"),
                "chain": loc.get("chain"),
                "phone": loc.get("phone"),
                "address": {
                    "street": address.get("addressLine1", ""),
                    "street2": address.get("addressLine2", ""),
                    "city": address.get("city", ""),
                    "state": address.get("state", ""),
                    "zip_code": address.get("zipCode", "")
                },
                "coordinates": loc.get("geolocation", {}),
                "departments": departments,
                "department_count": len(departments)
            }
            
            return result
            
        except Exception as e:
            if ctx:
                await ctx.error(f"Error getting location details: {str(e)}")
            return {
                "success": False,
                "error": str(e)
            }
  • Registers all location tools including get_location_details by calling the register_tools function from the location_tools module.
    location_tools.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