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
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | ||
| name | Yes |
Implementation Reference
- src/tools/hash.py:103-118 (handler)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)}"
- src/tools/hash.py:103-103 (registration)The @mcp.tool() decorator registers the hexists function as an MCP tool.@mcp.tool()