json_del
Remove specific JSON values stored in Redis by specifying the key and JSON path. Simplify data management by deleting targeted elements directly.
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-90 (handler)The main handler function for the 'json_del' tool. It is decorated with @mcp.tool(), which likely handles both definition and registration. Implements deletion of JSON values in Redis using jsonpath-like paths.@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)}"
- src/tools/json.py:70-70 (registration)The @mcp.tool() decorator registers the json_del function as an MCP tool.@mcp.tool()