Skip to main content
Glama

Log Trace

log_trace

Store one immutable agent execution trace with input, output, tool calls, spans, cost and tokens to get a trace_id that later calls key on. Set evaluate to true to score it in the same call.

Instructions

Store one agent execution (input, output, tool calls, spans, cost, tokens) and get the trace_id later calls key on.

What it does. Writes one immutable trace to local storage; nothing is deduplicated. Only agent_name is required; store tool_calls, tools, cost and input/output so the rules can judge them. evaluate: true (with output) also scores it in this call, exactly as evaluate_output would. Full detail: iris://capabilities.

When not to use it. To score a stored trace (evaluate_output with its trace_id). To change one (delete_trace, then log again).

Returns. JSON: trace_id, status, cost_usd, cost_source, cost_estimate, evaluation.

Errors. IRIS_STORAGE_ERROR; IRIS_INVALID_ARGUMENT when evaluate is true without output. Unknown or malformed arguments are refused, naming the valid keys. Failures return {"error":{code,message,recovery}} with isError; follow recovery.

Siblings. evaluate_output — score the stored output; get_traces — query what was logged; delete_trace — remove one trace.

Input Schema

NameRequiredDescriptionDefault
runNoThe batch this execution belongs to (a CI job id, a sweep); compare_runs compares two runs
inputNoAgent input text — the user prompt or upstream input that produced this output
spansNoDetailed execution spans (hierarchical span tree with timings, attributes, events); a span without start_time takes the trace timestamp
toolsNoYour MCP tools/list result, verbatim; lets the rules check call arguments later
outputNoAgent output text — what the agent produced (pass to evaluate_output for scoring)
case_keyNoWhat makes this the same question across runs (a fixture or test id); pairs traces. Derived from input when omitted
cost_usdNoTotal cost in USD, stored as reported. Omitted: estimated from the token counts and the model (metadata.model or the spans) at list price, and marked estimated
evaluateNoAlso score the stored trace in this call, exactly as evaluate_output would; requires output
metadataNoOpaque key-value tags (e.g. {requestId, userId, env}) — queryable in dashboard, not via get_traces filters
eval_typeNoWith evaluate: true, the bundle to run (default: every bundle, noted in the response)
frameworkNoAgent framework identifier (e.g., langchain, autogen, custom)
timestampNoTrace timestamp (ISO 8601); defaults to now() when omitted
agent_nameYesAgent name — used for filtering in get_traces (e.g., "customer-support-bot")
latency_msNoTotal execution time in milliseconds (end-to-end agent latency)
session_idNoThe conversation this turn belongs to; groups its turns. Read from SEP-414 baggage when omitted
tool_callsNoTool calls made, in order, each { tool_name, input?, output?, latency_ms?, error? }; the trajectory rules judge them
token_usageNoToken usage (prompt/completion/total, and cache_read_tokens / cache_creation_tokens: the cached part of prompt_tokens) — prices the trace when cost_usd is omitted

Output Schema

