Skip to main content
Glama

key_info

Retrieve detailed information about Redis keys, including type, TTL, and memory usage, to monitor and manage database performance.

Instructions

获取键信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes键名

Implementation Reference

  • Registration of the 'key_info' tool in MCP server's ListTools response, including name, description, and input schema requiring a 'key' string.
    {
      name: 'key_info',
      description: '获取键信息',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '键名' }
        },
        required: ['key']
      }
    },
  • MCP-level handler for 'key_info' tool that ensures Redis connection, calls redisService.getKeyInfo, and formats the response as MCP content.
    private async handleKeyInfo(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.getKeyInfo(args.key);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Core handler implementation in RedisService that retrieves the key's type and TTL using Redis client commands and returns RedisKeyInfo.
    async getKeyInfo(key: string): Promise<RedisOperationResult<RedisKeyInfo>> {
      return this.executeCommand(async () => {
        if (!this.client) throw new Error('Redis client not initialized');
        
        const [type, ttl] = await Promise.all([
          this.client.type(key),
          this.client.ttl(key)
        ]);
        
        return {
          key,
          type,
          ttl
        };
      });
    }
  • TypeScript interface defining the output structure for key information: key name, type, TTL (time to live), and optional size.
    export interface RedisKeyInfo {
      key: string;
      type: string;
      ttl: number;
      size?: number;
    }
Behavior1/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. The description '获取键信息' only states the action without revealing any behavioral traits such as whether it's read-only, what permissions are required, what happens if the key doesn't exist, response format, or error conditions. For a tool with no annotation coverage, this is a significant gap in transparency.

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 three Chinese characters ('获取键信息'), which is front-loaded and wastes no words. However, it's overly terse to the point of under-specification, lacking necessary details. While efficient, it sacrifices clarity for brevity, so it doesn't earn the highest score.

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 Redis key operations and the lack of annotations and output schema, the description is incomplete. It doesn't explain what information is returned (e.g., value, metadata, type), how it differs from other key-related tools, or any behavioral aspects. For a tool in a rich sibling set with no structured support, the description fails to provide sufficient context.

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?

The input schema has 100% description coverage, with the parameter 'key' documented as '键名' (key name) in the schema. The description doesn't add any meaning beyond this, such as examples, constraints, or usage notes. With high schema coverage, the baseline score is 3, as the schema adequately documents the parameter without extra value from the description.

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 '获取键信息' (Get key information) is a tautology that essentially restates the tool name 'key_info' in Chinese. While it indicates the tool retrieves information about a key, it doesn't specify what type of information (metadata, value, type, etc.) or distinguish it from sibling tools like key_type, key_ttl, or key_search that also provide information about keys. The purpose is vague and lacks specificity.

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

Usage Guidelines1/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_type (returns key type), key_ttl (returns time-to-live), key_search (finds keys by pattern), and string_get (gets string value), there's no indication of what makes this tool unique or appropriate for specific scenarios. No context, exclusions, or alternatives are 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