Skip to main content
Glama
GongRzhe

Terminal Controller for MCP

get_command_history

Retrieve recent command execution history from the Terminal Controller for MCP server to review and analyze previous terminal operations.

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 handler function that implements the logic for the 'get_command_history' tool. It uses the global command_history list to return a formatted string of recent commands with success status and timestamps.
    @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
  • The @mcp.tool() decorator registers the get_command_history function as an MCP tool.
    @mcp.tool()
  • Global variables that store the command history list and maximum size limit, essential for the get_command_history tool's functionality.
    # List to store command history
    command_history = []
    
    # Maximum history size
    MAX_HISTORY_SIZE = 50
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. It states the tool retrieves history but doesn't specify what 'recent' means (e.g., time-based or count-based), whether the data is cached or real-time, or any limitations like rate limits or access controls. The mention of 'Formatted command history record' in the Returns section hints at output structure, but without an output schema, this is vague and insufficient for understanding behavior fully.

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 appropriately sized and front-loaded, starting with the core purpose ('Get recent command execution history') followed by brief sections for Args and Returns. Each sentence adds value without redundancy. However, the structure could be slightly improved by integrating the Args and Returns into a single cohesive paragraph for better flow, as the current bullet-like format is functional but not optimally concise.

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

Completeness3/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, no nested objects) and lack of annotations or output schema, the description is minimally adequate. It covers the basic purpose and parameter semantics but misses key contextual details like behavioral traits (e.g., data recency, permissions) and output specifics. For a simple read operation, this might suffice, but the absence of annotations means more disclosure would be beneficial for safe and effective use.

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 description adds meaningful context beyond the input schema, which has 0% description coverage. It explains that the 'count' parameter specifies the 'Number of recent commands to return', clarifying its purpose and usage. Since there is only one parameter and the schema lacks descriptions, this compensation is effective, though it doesn't detail constraints like minimum/maximum values or defaults (the schema shows a default of 10, but this isn't mentioned in the description).

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 with a specific verb ('Get') and resource ('recent command execution history'), making it immediately understandable. It distinguishes itself from siblings like execute_command or list_directory by focusing on historical data rather than current operations or file listings. However, it doesn't explicitly contrast with all siblings, such as get_current_directory, which also retrieves information but about a different resource.

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 prerequisites, such as whether command history is available or if permissions are required, nor does it suggest scenarios where other tools like execute_command (for running commands) or read_file (for accessing logs) might be more appropriate. This lack of context leaves the agent to infer usage based on the tool name alone.

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

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