NameRequiredDescriptionDefault
statusYes
cost_usdYes
trace_idYes
evaluationNo
cost_sourceNo
cost_estimateNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed25 schema fields changedv0.10.1
    • addedInput schema / properties / case_key
      Added value: +{
      +  "description": "What makes this the same question across runs (a fixture or test id); pairs traces. Derived from input when omitted",
      +  "type": "string"
      +}
    • changedInput schema / properties / cost_usd / description
      Previous value: -"Total cost in USD — overrides per-span aggregation when provided (treated as authoritative)"New value: +"Total cost in USD, stored as reported. Omitted: estimated from the token counts and the model (metadata.model or the spans) at list price, and marked estimated"
    • addedInput schema / properties / eval_type
      Added value: +{
      +  "description": "With evaluate: true, the bundle to run (default: every bundle, noted in the response)",
      +  "enum": [
      +    "completeness",
      +    "relevance",
      +    "safety",
      +    "cost",
      +    "custom",
      +    "all"
      +  ],
      +  "type": "string"
      +}
    • addedInput schema / properties / evaluate
      Added value: +{
      +  "default": false,
      +  "description": "Also score the stored trace in this call, exactly as evaluate_output would; requires output",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / run
      Added value: +{
      +  "description": "The batch this execution belongs to (a CI job id, a sweep); compare_runs compares two runs",
      +  "type": "string"
      +}
    • addedInput schema / properties / session_id
      Added value: +{
      +  "description": "The conversation this turn belongs to; groups its turns. Read from SEP-414 baggage when omitted",
      +  "maxLength": 200,
      +  "minLength": 1,
      +  "type": "string"
      +}
    • changedInput schema / properties / token_usage / description
      Previous value: -"Token usage breakdown (prompt/completion/total — used for cost analysis)"New value: +"Token usage (prompt/completion/total, and cache_read_tokens / cache_creation_tokens: the cached part of prompt_tokens) — prices the trace when cost_usd is omitted"
    • addedInput schema / properties / token_usage / properties / cache_creation_1h_tokens
      Added value: +{
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / token_usage / properties / cache_creation_tokens
      Added value: +{
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / token_usage / properties / cache_read_tokens
      Added value: +{
      +  "minimum": 0,
      +  "type": "number"
      +}
    • addedInput schema / properties / token_usage / properties / prompt_tokens_details
      Added value: +{
      +  "properties": {
      +    "cached_tokens": {
      +      "minimum": 0,
      +      "type": "number"
      +    }
      +  },
      +  "type": "object"
      +}
    • changedInput schema / properties / tool_calls / description
      Previous value: -"Tool calls made during execution, in order, each { tool_name, input?, output?, latency_ms?, error? } — what the trajectory rules judge; evaluate_output reuses them when given this trace_id"New value: +"Tool calls made, in order, each { tool_name, input?, output?, latency_ms?, error? }; the trajectory rules judge them"
    • addedInput schema / properties / tool_calls / items / properties / call_id
      Added value: +{
      +  "type": "string"
      +}
    • addedInput schema / properties / tool_calls / items / properties / cost_usd
      Added value: +{
      +  "type": "number"
      +}
    • addedInput schema / properties / tool_calls / items / properties / token_usage
      Added value: +{
      +  "properties": {
      +    "completion_tokens": {
      +      "type": "number"
      +    },
      +    "prompt_tokens": {
      +      "type": "number"
      +    },
      +    "total_tokens": {
      +      "type": "number"
      +    }
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / tool_calls / items / properties / truncated
      Added value: +{
      +  "type": "boolean"
      +}
    • addedInput schema / properties / tools
      Added value: +{
      +  "description": "Your MCP tools/list result, verbatim; lets the rules check call arguments later",
      +  "items": {
      +    "additionalProperties": false,
      +    "properties": {
      +      "_meta": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "annotations": {
      +        "additionalProperties": {},
      +        "properties": {
      +          "destructiveHint": {
      +            "type": "boolean"
      +          },
      +          "idempotentHint": {
      +            "type": "boolean"
      +          },
      +          "openWorldHint": {
      +            "type": "boolean"
      +          },
      +          "readOnlyHint": {
      +            "type": "boolean"
      +          },
      +          "title": {
      +            "type": "string"
      +          }
      +        },
      +        "type": "object"
      +      },
      +      "description": {
      +        "maxLength": 4096,
      +        "type": "string"
      +      },
      +      "execution": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "inputSchema": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "name": {
      +        "maxLength": 128,
      +        "minLength": 1,
      +        "type": "string"
      +      },
      +      "outputSchema": {
      +        "additionalProperties": {},
      +        "propertyNames": {
      +          "type": "string"
      +        },
      +        "type": "object"
      +      },
      +      "title": {
      +        "maxLength": 512,
      +        "type": "string"
      +      }
      +    },
      +    "required": [
      +      "name"
      +    ],
      +    "type": "object"
      +  },
      +  "maxItems": 200,
      +  "type": "array"
      +}
    • addedOutput schema / description
      Added value: +"Nested evaluation fields: https://iris-eval.com/response-schema-v1.json"
    • addedOutput schema / properties / cost_estimate
      Added value: +{}
    • addedOutput schema / properties / cost_source
      Added value: +{
      +  "enum": [
      +    "reported",
      +    "estimated"
      +  ],
      +  "type": "string"
      +}
    • addedOutput schema / properties / cost_usd
      Added value: +{
      +  "type": [
      +    "number",
      +    "null"
      +  ]
      +}
    • addedOutput schema / properties / evaluation
      Added value: +{
      +  "additionalProperties": {},
      +  "properties": {},
      +  "type": "object"
      +}
    • removedOutput schema / properties / status / description
      Removed value: -"always \"stored\" on success"
    • removedOutput schema / properties / trace_id / description
      Removed value: -"the stored trace id, 32 hex — pass it to evaluate_output, get_traces or delete_trace"
    • changedOutput schema / required
      Previous value: -[
      -  "trace_id",
      -  "status"
      -]New value: +[
      +  "trace_id",
      +  "status",
      +  "cost_usd"
      +]
  2. Changed3 schema fields changedv0.9.0
    • changedInput schema / properties / spans / description
      Previous value: -"Detailed execution spans (hierarchical span tree with timings, attributes, events)"New value: +"Detailed execution spans (hierarchical span tree with timings, attributes, events); a span without start_time takes the trace timestamp"
    • changedInput schema / properties / tool_calls / description
      Previous value: -"Tool calls made during execution (per-call latency, errors, input/output)"New value: +"Tool calls made during execution, in order, each { tool_name, input?, output?, latency_ms?, error? } — what the trajectory rules judge; evaluate_output reuses them when given this trace_id"
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": {},
      +  "properties": {
      +    "status": {
      +      "const": "stored",
      +      "description": "always \"stored\" on success",
      +      "type": "string"
      +    },
      +    "trace_id": {
      +      "description": "the stored trace id, 32 hex — pass it to evaluate_output, get_traces or delete_trace",
      +      "type": "string"
      +    }
      +  },
      +  "required": [
      +    "trace_id",
      +    "status"
      +  ],
      +  "type": "object"
      +}
  3. Changed2 schema fields changedv0.8.0
    • addedInput schema / additionalProperties
      Added value: +false
    • addedInput schema / properties / tool_calls / items / additionalProperties
      Added value: +false
  4. Changed8 schema fields changedv0.4.6
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / metadata / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • removedInput schema / properties / spans / items / additionalProperties
      Removed value: -false
    • addedInput schema / properties / spans / items / properties / attributes / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • removedInput schema / properties / spans / items / properties / events / items / additionalProperties
      Removed value: -false
    • addedInput schema / properties / spans / items / properties / events / items / properties / attributes / propertyNames
      Added value: +{
      +  "type": "string"
      +}
    • removedInput schema / properties / token_usage / additionalProperties
      Removed value: -false
    • removedInput schema / properties / tool_calls / items / additionalProperties
      Removed value: -false
  5. Changed11 schema fields changedv0.1.10
    • changedInput schema / properties / agent_name / description
      Previous value: -"Name of the agent"New value: +"Agent name — used for filtering in get_traces (e.g., \"customer-support-bot\")"
    • changedInput schema / properties / cost_usd / description
      Previous value: -"Total cost in USD"New value: +"Total cost in USD — overrides per-span aggregation when provided (treated as authoritative)"
    • changedInput schema / properties / framework / description
      Previous value: -"Agent framework name"New value: +"Agent framework identifier (e.g., langchain, autogen, custom)"
    • changedInput schema / properties / input / description
      Previous value: -"Agent input text"New value: +"Agent input text — the user prompt or upstream input that produced this output"
    • changedInput schema / properties / latency_ms / description
      Previous value: -"Total execution time in milliseconds"New value: +"Total execution time in milliseconds (end-to-end agent latency)"
    • changedInput schema / properties / metadata / description
      Previous value: -"Arbitrary metadata"New value: +"Opaque key-value tags (e.g. {requestId, userId, env}) — queryable in dashboard, not via get_traces filters"
    • changedInput schema / properties / output / description
      Previous value: -"Agent output text"New value: +"Agent output text — what the agent produced (pass to evaluate_output for scoring)"
    • changedInput schema / properties / spans / description
      Previous value: -"Detailed execution spans"New value: +"Detailed execution spans (hierarchical span tree with timings, attributes, events)"
    • changedInput schema / properties / timestamp / description
      Previous value: -"Trace timestamp (ISO 8601)"New value: +"Trace timestamp (ISO 8601); defaults to now() when omitted"
    • changedInput schema / properties / token_usage / description
      Previous value: -"Token usage breakdown"New value: +"Token usage breakdown (prompt/completion/total — used for cost analysis)"
    • changedInput schema / properties / tool_calls / description
      Previous value: -"Tool calls made during execution"New value: +"Tool calls made during execution (per-call latency, errors, input/output)"
  6. Addedv0.1.8
  7. Removedv0.1.7
  8. First observed

TDQS

A4.7/5.0
Behavior5/5

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

The write semantics are clearly disclosed as an immutable local-storage write with no deduplication, consistent with the non-readOnly, non-idempotent annotations. It adds error codes, failure shape, recovery guidance, and the fact that evaluate=true triggers scoring in the same call, which is valuable context beyond the annotations.

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?

The description is front-loaded with the core action and trace_id return, then uses short labeled sections for behavior, exclusions, returns, errors, and siblings. For a 17-parameter tool it is compact and every section provides actionable information.

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?

It covers the essential behavioral traits for a complex write tool: required minimal input, immutability, no deduplication, inline evaluation behavior, error handling, and alternatives. With an output schema and full schema descriptions also present, the description is complete enough for correct invocation.

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 the schema already documents the 17 parameters thoroughly. The description adds useful high-level guidance that only agent_name is required and that tool_calls, tools, input/output, and cost should be stored for rule evaluation, but it does not add detailed semantics beyond the schema for most parameters.

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 states a precise verb and resource: store one agent execution trace and return a trace_id. It also explicitly distinguishes this from evaluate_output, get_traces, and delete_trace, so an agent can tell what this tool is for without opening the schema.

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

Usage Guidelines5/5

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

It gives explicit when-not-to-use guidance: use evaluate_output to score a stored trace, and delete_trace plus relog to change one. It also explains the inline evaluate=true alternative and names the sibling query tool, leaving little to inference.

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