Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

hexists

Verify the existence of a specific field within a Redis hash by providing the hash key and field name. Returns True if the field exists, False otherwise.

Instructions

Check if a field exists in a Redis hash.

Args: name: The Redis hash key. key: The field name inside the hash.

Returns: True if the field exists, False otherwise.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes
nameYes

Implementation Reference

  • The hexists tool handler: an async function decorated with @mcp.tool() for registration. It connects to Redis via RedisConnectionManager and calls r.hexists(name, key) to check if the specified field exists in the hash, returning True/False or error string.
    @mcp.tool() async def hexists(name: str, key: str) -> bool: """Check if a field exists in a Redis hash. Args: name: The Redis hash key. key: The field name inside the hash. Returns: True if the field exists, False otherwise. """ try: r = RedisConnectionManager.get_connection() return r.hexists(name, key) except RedisError as e: return f"Error checking existence of field '{key}' in hash '{name}': {str(e)}"
  • The @mcp.tool() decorator registers the hexists function as an MCP tool.
    @mcp.tool()

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