Skip to main content
Glama
redis

Redis MCP Server

Official
by redis

type

Check the data type of a value stored at a specific key in Redis to understand how to handle or process it.

Instructions

Returns the string representation of the type of the value stored at key

Args: key (str): The key to check.

Returns: str: The type of key, or none when key doesn't exist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler for the 'type' tool: retrieves the Redis data type, TTL, and key info using r.type(key). Registered via @mcp.tool() decorator.
    @mcp.tool()
    async def type(key: str) -> Dict[str, Any]:
        """Returns the string representation of the type of the value stored at key
    
        Args:
            key (str): The key to check.
    
        Returns:
            str: The type of key, or none when key doesn't exist
        """
        try:
            r = RedisConnectionManager.get_connection()
            key_type = r.type(key)
            info = {"key": key, "type": key_type, "ttl": r.ttl(key)}
    
            return info
        except RedisError as e:
            return {"error": str(e)}
Behavior3/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 discloses key behavioral traits: it returns a string representation of the type, and it returns 'none' when the key doesn't exist, which clarifies error handling. However, it doesn't cover other aspects like performance, rate limits, or authentication needs, leaving some gaps in transparency.

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 appropriately sized and front-loaded: the first sentence states the core purpose, followed by structured sections for Args and Returns. Every sentence earns its place by providing essential information without redundancy, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter) and the presence of an output schema (which handles return values), the description is largely complete. It covers the purpose, parameter semantics, and basic behavior. However, it lacks usage guidelines and some behavioral details like edge cases or prerequisites, which slightly reduces completeness for an agent's needs.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, but the description compensates well by explaining the single parameter: 'key (str): The key to check.' This adds clear meaning beyond the schema's basic type definition. However, it doesn't elaborate on key format constraints or examples, which could enhance usability further.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Returns the string representation of the type of the value stored at key.' It specifies the verb ('Returns'), resource ('type of the value'), and scope ('at key'), making it easy to understand. However, it doesn't differentiate from siblings like 'get' or 'hexists' that also retrieve information about keys, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/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. It doesn't mention scenarios where checking a key's type is preferable to directly retrieving its value with 'get' or verifying existence with 'hexists', nor does it reference any sibling tools. This lack of contextual usage information limits its helpfulness.

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

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