Skip to main content
Glama
CupOfOwls

Kroger MCP Server

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
NameRequiredDescriptionDefault
department_idYes

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)
            }
  • Registers all tools from the info_tools module, including 'get_department_details', with the FastMCP server instance.
    info_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