Skip to main content
Glama
farhankaz

Redis MCP Server

by farhankaz

get

Retrieve string values from a Redis database using the Model Context Protocol (MCP). Provide a key to quickly fetch and manage stored data efficiently.

Instructions

Get string value

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYesKey to get

Implementation Reference

  • The execute method of GetTool that performs the Redis GET operation on the provided key and returns a ToolResponse.
    async execute(args: unknown, client: RedisClientType): Promise<ToolResponse> {
      if (!this.validateArgs(args)) {
        return this.createErrorResponse('Invalid arguments for get');
      }
    
      try {
        const value = await client.get(args.key);
        if (value === null) {
          return this.createSuccessResponse('Key not found');
        }
        return this.createSuccessResponse(value);
      } catch (error) {
        return this.createErrorResponse(`Failed to get key: ${error}`);
      }
    }
  • Input schema for the 'get' tool defining the required 'key' parameter.
    inputSchema = {
      type: 'object',
      properties: {
        key: { type: 'string', description: 'Key to get' }
      },
      required: ['key']
    };
  • TypeScript interface defining arguments for the 'get' tool.
    export interface GetArgs {
      key: string;
    }
  • Instantiation and registration of GetTool in the default tools array of ToolRegistry.
    new SetTool(),
    new GetTool(),
  • Import of GetTool for registration.
    import { GetTool } from './get_tool.js';

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related 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/farhankaz/redis-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server