Skip to main content
Glama
CupOfOwls

Kroger MCP Server

list_chains

Retrieve information about all Kroger-owned grocery store chains to identify available shopping locations and services.

Instructions

    Get a list of all Kroger-owned chains.
    
    Returns:
        Dictionary containing chain information
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the 'list_chains' tool. It retrieves the list of Kroger chains using the client API, formats the data, provides context feedback, handles errors, and returns a structured dictionary.
    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": []
            }
  • Registration block in the server creation where info_tools.register_tools(mcp) is called at line 75, registering the list_chains tool along with others.
    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)
  • Helper function used by list_chains to obtain a KrogerAPI client with client credentials for accessing public location data.
    def get_client_credentials_client() -> KrogerAPI:
        """Get or create a client credentials authenticated client for public data"""
        global _client_credentials_client
        
        if _client_credentials_client is not None and _client_credentials_client.test_current_token():
            return _client_credentials_client
        
        _client_credentials_client = None
        
        try:
            load_and_validate_env(["KROGER_CLIENT_ID", "KROGER_CLIENT_SECRET"])
            _client_credentials_client = KrogerAPI()
            
            # Try to load existing token first
            token_file = ".kroger_token_client_product.compact.json"
            token_info = load_token(token_file)
            
            if token_info:
                # Test if the token is still valid
                _client_credentials_client.client.token_info = token_info
                if _client_credentials_client.test_current_token():
                    # Token is valid, use it
                    return _client_credentials_client
            
            # Token is invalid or not found, get a new one
            token_info = _client_credentials_client.authorization.get_token_with_client_credentials("product.compact")
            return _client_credentials_client
        except Exception as e:
            raise Exception(f"Failed to get client credentials: {str(e)}")
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states that the tool returns a dictionary with chain information, but doesn't cover critical aspects like whether it's a read-only operation, potential rate limits, authentication requirements, or error handling. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded, with the main purpose stated clearly in the first sentence. The second sentence about the return value adds useful information without redundancy. However, the formatting includes extra whitespace and could be slightly more polished, preventing a perfect score.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no output schema), the description is adequate but minimal. It covers the basic purpose and return type, but lacks details on authentication, data format, or error cases. With no annotations to supplement, it meets the minimum viable standard but leaves room for improvement in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the input schema has 100% description coverage (though empty). The description doesn't need to explain any parameters, which is appropriate. Since there are no parameters to document, a baseline score of 4 is warranted, as it avoids unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get a list of all Kroger-owned chains.' It uses a specific verb ('Get') and identifies the resource ('Kroger-owned chains'), making the action and target explicit. However, it doesn't differentiate from sibling tools like 'check_chain_exists' or 'get_chain_details', which limits its score to 4 instead of 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention when to prefer 'list_chains' over 'check_chain_exists' or 'get_chain_details', nor does it specify any prerequisites or exclusions. Without such context, the agent lacks clear usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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