hdel
Remove a specific field from a Redis hash to manage stored data by specifying the hash key and field name.
Instructions
Delete a field from a Redis hash.
Args: name: The Redis hash key. key: The field name inside the hash.
Returns: A success message or an error message.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| key | Yes |
Implementation Reference
- src/tools/hash.py:58-78 (handler)The 'hdel' tool handler: an async function that deletes a specified field from a Redis hash using hdel, returns success or not found message, handles RedisError. Registered via @mcp.tool() decorator.@mcp.tool() async def hdel(name: str, key: str) -> str: """Delete a field from a Redis hash. Args: name: The Redis hash key. key: The field name inside the hash. Returns: A success message or an error message. """ try: r = RedisConnectionManager.get_connection() deleted = r.hdel(name, key) return ( f"Field '{key}' deleted from hash '{name}'." if deleted else f"Field '{key}' not found in hash '{name}'." ) except RedisError as e: return f"Error deleting field '{key}' from hash '{name}': {str(e)}"
- src/tools/hash.py:58-58 (registration)The @mcp.tool() decorator registers the hdel function as an MCP tool.@mcp.tool()