get_user_profile
Retrieve authenticated user profile data from Kroger, including personal information and account details for grocery shopping services.
Instructions
Get the authenticated user's Kroger profile information.
Returns:
Dictionary containing user profile data
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The main handler function for the 'get_user_profile' tool. It retrieves the authenticated user's Kroger profile using the Identity API client, returning the profile ID and success status.async def get_user_profile(ctx: Context = None) -> Dict[str, Any]: """ Get the authenticated user's Kroger profile information. Returns: Dictionary containing user profile data """ if ctx: await ctx.info("Getting user profile information") try: client = get_authenticated_client() profile = client.identity.get_profile() if profile and "data" in profile: profile_id = profile["data"].get("id", "N/A") if ctx: await ctx.info(f"Retrieved profile for user ID: {profile_id}") return { "success": True, "profile_id": profile_id, "message": "User profile retrieved successfully", "note": "The Kroger Identity API only provides the profile ID for privacy reasons." } else: return { "success": False, "message": "Failed to retrieve user profile" } except Exception as e: if ctx: await ctx.error(f"Error getting user profile: {str(e)}") return { "success": False, "error": str(e) }
- src/kroger_mcp/server.py:76-76 (registration)Registers the profile tools, including 'get_user_profile', by calling the register_tools function from the profile_tools module.profile_tools.register_tools(mcp)