redis_scan
Enumerate Redis keys using cursor-based SCAN instead of the blocking KEYS command. Supports glob patterns, type filtering, and cursor pagination for safe production scans.
Instructions
Enumerate keys with cursor-based SCAN -- NEVER the O(N) KEYS command, so this is safe to run against a production instance with millions of keys (SCAN yields the event loop between batches). Returns up to REDIS_MAX_KEYS keys (default 1000) matching an optional glob match pattern (e.g. user:*, session:??). When more keys remain, truncated is true and cursor is non-'0' -- pass that cursor back to continue from where you left off. Optionally filter by value type (string/list/set/zset/hash/stream). Within one call duplicate keys are removed; across a resumed scan a key may reappear (SCAN's guarantee is no key present for the whole scan is missed, not that none repeats).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "redis_scan"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Filter to keys of this value type (uses SCAN's TYPE option). | |
| count | No | COUNT hint per SCAN iteration (default REDIS_SCAN_COUNT=100). Higher = fewer round-trips, but very high values increase per-iteration event-loop hold time on large keyspaces -- the small-batch yield is this module's core safety property for production instances. | |
| match | No | Glob pattern to match keys (e.g. `user:*`). Omit to scan all keys. | |
| cursor | No | SCAN cursor to resume from. Start (and default) is '0'. | 0 |