Skip to main content
Glama
GongRzhe

Terminal Controller for MCP

get_command_history

Retrieve recent command execution history from the Terminal Controller for MCP. Specify the number of commands to return for efficient tracking and review of terminal activities.

Instructions

Get recent command execution history Args: count: Number of recent commands to return Returns: Formatted command history record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo

Implementation Reference

  • The main handler function for the 'get_command_history' tool. It is decorated with @mcp.tool(), which registers it as an MCP tool. The function retrieves the most recent commands from the global 'command_history' list, formats them with status indicators, and returns a string summary.
    @mcp.tool() async def get_command_history(count: int = 10) -> str: """ Get recent command execution history Args: count: Number of recent commands to return Returns: Formatted command history record """ if not command_history: return "No command execution history." count = min(count, len(command_history)) recent_commands = command_history[-count:] output = f"Recent {count} command history:\n\n" for i, cmd in enumerate(recent_commands): status = "✓" if cmd["success"] else "✗" output += f"{i+1}. [{status}] {cmd['timestamp']}: {cmd['command']}\n" return output
  • Global list 'command_history' that stores executed commands (populated by 'run_command' function used in 'execute_command' tool) and MAX_HISTORY_SIZE constant used to limit the history size. This is the data source for the 'get_command_history' tool.
    # List to store command history command_history = [] # Maximum history size MAX_HISTORY_SIZE = 50
  • The @mcp.tool() decorator on the get_command_history function registers it as an available MCP tool.
    @mcp.tool()

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/GongRzhe/terminal-controller-mcp'

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