Skip to main content
Glama

key_type

Determine the data type of a specified key in Redis, such as string, hash, list, set, or sorted set, to facilitate efficient database management and operation planning.

Instructions

获取键类型

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes键名

Implementation Reference

  • Executes the 'key_type' tool: ensures Redis connection, retrieves the type of the specified key using redisService.type(), and returns the result as formatted JSON text.
    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) } ] }; }
  • Input schema for 'key_type' tool: requires a single 'key' property of type string.
    inputSchema: { type: 'object', properties: { key: { type: 'string', description: '键名' } }, required: ['key'] }
  • Registration of the 'key_type' tool in the tools list passed to server.setTools(), including name, description, and input schema.
    { name: 'key_type', description: '获取键类型', inputSchema: { type: 'object', properties: { key: { type: 'string', description: '键名' } }, required: ['key'] } },
  • Dispatch case in the request handler switch statement that routes 'key_type' calls to handleKeyType.
    case 'key_type': return await this.handleKeyType(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