Skip to main content
Glama
samerfarida

MCP SSH Orchestrator

ssh_get_task_status

Check the current status of asynchronous SSH tasks, including state, progress, elapsed time, and output summary, for monitoring infrastructure operations.

Instructions

Get current status of an async task (SEP-1686 compliant).

Returns task state, progress, elapsed time, and output summary.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler for the ssh_get_task_status tool. Validates the task_id input and retrieves the task status from the ASYNC_TASKS manager, returning the status dictionary or an error message.
    def ssh_get_task_status(task_id: str = "", ctx: Context | None = None) -> ToolResult:
        """Get current status of an async task (SEP-1686 compliant).
    
        Returns task state, progress, elapsed time, and output summary.
        """
        try:
            # Input validation
            valid, error_msg = _validate_task_id(task_id)
            if not valid:
                return f"Error: {error_msg}"
    
            task_id = task_id.strip()
            status = ASYNC_TASKS.get_task_status(task_id)
            if not status:
                return f"Error: Task not found: {task_id}"
    
            _ctx_log(ctx, "debug", "ssh_get_task_status", {"task_id": task_id})
            return status
    
        except Exception as e:
            error_str = str(e)
            log_json({"level": "error", "msg": "status_exception", "error": error_str})
            _ctx_log(
                ctx,
                "debug",
                "ssh_get_task_status_error",
                {"task_id": task_id.strip(), "error": sanitize_error(error_str)},
            )
            return f"Status error: {sanitize_error(error_str)}"
  • Core helper method in AsyncTaskManager that retrieves and computes the current status of an async task, including progress calculation and SEP-1686 compliant metadata.
    def get_task_status(self, task_id: str) -> dict[str, Any] | None:
        """Get current status with SEP-1686 metadata."""
        with self._lock:
            task_info = self._tasks.get(task_id)
            if not task_info:
                # Check if result exists (completed task)
                result = self._results.get(task_id)
                if result:
                    return {
                        "task_id": task_id,
                        "status": result["status"],
                        "keepAlive": int(result["expires"] - time.time()),
                        "pollFrequency": 5,
                        "progress_percent": 100,
                        "elapsed_ms": result["duration_ms"],
                        "bytes_read": len(result["output"]),
                        "output_lines_available": len(
                            self._output_buffers.get(task_id, deque())
                        ),
                    }
                return None
    
            # Calculate progress percentage based on elapsed time vs max_seconds
            elapsed_ms = int((time.time() - task_info["created"]) * 1000)
            max_seconds = int(task_info["limits"].get("max_seconds", 60))
            progress_percent = min(100, int((elapsed_ms / (max_seconds * 1000)) * 100))
    
            return {
                "task_id": task_id,
                "status": task_info["status"],
                "keepAlive": 300,  # 5 minutes default
                "pollFrequency": 5,  # 5 seconds
                "progress_percent": progress_percent,
                "elapsed_ms": elapsed_ms,
                "bytes_read": task_info["bytes_out"] + task_info["bytes_err"],
                "output_lines_available": len(
                    self._output_buffers.get(task_id, deque())
                ),
            }
  • The @mcp.tool() decorator registers the ssh_get_task_status function as an MCP tool.
    def ssh_get_task_status(task_id: str = "", ctx: Context | None = None) -> ToolResult:
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions what information is returned but doesn't cover important behavioral aspects: whether this requires specific permissions, rate limits, error conditions, or how it handles invalid task IDs. The 'SEP-1686 compliant' reference adds some context but isn't fully explanatory for an AI agent.

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 concise with two sentences that each add value. The first sentence establishes the core purpose, and the second specifies what information is returned. There's no wasted text, though it could be slightly more structured with clearer separation between purpose and return details.

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

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (status checking with one parameter) and the presence of an output schema, the description provides adequate context. The output schema will handle return value documentation, so the description appropriately focuses on purpose and returned information types. However, it lacks guidance on error handling and parameter usage.

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

Parameters3/5

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

The input schema has 0% description coverage, so the description must compensate. It doesn't mention the task_id parameter at all, leaving the single parameter completely undocumented in the description. However, with only one parameter and an output schema present, the baseline is 3 since the agent can infer basic usage from context.

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: 'Get current status of an async task' with specific details about what it returns (task state, progress, elapsed time, output summary). It distinguishes itself from siblings like ssh_get_task_output and ssh_get_task_result by focusing on status rather than output or final results. However, it doesn't explicitly differentiate from all siblings in the description text.

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 implies usage context through 'async task' and 'SEP-1686 compliant' terminology, suggesting this is for monitoring asynchronous operations. However, it doesn't provide explicit guidance on when to use this versus alternatives like ssh_get_task_output or ssh_get_task_result, nor does it mention prerequisites or when-not-to-use scenarios.

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