get_chain_details
Retrieve specific details about Kroger store chains by providing the chain name, enabling users to access comprehensive information for grocery shopping decisions.
Instructions
Get detailed information about a specific Kroger chain.
Args:
chain_name: Name of the chain to get details for
Returns:
Dictionary containing chain details
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain_name | Yes |
Implementation Reference
- The handler function for 'get_chain_details' tool. It takes a chain_name parameter, uses get_client_credentials_client to fetch chain details from the Kroger API, and returns formatted chain information or error details.@mcp.tool() async def get_chain_details( chain_name: str, ctx: Context = None ) -> Dict[str, Any]: """ Get detailed information about a specific Kroger chain. Args: chain_name: Name of the chain to get details for Returns: Dictionary containing chain details """ if ctx: await ctx.info(f"Getting details for chain: {chain_name}") client = get_client_credentials_client() try: chain_details = client.location.get_chain(chain_name) if not chain_details or "data" not in chain_details: return { "success": False, "message": f"Chain '{chain_name}' not found" } chain = chain_details["data"] return { "success": True, "name": chain.get("name"), "division_numbers": chain.get("divisionNumbers", []) } except Exception as e: if ctx: await ctx.error(f"Error getting chain details: {str(e)}") return { "success": False, "error": str(e) }
- src/kroger_mcp/server.py:71-79 (registration)Top-level registration in the MCP server where info_tools.register_tools(mcp) is called, which in turn registers the get_chain_details tool via @mcp.tool() decorator.# Register all tools from the modules location_tools.register_tools(mcp) product_tools.register_tools(mcp) cart_tools.register_tools(mcp) info_tools.register_tools(mcp) profile_tools.register_tools(mcp) utility_tools.register_tools(mcp) auth_tools.register_tools(mcp)