Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

hdel

Remove a specific field from a Redis hash by specifying the hash key and field name. Simplifies data management in Redis by enabling precise deletion of hash fields.

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
NameRequiredDescriptionDefault
keyYes
nameYes

Implementation Reference

  • The main handler function for the 'hdel' tool. It is decorated with @mcp.tool() which registers it as an MCP tool. The function deletes a specified field from a Redis hash and returns a success message if deleted or indicates if not found, handling Redis errors appropriately.
    @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)}"

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