redis_hdel
Remove specified fields from a Redis hash. Provide the key and a list of field names to delete them from the hash structure.
Instructions
删除哈希字段。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | ||
| fields | Yes |
Implementation Reference
- src/index.ts:175-175 (schema)Input schema for redis_hdel tool: requires key (string) and fields (array of strings).
{ name: "redis_hdel", description: "删除哈希字段。", inputSchema: { type: "object", properties: { key: { type: "string" }, fields: { type: "array", items: { type: "string" } } }, required: ["key", "fields"] } } - src/index.ts:194-194 (handler)Handler for redis_hdel: calls client.hDel(args.key, args.fields) and returns a success message with count of deleted fields.
redis_hdel: async () => { const r = await client.hDel(args.key, args.fields); return `HDEL 成功。删除 ${r} 个字段`; } - src/index.ts:165-177 (registration)Tool registration via ListToolsRequestSchema handler that includes redis_hdel in the tools array.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: "redis_set", description: "设置键值。自动读取项目 .env 配置连接 Redis。", inputSchema: { type: "object", properties: { key: { type: "string" }, value: { type: "string" } }, required: ["key", "value"] } }, { name: "redis_get", description: "获取键值。", inputSchema: { type: "object", properties: { key: { type: "string" } }, required: ["key"] } }, { name: "redis_del", description: "删除键。", inputSchema: { type: "object", properties: { key: { type: "string" } }, required: ["key"] } }, { name: "redis_exists", description: "检查键是否存在。", inputSchema: { type: "object", properties: { key: { type: "string" } }, required: ["key"] } }, { name: "redis_info", description: "获取连接信息。", inputSchema: { type: "object", properties: {} } }, { name: "redis_hset", description: "设置哈希字段。", inputSchema: { type: "object", properties: { key: { type: "string" }, field: { type: "string" }, value: { type: "string" } }, required: ["key", "field", "value"] } }, { name: "redis_hget", description: "获取哈希字段。", inputSchema: { type: "object", properties: { key: { type: "string" }, field: { type: "string" } }, required: ["key", "field"] } }, { name: "redis_hgetall", description: "获取哈希所有字段。", inputSchema: { type: "object", properties: { key: { type: "string" } }, required: ["key"] } }, { name: "redis_hdel", description: "删除哈希字段。", inputSchema: { type: "object", properties: { key: { type: "string" }, fields: { type: "array", items: { type: "string" } } }, required: ["key", "fields"] } } ] }));