redis_exists
Check if a specified key exists in the Redis database. Returns true if the key is present, false otherwise. Use to verify data availability before performing conditional operations.
Instructions
检查键是否存在。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes |
Implementation Reference
- src/index.ts:170-170 (registration)Tool registration for redis_exists in the ListToolsRequestSchema handler. Defines the tool name, description, and input schema (requires a string 'key').
{ name: "redis_exists", description: "检查键是否存在。", inputSchema: { type: "object", properties: { key: { type: "string" } }, required: ["key"] } }, - src/index.ts:170-170 (schema)Input schema for redis_exists: expects a single 'key' parameter of type string.
{ name: "redis_exists", description: "检查键是否存在。", inputSchema: { type: "object", properties: { key: { type: "string" } }, required: ["key"] } }, - src/index.ts:190-190 (handler)Handler function for redis_exists. Calls client.exists(args.key) and returns a string indicating whether the key exists.
redis_exists: async () => { const r = await client.exists(args.key); return `EXISTS 成功。键 ${args.key} ${r > 0 ? '存在' : '不存在'}`; },