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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| path | No | $ |
Implementation Reference
- src/tools/json.py:70-91 (handler)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)}"