Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

json_del

Remove JSON values from Redis at specified paths to manage and clean stored data efficiently.

Instructions

Delete a JSON value from Redis at a given path.

Args: name: The Redis key where the JSON document is stored. path: The JSON path to delete (default: root '$').

Returns: A success message or an error message.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
pathNo$

Implementation Reference

  • The json_del tool handler function, decorated with @mcp.tool() which also handles registration. It deletes a JSON value at the specified path in a Redis-stored JSON document and returns a success or error message.
    @mcp.tool()
    async def json_del(name: str, path: str = "$") -> str:
        """Delete a JSON value from Redis at a given path.
    
        Args:
            name: The Redis key where the JSON document is stored.
            path: The JSON path to delete (default: root '$').
    
        Returns:
            A success message or an error message.
        """
        try:
            r = RedisConnectionManager.get_connection()
            deleted = r.json().delete(name, path)
            return (
                f"Deleted JSON value at path '{path}' in '{name}'."
                if deleted
                else f"No JSON value found at path '{path}' in '{name}'."
            )
        except RedisError as e:
            return f"Error deleting JSON value at path '{path}' in '{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