Skip to main content
Glama
LuciferForge

agent-safety-mcp

by LuciferForge

trace_step

Log agent decision steps with confidence scores and reasoning to create audit trails for safety monitoring and analysis.

Instructions

Log a decision step in the current trace session.

Args: name: Step name (e.g. "analyze_signal", "classify_intent"). decision: What the agent decided. confidence: Confidence score (0.0-1.0). input_data: What the agent saw (brief description). reason: Why this decision was made. outcome: "ok" or "error".

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
decisionNo
confidenceNo
input_dataNo
reasonNo
outcomeNook

Implementation Reference

  • The implementation of the 'trace_step' tool, which logs a decision step to a tracer instance.
    def trace_step(
        name: str,
        decision: str = "",
        confidence: float = 0.0,
        input_data: str = "",
        reason: str = "",
        outcome: str = "ok",
    ) -> dict:
        """Log a decision step in the current trace session.
    
        Args:
            name: Step name (e.g. "analyze_signal", "classify_intent").
            decision: What the agent decided.
            confidence: Confidence score (0.0-1.0).
            input_data: What the agent saw (brief description).
            reason: Why this decision was made.
            outcome: "ok" or "error".
        """
        tracer = _get_tracer()
        with tracer.step(name, input=input_data) as step:
            logs = {}
            if decision:
                logs["decision"] = decision
            if confidence:
                logs["confidence"] = confidence
            if reason:
                logs["reason"] = reason
            if logs:
                step.log(**logs)
            if outcome == "error":
                step.fail(reason=reason or "unspecified error")
    
        return {
            "recorded": True,
            "step": name,
  • The registration of the 'trace_step' tool using the @mcp.tool decorator.
    @mcp.tool()
Behavior3/5

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

With no annotations provided, the description carries the full burden. It adds valuable behavioral constraints (confidence range 0.0-1.0, outcome enum 'ok'/'error') but omits side effects, persistence guarantees, or error conditions.

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?

Follows an efficient two-part structure: single-sentence purpose followed by an Args block. No redundancy; every sentence earns its place by providing unique information not present in structured fields.

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 6 parameters and lack of output schema/annotations, the description adequately covers input semantics. Minor gap: could clarify the relationship to trace_start (is it a prerequisite?) and what the tool returns.

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

Parameters5/5

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

Schema description coverage is 0%, but the description fully compensates by documenting all 6 parameters with semantic meaning, examples ('analyze_signal'), and value constraints that the schema lacks.

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 opens with a specific verb ('Log') and clear resource ('decision step in the current trace session'), precisely distinguishing it from siblings like trace_start (initiates session) and trace_save (persists session).

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?

While the phrase 'current trace session' implies this should be called during an active tracing workflow, there is no explicit guidance on when to use this versus trace_save or trace_summary, nor prerequisites like calling trace_start first.

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/LuciferForge/agent-safety-mcp'

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