info
Retrieve detailed Redis server information and statistics. Specify a section such as memory or cpu to filter results.
Instructions
Get Redis server information and statistics.
Args: section: The section of the info command (default, memory, cpu, etc.).
Returns: A dictionary of server information or an error message.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| section | No | default |
Implementation Reference
- src/tools/server_management.py:17-32 (handler)The 'info' tool handler function. It is decorated with @mcp.tool(), accepts an optional 'section' parameter (defaulting to 'default'), gets a Redis connection, and calls r.info(section) to retrieve server information, returning it as a dict.
@mcp.tool() async def info(section: str = "default") -> dict: """Get Redis server information and statistics. Args: section: The section of the info command (default, memory, cpu, etc.). Returns: A dictionary of server information or an error message. """ try: r = RedisConnectionManager.get_connection() info = r.info(section) return info except RedisError as e: return f"Error retrieving Redis info: {str(e)}" - src/tools/server_management.py:1-5 (registration)Imports from src.common.server import mcp, which provides the FastMCP instance used by the @mcp.tool() decorator to register the 'info' tool.
from redis.exceptions import RedisError from src.common.connection import RedisConnectionManager from src.common.server import mcp - src/common/server.py:1-19 (registration)The FastMCP server initialization and tool loading mechanism. The load_tools() function dynamically imports all modules under src.tools, which triggers registration of all @mcp.tool() decorated functions including 'info'.
import importlib import pkgutil from mcp.server.fastmcp import FastMCP def load_tools(): import src.tools as tools_pkg for _, module_name, _ in pkgutil.iter_modules(tools_pkg.__path__): importlib.import_module(f"src.tools.{module_name}") # Initialize FastMCP server mcp = FastMCP( "Redis MCP Server", dependencies=["redis", "python-dotenv", "numpy", "aiohttp"] ) # Load tools load_tools() - tests/test_integration.py:363-363 (helper)Test categorization showing that 'info' belongs to the 'server_mgmt' group alongside dbsize and client_list in src/tools/server_management.py.
"server_mgmt": ["dbsize", "info", "client_list"],