Skip to main content
Glama

key_search

Search for Redis keys using pattern matching with wildcards to locate specific data entries in your database.

Instructions

查找匹配的键

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
patternYes匹配模式(支持通配符 * ? [])

Implementation Reference

  • The handler function that implements the key_search tool. Ensures Redis connection and calls redisService.keys(pattern) to find matching keys, then returns the result as formatted text content.
    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)
          }
        ]
      };
    }
  • Tool specification in listTools response, defining the name, description, and input schema (pattern: string) for key_search.
    {
      name: 'key_search',
      description: '查找匹配的键',
      inputSchema: {
        type: 'object',
        properties: {
          pattern: { type: 'string', description: '匹配模式(支持通配符 * ? [])' }
        },
        required: ['pattern']
      }
    },
  • Dispatch case in CallToolRequestHandler switch statement that routes key_search calls to the handleKeySearch method.
    case 'key_search':
      return await this.handleKeySearch(args);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pickstar-2002/redis-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server