list_chains
Retrieve a detailed list of all Kroger-owned chains for store identification and location-based services.
Instructions
Get a list of all Kroger-owned chains.
Returns:
Dictionary containing chain information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/kroger_mcp/tools/info_tools.py:14-62 (handler)The main handler function for the 'list_chains' tool. It uses get_client_credentials_client() to get a client, calls client.location.list_chains(), formats the data, and returns a structured dictionary with success status.@mcp.tool() async def list_chains(ctx: Context = None) -> Dict[str, Any]: """ Get a list of all Kroger-owned chains. Returns: Dictionary containing chain information """ if ctx: await ctx.info("Getting list of Kroger chains") client = get_client_credentials_client() try: chains = client.location.list_chains() if not chains or "data" not in chains or not chains["data"]: return { "success": False, "message": "No chains found", "data": [] } # Format chain data formatted_chains = [ { "name": chain.get("name"), "division_numbers": chain.get("divisionNumbers", []) } for chain in chains["data"] ] if ctx: await ctx.info(f"Found {len(formatted_chains)} chains") return { "success": True, "count": len(formatted_chains), "data": formatted_chains } except Exception as e: if ctx: await ctx.error(f"Error listing chains: {str(e)}") return { "success": False, "error": str(e), "data": [] }
- src/kroger_mcp/server.py:75-75 (registration)The registration of all info_tools, including 'list_chains', by calling the module's register_tools function on the MCP server instance.info_tools.register_tools(mcp)