Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

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

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • 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)}"
  • The @mcp.tool() decorator registers the hdel function as an MCP tool.
    @mcp.tool()
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but only minimally discloses behavior. It states the tool deletes a field (implying mutation) and returns a success/error message, but lacks details on permissions, side effects (e.g., if the hash becomes empty), error conditions, or idempotency. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded with the core purpose in the first sentence. The Args/Returns sections are structured but slightly verbose; 'Returns' could be more concise (e.g., 'Success or error message'). Overall, it's efficient with minimal waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given a mutation tool with no annotations, 0% schema coverage, but an output schema (implied by 'Has output schema: true'), the description is moderately complete. It covers parameters well and notes the return type, but lacks behavioral context (e.g., safety, errors) and doesn't leverage the output schema to detail return values. This leaves gaps for safe invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate—and it does excellently. It explicitly defines both parameters ('name' as the Redis hash key, 'key' as the field name inside the hash), adding crucial meaning beyond the schema's generic titles. This fully addresses the coverage gap with clear, actionable semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Delete a field from a Redis hash') with the exact resource ('Redis hash'), distinguishing it from sibling tools like 'delete' (which likely deletes entire keys) and 'hget'/'hset' (which read/write hash fields). The verb 'Delete' is precise and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. While it's implied this is for hash field deletion (vs. 'delete' for keys or 'srem' for sets), there's no explicit mention of prerequisites, constraints, or comparisons to siblings like 'json_del' or 'xdel' for other data structures.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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