← Back to home@LJH-snow

dsh-tool-redis

Redis inspection and guarded write tools for DeepSeek Harness

Stars
0
Language
TypeScript
Created
Oct 5, 2026
Updated
Oct 6, 2026

Introduction

dsh-tool-redis

English | 中文

Redis inspection and guarded write tools for DeepSeek Harness (dsh) as a Cordis plugin. The agent can check connectivity, read server metrics, scan key names, and inspect key values — with explicit, single-purpose write tools for SET, EXPIRE, and DEL.

Install

npm install @libai168/dsh-tool-redis

Requires @deepseek-ai/cordis (^4.0.1) and @deepseek-ai/dsh-tools (^0.1.0-rc.6) as peer dependencies, plus the bundled redis (^6.3.0) client as a runtime dependency.

Configuration

- name: 'github:LJH-snow/dsh-tool-redis'
  config:
    # url: 'redis://127.0.0.1:6379'
    urlEnv: 'REDIS_URL'
    # commandTimeoutMs: 5000

The connection URL is resolved from config.url first, then the environment variable named by urlEnv (default: REDIS_URL), then the default redis://127.0.0.1:6379. Do not put a usable password in source, examples, tests, or committed configuration. URLs that embed credentials are redacted to user:***@host in every tool output.

Tools

ToolDescriptionWrite
redis_pingVerify connectivity and latencyNo
redis_server_infoServer metrics: version, memory, clients, ops, hit rateNo
redis_dbsizeKey count of the selected databaseNo
redis_scan_keysIncremental key-name scan with MATCH/COUNTNo
redis_get_keyRead one key's type, TTL, and capped value previewNo
redis_set_keySet one string key with optional TTL and NX/XXYes
redis_expire_keySet a TTL on one existing keyYes
redis_delete_keysDelete up to 10 explicitly named keysYes

Security contract

  • The connection URL may embed credentials; every output shows the redacted user:***@host form, and the raw URL never enters tool results.
  • Reads never block: key listing uses SCAN with a bounded COUNT hint (10-1000), never KEYS.
  • redis_get_key caps string previews at 2,000 characters (with valueLength and truncated metadata), hash entries at 50, and list/set/zset members at 100 with 200-character items; key names are capped at 200 characters.
  • redis_set_key never echoes the written value back; results carry only the key name and value length. Values are capped at 10,000 characters, TTLs at one year, and delete calls at 10 explicit key names.
  • All three write tools are single-purpose, explicit-parameter operations marked kind: 'edit'; there are no FLUSH, CONFIG, SCRIPT, or module commands.
  • Commands run through a fixed verb table with discrete RESP arguments and a 5-second per-command timeout; the connection is created lazily.

API scope

This version covers string, hash, list, set, and zset reads plus guarded string writes. Pub/sub, streams, Lua scripting, cluster administration, and multi-key transactions are intentionally not included.

Development

npm install
npm run typecheck
npm test
npm run build
npm pack --dry-run

Tests run fully offline against a scripted command executor; no Redis server is needed.

License

MIT