Skip to main content
Glama

key_type

Determine the Redis data type of a specified key to understand how to interact with stored values.

Instructions

获取键类型

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes键名

Implementation Reference

  • MCP tool handler for 'key_type': ensures Redis connection, calls RedisService.type(key), and formats result as MCP content response.
    private async handleKeyType(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.type(args.key);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Tool registration in ListTools response: defines name 'key_type', description, and input schema requiring 'key' parameter.
    {
      name: 'key_type',
      description: '获取键类型',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '键名' }
        },
        required: ['key']
      }
    },
  • Dispatch registration in CallToolRequestSchema switch statement: routes 'key_type' calls to handleKeyType method.
    case 'key_type':
      return await this.handleKeyType(args);
  • RedisService helper method implementing the core Redis TYPE key command via the redis client.
    async type(key: string): Promise<RedisOperationResult<string>> {
      return this.executeCommand(async () => {
        if (!this.client) throw new Error('Redis client not initialized');
        return await this.client.type(key);
      });
    }
Behavior2/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. It implies a read-only operation ('获取' means get/fetch), but doesn't disclose behavioral traits such as error handling (e.g., if the key doesn't exist), performance characteristics, or any side effects. This is inadequate for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is extremely concise with a single phrase, '获取键类型', which is front-loaded and wastes no words. However, this conciseness comes at the cost of clarity and completeness, but purely on brevity and structure, it earns full marks.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., string, list, hash types), error conditions, or how it fits within the Redis context implied by sibling tools. For a tool with no structured data support, this minimal description is insufficient.

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 schema description coverage is 100%, with the single parameter 'key' documented as '键名' (key name). The description adds no additional meaning beyond this, such as format examples or constraints. Given the high schema coverage, a baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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 type) restates the tool name 'key_type' in Chinese, making it a tautology. It doesn't specify what resource it operates on (e.g., Redis keys) or distinguish it from sibling tools like key_info or key_search, which also deal with key metadata.

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?

No guidance is provided on when to use this tool versus alternatives. With siblings like key_info (which might return more comprehensive key details) and key_search (for finding keys), the description offers no context on selection criteria or prerequisites for usage.

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