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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. '查找匹配的键' (Find matching keys) implies a read-only search operation, but doesn't specify what 'matching' entails beyond the pattern parameter, whether results are paginated, if it returns metadata or just keys, or any performance/rate limit considerations. For a tool with no annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise with just four Chinese characters, making it front-loaded and waste-free. However, this conciseness comes at the cost of being under-specified for a tool that needs to distinguish itself from multiple siblings. While efficient, it may be too brief for adequate context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of operating in a Redis key environment with 30+ sibling tools, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., list of keys, count, metadata), how it differs from similar tools like 'key_delete_pattern', or any behavioral constraints. The minimal description fails to provide sufficient context for effective tool selection.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% with the parameter 'pattern' fully documented in the schema as supporting wildcards (* ? []). The description adds no additional parameter semantics beyond what the schema provides. With high schema coverage, the baseline score of 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '查找匹配的键' (Find matching keys) is a tautology that essentially restates the tool name 'key_search' in Chinese. It specifies the verb '查找' (find/search) and resource '键' (keys), but doesn't distinguish this tool from sibling tools like 'key_delete_pattern' or 'key_info' that also operate on keys. The purpose is clear at a basic level but lacks differentiation from alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'key_delete_pattern' (which also uses patterns) and 'key_info' (which provides key details), there's no indication whether this tool is for discovery, validation, or other purposes. No context about prerequisites, alternatives, or exclusions is mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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