get_department_details
Retrieve detailed information about a specific Kroger department using its unique identifier to access product categories and organizational data.
Instructions
Get detailed information about a specific department.
Args:
department_id: The unique identifier for the department
Returns:
Dictionary containing department details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| department_id | Yes |
Implementation Reference
- The handler function for the 'get_department_details' tool. It retrieves detailed information about a specific department using the Kroger API client, handles errors, and provides logging via context.@mcp.tool() async def get_department_details( department_id: str, ctx: Context = None ) -> Dict[str, Any]: """ Get detailed information about a specific department. Args: department_id: The unique identifier for the department Returns: Dictionary containing department details """ if ctx: await ctx.info(f"Getting details for department: {department_id}") client = get_client_credentials_client() try: dept_details = client.location.get_department(department_id) if not dept_details or "data" not in dept_details: return { "success": False, "message": f"Department '{department_id}' not found" } dept = dept_details["data"] return { "success": True, "department_id": dept.get("departmentId"), "name": dept.get("name") } except Exception as e: if ctx: await ctx.error(f"Error getting department details: {str(e)}") return { "success": False, "error": str(e) }
- src/kroger_mcp/server.py:75-75 (registration)Registers all tools from the info_tools module, including 'get_department_details', with the FastMCP server instance.info_tools.register_tools(mcp)