Skip to main content
Glama

string_set

Set string key-value pairs in Redis with optional expiration time to store and manage data efficiently.

Instructions

设置字符串键值

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes键名
valueYes
expireSecondsNo过期时间(秒)(可选)

Implementation Reference

  • Handler function that implements the string_set tool logic: ensures Redis connection, calls redisService.set with key, value, expireSeconds, and returns the result as MCP content.
    private async handleStringSet(args: any) {
      this.ensureRedisConnection();
      const result = await this.redisService!.set(args.key, args.value, args.expireSeconds);
      
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(result, null, 2)
          }
        ]
      };
    }
  • Input schema definition for the string_set tool, including properties for key, value, and optional expireSeconds.
    {
      name: 'string_set',
      description: '设置字符串键值',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '键名' },
          value: { type: 'string', description: '值' },
          expireSeconds: { type: 'number', description: '过期时间(秒)(可选)' }
        },
        required: ['key', 'value']
      }
    },
  • Registration/dispatch in the CallToolRequestSchema handler switch statement that routes string_set calls to the handleStringSet method.
    case 'string_set':
      return await this.handleStringSet(args);
  • Tool registration in the ListToolsRequestSchema response, declaring the string_set tool with its name, description, and schema.
    {
      name: 'string_set',
      description: '设置字符串键值',
      inputSchema: {
        type: 'object',
        properties: {
          key: { type: 'string', description: '键名' },
          value: { type: 'string', description: '值' },
          expireSeconds: { type: 'number', description: '过期时间(秒)(可选)' }
        },
        required: ['key', 'value']
      }
    },
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 of behavioral disclosure. '设置字符串键值' implies a write/mutation operation, but it doesn't disclose any behavioral traits: no mention of permissions needed, whether it overwrites existing keys, what happens on success/failure, rate limits, or side effects. For a mutation tool with zero annotation coverage, this is a significant gap.

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 a single phrase ('设置字符串键值'), which is extremely concise and front-loaded. However, this brevity comes at the cost of being under-specified—it lacks necessary detail for a mutation tool. While efficient, it doesn't fully earn its place by providing adequate guidance.

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 tool's complexity (a mutation operation with no annotations and no output schema), the description is incomplete. It doesn't explain what the tool returns, error conditions, or how it differs from siblings. For a tool that modifies data in a system with many similar alternatives, more context is needed to ensure correct usage.

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 all parameters ('key', 'value', 'expireSeconds') documented in Chinese. The description adds no additional meaning beyond what the schema provides—it doesn't explain parameter interactions, constraints, or examples. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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 '设置字符串键值' (sets string key-value) is a tautology that essentially restates the tool name 'string_set' in Chinese. While it indicates the tool sets something, it doesn't specify what resource it operates on (Redis string type) or distinguish it from similar sibling tools like 'hash_set' or 'string_mset'. The purpose is vague rather than specific.

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. There are multiple sibling tools for setting values (e.g., 'hash_set', 'string_mset', 'set_add'), but the description doesn't mention any context, prerequisites, or exclusions. An agent would have no basis for choosing this tool over others.

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