Skip to main content
Glama

ssh_describe_host

Retrieve detailed host configuration in JSON format from the SSH Orchestrator to understand access policies and connection parameters for secure server management.

Instructions

Return host definition in JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasNo

Implementation Reference

  • The core handler function for the 'ssh_describe_host' MCP tool. Decorated with @mcp.tool() for registration. Validates the alias parameter using _validate_alias, fetches the host config via config.get_host(alias), and returns the host dict or an error string.
    def ssh_describe_host(alias: str = "") -> ToolResult: """Return host definition in JSON.""" try: # Input validation valid, error_msg = _validate_alias(alias) if not valid: return f"Error: {error_msg}" host = config.get_host(alias) return host except Exception as e: error_str = str(e) log_json( {"level": "error", "msg": "describe_host_exception", "error": error_str} ) return f"Error: {sanitize_error(error_str)}"
  • Helper function _validate_alias used by ssh_describe_host to validate the alias input parameter against security constraints (length, characters). Returns (valid, error_msg). Called at line 879.
    def _validate_alias(alias: str) -> tuple[bool, str]: """Validate alias parameter. Security: Validates alias format to prevent injection attacks. - Length limit: 100 characters - Allowed characters: alphanumeric, dash, underscore, dot - Cannot be empty Args: alias: Alias string to validate Returns: Tuple of (is_valid, error_message) If valid: (True, "") If invalid: (False, error_message) """ if not alias or not alias.strip(): return False, "alias is required" alias = alias.strip() # Length validation if len(alias) > MAX_ALIAS_LENGTH: return False, f"alias too long (max {MAX_ALIAS_LENGTH} characters)" # Character validation: alphanumeric, dash, underscore, dot only if not re.match(r"^[a-zA-Z0-9._-]+$", alias): return ( False, "alias contains invalid characters (only alphanumeric, dot, dash, underscore allowed)", ) return True, ""
  • The @mcp.tool() decorator registers the ssh_describe_host function as an MCP tool, making it available via the FastMCP server instance.
    def ssh_describe_host(alias: str = "") -> ToolResult: """Return host definition in JSON.""" try: # Input validation valid, error_msg = _validate_alias(alias) if not valid: return f"Error: {error_msg}" host = config.get_host(alias) return host except Exception as e: error_str = str(e) log_json( {"level": "error", "msg": "describe_host_exception", "error": error_str} ) return f"Error: {sanitize_error(error_str)}"

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/samerfarida/mcp-ssh-orchestrator'

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