Overview
Redis tool allows you to interact with Redis for caching, key-value storage, and pub/sub messaging.Installation
Environment Variables
Quick Start
1
Simple Usage
2
With Configuration
Use the same tool with an agent — see Usage with Agent below, or pass env vars and options from the sections above.
How It Works
Usage with Agent
Available Methods
get(key)
Get a value by key.set(key, value, ttl=None)
Set a key-value pair with optional TTL.delete(key)
Delete a key.keys(pattern)
Find keys matching a pattern.hget/hset
Hash operations.Docker Setup
Common Errors
Best Practices
Load the password from the environment
Load the password from the environment
Read
REDIS_PASSWORD from the environment instead of hard-coding it in the tool call.Set a TTL on cached keys
Set a TTL on cached keys
set(key, value, ttl=3600) expires keys automatically. Use TTLs so agent-written cache entries do not grow unbounded.Use scoped key patterns
Use scoped key patterns
Namespace keys (e.g.
user:123:name) so agents can filter with keys(pattern) without scanning the whole store.Related Tools
MongoDB
NoSQL database
PostgreSQL
SQL database
Upstash
Serverless Redis

