Skip to main content
Glama

Get the most recent script trace

automations_get_last_script_trace
Read-onlyIdempotent

Fetch the most recent trace for a script to debug unexpected behavior, or get the most recent failed run by setting failed_only. Returns the full step-by-step trace.

Instructions

Fetch the most recent (or most recent failed) trace for a script.

Calls trace/list for script_id, then picks a run_id (the most recent overall, or with failed_only=True the most recent whose script_execution isn't 'finished') and calls trace/get for it.

Use when: debugging why a script didn't behave as expected without first listing traces and picking a run_id by hand. Returns: dict with the full step-by-step trace for the picked run. Errors: returns {"error": "no_traces"|"no_failed_traces", "script_id": sid} when no matching run exists. Limits: blocks for two sequential WebSocket round trips.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
script_idYesScript id to fetch the latest trace for, bare or prefixed ('script.<id>').
failed_onlyNoIf True, pick the most recent run that did not finish cleanly instead of the most recent run overall. Defaults to False.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.25.1
    • addedInput schema / properties / failed_only / description
      Added value: +"If True, pick the most recent run that did not finish cleanly instead of the most recent run overall. Defaults to False."
    • addedInput schema / properties / script_id / description
      Added value: +"Script id to fetch the latest trace for, bare or prefixed ('script.<id>')."
  2. Addedv0.18.1

TDQS

A4.7/5.0
Behavior5/5

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

Annotations cover the safety profile (readOnly, idempotent, non-destructive), and the description adds real behavioral context beyond them: the exact error payload shape for the no-traces cases, and that the call blocks for two sequential WebSocket round trips. That is non-obvious cost/behavior info an agent needs.

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?

Front-loaded with the core action, then organized into Use when / Returns / Errors / Limits blocks. Every line carries actionable information and nothing is padded.

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

Completeness5/5

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

For a read-only two-parameter tool with an output schema, the description covers usage context, return shape, failure modes, and latency characteristics. An agent has everything it needs to call this correctly without further exploration.

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

Parameters4/5

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

Schema coverage is already 100%, so both parameters are documented structurally. The description still adds meaning, notably clarifying that failed_only selects the most recent run whose script_execution isn't 'finished', which is slightly richer than the schema's 'did not finish cleanly' phrasing.

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 action (fetch the most recent, or most recent failed, trace) for a specific resource (a script identified by script_id). It also spells out the internal trace/list + trace/get composition, so it is clearly distinguishable from siblings like automations_list_script_traces and automations_get_script_trace.

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?

The 'Use when' line gives an explicit scenario (debugging a script's behavior) and implicitly frames the alternative it replaces (listing traces and hand-picking a run_id). It doesn't name a sibling tool directly, so routing relies on the agent inferring it, but the context is clear.

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

Deploy Server

Other Tools