Skip to main content
Glama
andresthor

Command-Line MCP Server

by andresthor

get_command_help

Retrieve detailed information about supported terminal commands, security restrictions, and usage guidelines for safe command execution.

Instructions

Get detailed help about command capabilities and usage.

This tool provides comprehensive information about:

  • Supported commands in each category (read, write, system)

  • Blocked commands for security reasons

  • Command chaining capabilities (pipes, semicolons, ampersands)

  • Usage restrictions and examples

Returns: A dictionary with detailed information about command capabilities and usage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Implementation of the get_command_help handler function.
    async def get_command_help() -> dict[str, Any]:
        """
        Get detailed help about command capabilities and usage.
    
        This tool provides comprehensive information about:
        - Supported commands in each category (read, write, system)
        - Blocked commands for security reasons
        - Command chaining capabilities (pipes, semicolons, ampersands)
        - Usage restrictions and examples
    
        Returns:
            A dictionary with detailed information about command capabilities and usage
        """
        # Get the latest command lists and separator support
        command_lists = self.config.get_effective_command_lists()
        separator_support = self.config.has_separator_support()
    
        # Log the separator support for debugging
        logger.info(f"Separator support status: {separator_support}")
        logger.info(
            f"allow_command_separators setting: {self.config.get('security', 'allow_command_separators')}"
        )
    
        # Extra check for pipe character in dangerous patterns
        pipe_in_patterns = any(
            "|" in p or r"\|" in p for p in command_lists["dangerous_patterns"]
        )
        logger.info(
            f"Pipe character found in dangerous patterns: {pipe_in_patterns}"
        )
    
        # Update capabilities
        updated_capabilities = {
            "supported_commands": {
                "read": command_lists["read"],
                "write": command_lists["write"],
                "system": command_lists["system"],
            },
            "blocked_commands": command_lists["blocked"],
            "command_chaining": {
                "pipe": (
                    "Supported" if separator_support["pipe"] else "Not supported"
                ),
                "semicolon": (
                    "Supported"
                    if separator_support["semicolon"]
                    else "Not supported"
                ),
                "ampersand": (
                    "Supported"
                    if separator_support["ampersand"]
                    else "Not supported"
                ),
            },
            "command_restrictions": "Special characters like $(), ${}, backticks, and I/O redirection are blocked",
        }
    
        # Provide helpful information for Claude to understand command usage
        return {
            "capabilities": updated_capabilities,
            "examples": self.usage_examples,
            "recommended_approach": {
                "finding_large_files": "Use 'du -h <directory>/* | sort -hr | head -n 10' to find the 10 largest files",
                "file_searching": "Use 'find <directory> -type f -name \"pattern\"' for file searches",
                "text_searching": "Use 'grep \"pattern\" <file>' to search in files",
                "file_viewing": "Use 'cat', 'head', or 'tail' for viewing files",
                "sorting": "Use 'sort' with options like -n (numeric), -r (reverse), -h (human readable sizes)",
                "text_processing": "Use 'awk' for advanced text processing. For example: 'ls -la | awk \"{print $1, $9}\"' to show permissions and filenames",
                "column_filtering": "Use 'awk' to filter by column values: 'cat data.txt | awk \"{if($3 > 100) print}\"' to show lines where column 3 exceeds 100",
            },
            "permissions": {
                "read_commands": "Can be executed without confirmation",
                "write_commands": "Require approval for first use in a session",
                "system_commands": "Require approval for first use in a session",
            },
        }

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/andresthor/cmd-line-mcp'

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