Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

delete

Remove a specified key from Redis to manage data storage and maintain database efficiency.

Instructions

Delete a Redis key.

Args: key (str): The key to delete.

Returns: str: Confirmation message or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the 'delete' tool. It deletes the specified Redis key using the Redis client's delete method and returns a success or not-found message. Registered via the @mcp.tool() decorator, which also defines the input schema via type hints and docstring.
    @mcp.tool()
    async def delete(key: str) -> str:
        """Delete a Redis key.
    
        Args:
            key (str): The key to delete.
    
        Returns:
            str: Confirmation message or an error message.
        """
        try:
            r = RedisConnectionManager.get_connection()
            result = r.delete(key)
            return f"Successfully deleted {key}" if result else f"Key {key} not found"
        except RedisError as e:
            return f"Error deleting key {key}: {str(e)}"
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the action ('Delete') but fails to specify critical details: whether deletion is permanent, if it requires specific permissions, error handling for non-existent keys, or confirmation message format. This leaves significant gaps for a destructive operation.

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 front-loaded with the core action ('Delete a Redis key'), followed by structured sections for Args and Returns. It avoids unnecessary details, though the formatting could be slightly more streamlined (e.g., integrating Args into the main text).

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?

For a destructive tool with no annotations and an output schema (which covers return values), the description is minimally adequate. It states the action and parameter but lacks behavioral context like permanence or error conditions. Given the complexity, it should provide more guidance on usage and risks.

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

Parameters4/5

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

The description adds meaningful context beyond the input schema, which has 0% coverage. It specifies that the 'key' parameter is a string representing the Redis key to delete, clarifying its purpose. With only one parameter, this is sufficient to compensate for the schema's lack of descriptions.

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') and resource ('a Redis key'), distinguishing it from siblings like 'json_del' (for JSON data) and 'xdel' (for stream entries). It precisely identifies the tool's function without ambiguity.

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 like 'json_del' (for JSON keys), 'hdel' (for hash fields), or 'srem' (for set members). The description lacks context about prerequisites, such as key existence, or exclusions, like not working on non-existent keys.

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