Skip to main content
Glama

get_user_zip_code

Retrieve the user's zip code to ensure accurate location-based services, such as store finding and product searching, within the Kroger MCP Server system.

Instructions

Returns user zip code, it is anticipated that by exposing this to the LLM it will choose to use it rather than generating a zip code based on system data. Args: N/A Returns: Dictionary containing user Zip Code

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for the get_user_zip_code tool, decorated with @mcp.tool() for registration. It retrieves the default zip code using get_default_zip_code() and returns it in a dictionary.
    @mcp.tool() async def get_user_zip_code() -> Dict[str, Any]: """ Returns user zip code, it is anticipated that by exposing this to the LLM it will choose to use it rather than generating a zip code based on system data. Args: N/A Returns: Dictionary containing user Zip Code """ zip_code = get_default_zip_code() # And thats literally it! user_zip_dict = {"user_zip_code": zip_code} return user_zip_dict
  • Calls register_tools from location_tools module on the MCP server instance, which defines and registers the get_user_zip_code tool among others.
    location_tools.register_tools(mcp)
  • Helper utility function that fetches the default zip code from environment variables (via kroger_api.utils.env.get_zip_code), used directly by the get_user_zip_code tool handler.
    def get_default_zip_code() -> str: """Get the default zip code from environment or fallback""" return get_zip_code(default="10001")

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