Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

srem

Remove a specific value from a Redis set to maintain accurate data by deleting unwanted elements from the collection.

Instructions

Remove a value from a Redis set.

Args: name: The Redis set key. value: The value to remove from the set.

Returns: A success message or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
valueYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'srem' tool, decorated with @mcp.tool() for registration. It removes a value from a Redis set using r.srem and returns appropriate success or error messages.
    @mcp.tool()
    async def srem(name: str, value: str) -> str:
        """Remove a value from a Redis set.
    
        Args:
            name: The Redis set key.
            value: The value to remove from the set.
    
        Returns:
            A success message or an error message.
        """
        try:
            r = RedisConnectionManager.get_connection()
            removed = r.srem(name, value)
            return (
                f"Value '{value}' removed from set '{name}'."
                if removed
                else f"Value '{value}' not found in set '{name}'."
            )
        except RedisError as e:
            return f"Error removing value '{value}' from set '{name}': {str(e)}"
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 states basic functionality. It doesn't disclose whether this operation is atomic, what happens if the value doesn't exist in the set, permission requirements, or error conditions beyond mentioning 'error message' in returns.

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

Conciseness5/5

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

Perfectly structured with a clear purpose statement followed by Args and Returns sections. Every sentence earns its place: the first sentence defines the operation, subsequent lines document parameters and return values without redundancy.

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 the tool's moderate complexity (mutation operation), no annotations, but having an output schema, the description covers basics adequately. However, it lacks details about behavioral aspects like idempotency, error scenarios, or performance characteristics that would be helpful for an agent.

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 for both parameters: 'name' is clarified as 'The Redis set key' (not just any key) and 'value' as 'The value to remove from the set'. With 0% schema description coverage and only 2 parameters, this adequately compensates by explaining what each parameter represents in the Redis context.

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 ('Remove a value from') and resource ('a Redis set'), distinguishing it from sibling tools like 'delete' (general key deletion) or 'zrem' (sorted set removal). It precisely defines the tool's scope within the Redis operations context.

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 'delete' (for entire keys) or 'zrem' (for sorted sets). The description assumes Redis set context but doesn't explicitly state prerequisites or comparison with similar operations.

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