Skip to main content
Glama

trim_log

Read-only

Collapse repeated log lines while keeping key error lines, head content, and final stack frames so you can inspect large logs without reading every line.

Instructions

Shrink a log or stack trace: repeated lines collapse, long tracebacks keep their last frames, every distinct error line stays. Use it instead of reading a whole log.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "trim_log"
  }
}

Input Schema

NameRequiredDescriptionDefault
headNoFirst lines always kept.
pathNoFile to read, inside the server's root folder. Preferred way to pass input.
tailNoLast lines always kept.
textNoThe text itself. Only for small inputs: large text costs tokens to send.
commandNoA command to run and trim (no shell). Only works if started with --allow-run.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already cover safety (readOnly, non-destructive, closed-world), and the description goes beyond them by disclosing the actual trimming contract — what is collapsed and what is guaranteed to survive (last traceback frames, distinct error lines). It does not address why idempotentHint is false for an operation that reads as repeatable, nor any size limits, which leaves a small gap.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, zero filler, with the behavioral contract front-loaded and the usage directive last. Every clause carries information an agent would otherwise have to infer.

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?

With an output schema present and full parameter documentation, the description only needs to establish purpose, trimming semantics and selection guidance, which it does. Minor incompleteness: it doesn't clarify how the head/tail retention interacts with the collapse rules or mention the execution-gated command path.

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?

Schema description coverage is 100%, so head, tail, path, text and command are already fully documented, including the token-cost rationale for text and the --allow-run requirement for command. The description adds no parameter-level detail beyond the schema, so the baseline of 3 applies.

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?

States a specific verb (shrink) and resource (log or stack trace), then enumerates the exact transformations: repeated lines collapse, tracebacks keep last frames, distinct error lines survive. The resource framing (logs/tracebacks) separates it from siblings like trim_diff and trim_tests without needing to name them.

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

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

"Use it instead of reading a whole log" gives a clear trigger condition for selecting this tool. It stops short of naming a contrasting alternative (e.g. expand, or when to prefer trim_diff) or stating exclusions, so it sits at clear-context rather than full routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.