Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

hgetall

Retrieve all field-value pairs from a specified Redis hash to access and manage stored data efficiently. Input the hash key to return a dictionary or error message.

Instructions

Get all fields and values from a Redis hash.

Args: name: The Redis hash key.

Returns: A dictionary of field-value pairs or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes

Implementation Reference

  • The hgetall tool handler: async function decorated with @mcp.tool() that retrieves all fields from a Redis hash using r.hgetall(name), returns dict or error string.
    @mcp.tool() async def hgetall(name: str) -> dict: """Get all fields and values from a Redis hash. Args: name: The Redis hash key. Returns: A dictionary of field-value pairs or an error message. """ try: r = RedisConnectionManager.get_connection() hash_data = r.hgetall(name) return ( {k: v for k, v in hash_data.items()} if hash_data else f"Hash '{name}' is empty or does not exist." ) except RedisError as e: return f"Error getting all fields from hash '{name}': {str(e)}"

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/redis/mcp-redis'

If you have feedback or need assistance with the MCP directory API, please join our Discord server