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); }); }

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