Skip to main content
Glama
temurkhan13

silentwatch-mcp

by temurkhan13

tail_job_logs

Retrieve the most recent log lines for a scheduled job, with configurable line count, to diagnose job output and detect silent failures.

Instructions

Most recent N log lines for a job (newest last).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
job_idYes
linesNo

Implementation Reference

  • The call_tool handler for 'tail_job_logs' — extracts job_id and lines from arguments, calls backend.tail_logs(), wraps result in JobLogTail, and serializes via _serialize.
    if name == "tail_job_logs":
        job_id = arguments["job_id"]
        lines = int(arguments.get("lines", 50))
        log_lines = await backend.tail_logs(job_id, lines=lines)
        response = JobLogTail(job_id=job_id, lines=log_lines, total_lines_returned=len(log_lines))
        return _serialize(response)
  • JobLogTail schema — the Pydantic response model for the tail_job_logs tool, with job_id, lines (list of strings), and total_lines_returned.
    class JobLogTail(BaseModel):
        """Response for `tail_job_logs`."""
    
        job_id: str
        lines: list[str]
        total_lines_returned: int
  • Tool registration in list_tools() — declares the tool's name, description, and inputSchema (job_id required, lines optional default 50).
        Tool(
            name="tail_job_logs",
            description="Most recent N log lines for a job (newest last).",
            inputSchema={
                "type": "object",
                "properties": {
                    "job_id": {"type": "string"},
                    "lines": {"type": "integer", "default": 50},
                },
                "required": ["job_id"],
            },
        ),
    ]
  • Abstract tail_logs method in CronBackend base class — defines the contract all backends must implement.
    @abstractmethod
    async def tail_logs(self, job_id: str, lines: int = 50) -> list[str]:
        """Return up to `lines` recent log output lines for a job, newest last.
    
        For backends that don't maintain a separate log surface (e.g., mock or
        openclaw-jsonl which puts output in run records), implementations can
        synthesize this from `get_job_runs` outputs.
        """
  • Mock backend's tail_logs implementation — synthesizes log lines from run records with timestamp, status, run_id, exit_code, and output snippet.
    async def tail_logs(self, job_id: str, lines: int = 50) -> list[str]:
        runs = self._runs.get(job_id, [])
        out: list[str] = []
        for run in runs:
            ts = run.started_at.isoformat()
            status = run.status.value
            out.append(f"{ts} [{status.upper()}] run_id={run.run_id} exit={run.exit_code}")
            if run.output_snippet:
                out.append(f"{ts} [OUTPUT] {run.output_snippet[:200]}")
        return out[-lines:]
Behavior2/5

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

No annotations provided, so description carries full burden. Only states the result order and count, but omits read-only hint, error handling, or limitations like max lines.

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?

Single sentence, no wasted words. Efficient but could include more contextual info without becoming verbose.

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?

Adequate for a simple tool with 2 parameters and no output schema. Lacks details on behavior for edge cases and result format, but core purpose is clear.

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?

Schema description coverage is 0%. Description hints at 'lines' parameter ('N log lines') but does not explain 'job_id' or provide format/constraints for either parameter.

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?

Description clearly states the action ('Most recent N log lines'), resource ('a job'), and ordering ('newest last'). Distinguishes from siblings like get_job_status or list_jobs.

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?

No explicit guidance on when to use this tool vs siblings. Does not mention exclusions or alternatives despite related tools (e.g., find_silent_failures, get_job_runs).

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/temurkhan13/silentwatch-mcp'

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