Skip to main content
Glama
samerfarida

MCP SSH Orchestrator

ssh_describe_host

Retrieve the JSON host definition for a given alias to inspect server configuration and ensure audit compliance.

Instructions

Return host definition in JSON.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The ssh_describe_host tool handler function. Decorated with @mcp.tool(), it takes an 'alias' parameter, validates it via _validate_alias(), looks up the host via config.get_host(), and returns the host dict on success or an error string on failure.
    @mcp.tool()
    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)}"
  • The _validate_alias helper function used by ssh_describe_host to validate the alias parameter (length limit, character whitelist, non-empty check).
    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 Config.get_host() method that retrieves host configuration by alias from the loaded servers.yml data.
    def get_host(self, alias: str) -> dict:
        """Get host configuration by alias."""
        for h in self._data.get("servers", {}).get("hosts", []):
            if str(h.get("alias", "")) == str(alias):
                return h
        raise ValueError(f"Host alias not found: {alias}")
  • The ssh_describe_host tool is registered via the @mcp.tool() decorator (line 856) on the ssh_ping function, but ssh_describe_host itself is also registered at line 874 with @mcp.tool().
    @mcp.tool()
    def ssh_ping() -> ToolResult:
        """Health check."""
        return {"status": "pong"}
  • Unit test for ssh_describe_host verifying it returns host details for a valid alias.
    def test_ssh_describe_host(mock_config):
        """Test describe_host tool."""
        result = mcp_server.ssh_describe_host(alias="test1")
        assert isinstance(result, dict)
    
        assert result["alias"] == "test1"
        assert result["host"] == "10.0.0.1"
        assert result["port"] == 22
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description does not disclose behavioral traits like safety (read-only vs mutation), authentication needs, or error handling. As no annotations are provided, the description carries the burden; it mentions the return format but omits critical context about side effects or constraints.

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 a single sentence with no unnecessary words. It is efficient but could include more context without becoming verbose, such as parameter explanation or usage hints.

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 simplicity (one optional parameter) and the presence of an output schema, the description is adequate but incomplete. It does not explain the role of the alias parameter or what happens when omitted, which an agent might need for proper invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The single parameter 'alias' is not explained in the description; its purpose (identifying the host) must be inferred. With 0% schema description coverage, the description should compensate but fails to add meaning beyond the parameter name and default value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Return host definition in JSON.' clearly states the verb (return), resource (host definition), and output format (JSON). It distinguishes from sibling tools like ssh_list_hosts which lists hosts, and ssh_run which executes commands.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/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 such as ssh_list_hosts. It implies usage for retrieving a specific host's details but does not specify prerequisites or context preferences.

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

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