check_location_exists
Verify if a specific Kroger store location exists in the system by providing its unique identifier. This tool confirms location availability before proceeding with grocery shopping tasks.
Instructions
Check if a location exists in the Kroger system.
Args:
location_id: The unique identifier for the store location
Returns:
Dictionary indicating whether the location exists
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| location_id | Yes |
Implementation Reference
- The main handler function for the 'check_location_exists' MCP tool. It uses the Kroger client to check if a location ID exists and returns a structured response.@mcp.tool() async def check_location_exists( location_id: str, ctx: Context = None ) -> Dict[str, Any]: """ Check if a location exists in the Kroger system. Args: location_id: The unique identifier for the store location Returns: Dictionary indicating whether the location exists """ if ctx: await ctx.info(f"Checking if location {location_id} exists") client = get_client_credentials_client() try: exists = client.location.location_exists(location_id) return { "success": True, "location_id": location_id, "exists": exists, "message": f"Location {location_id} {'exists' if exists else 'does not exist'}" } except Exception as e: if ctx: await ctx.error(f"Error checking location existence: {str(e)}") return { "success": False, "error": str(e) }
- src/kroger_mcp/server.py:72-72 (registration)Calls register_tools from location_tools module, which defines and registers the check_location_exists tool among others.location_tools.register_tools(mcp)