key_search
Search Redis database keys using pattern matching with wildcards (*, ?, []). Streamline key discovery for efficient data management and retrieval.
Instructions
查找匹配的键
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | 匹配模式(支持通配符 * ? []) |
Implementation Reference
- src/services/mcpService.ts:1245-1257 (handler)The handler function for 'key_search' tool. Ensures Redis connection, calls redisService.keys(pattern), formats result as JSON text response.private async handleKeySearch(args: any) { this.ensureRedisConnection(); const result = await this.redisService!.keys(args.pattern); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; }
- src/services/mcpService.ts:526-536 (registration)Registration of the 'key_search' tool in the MCP tools list, including name, description, and input schema definition.{ name: 'key_search', description: '查找匹配的键', inputSchema: { type: 'object', properties: { pattern: { type: 'string', description: '匹配模式(支持通配符 * ? [])' } }, required: ['pattern'] } },
- src/services/mcpService.ts:692-693 (registration)Switch case in request handler that dispatches 'key_search' tool calls to the handleKeySearch method.case 'key_search': return await this.handleKeySearch(args);