Skip to main content
Glama

get_user_zip_code

Retrieve the user's zip code to enable accurate store location and product availability checks for grocery shopping with Kroger services.

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 handler function for the 'get_user_zip_code' tool. It retrieves the default zip code using the helper function 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
  • Registration of the location_tools module, which includes the get_user_zip_code tool, in the main MCP server.
    location_tools.register_tools(mcp)
  • Helper function used by the get_user_zip_code tool to obtain the default zip code from environment variables.
    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