invarium_setup_tracing
Install or update the Invarium tracer library in .invarium/invarium_trace.py. Returns a command that your IDE assistant runs to download the tracer directly from the MCP server.
When to Use
Call invarium_setup_tracing when setting up behavioral tracing before running tests (Phase 3, Step 10 in the Invarium workflow). The tool returns a shell command that your IDE assistant executes to download the tracer file.
See Run Tests and Sync Results for the full testing workflow.
Parameters
This tool takes no parameters.
invarium_setup_tracingInstall or update the Invarium tracer library in .invarium/. Returns a command to download invarium_trace.py from the MCP server.
Returns
Shell command (curl) to download and install the tracer, plus import instructions.
Example
"Set up behavioral tracing for my agent"Response
The tool returns a curl command for the IDE assistant to execute:
Install or update the Invarium tracer:
mkdir -p .invarium && curl -sS https://mcp.invarium.dev/api/tracer -o .invarium/invarium_trace.py
Do NOT modify this file — it is managed by Invarium.
Next: write test_run.py using test cases from invarium_get_tests.
Import with:
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '.invarium'))
from invarium_trace import run_test_casesThe IDE assistant runs the curl command using its shell tool, which writes the file directly to your project directory.
Examples
Basic Setup
"Set up behavioral tracing for my agent."Updating After a Server Upgrade
If the MCP server was upgraded, the local tracer may be outdated. Call this tool to pull the latest version:
"Update the Invarium tracer to the latest version."How It Differs from the MCP Resource
The invarium://templates/trace-library MCP resource contains the full tracer source code. invarium_setup_tracing is more efficient — it downloads the file directly without passing the content through the conversation.
Do not modify .invarium/invarium_trace.py manually. The file is managed by Invarium and will be overwritten if you call this tool or invarium_connect again.
Notes
- The
mkdir -p .invariumin the curl command creates the directory if it does not exist. invarium_connectalso returns the curl command as part of its setup instructions.invarium_setup_tracingis useful when you need to update the tracer independently.- Import the tracer in your test script with
sys.path.insertfollowed byfrom invarium_trace import run_test_cases(see the response example above).
See Error Codes for error handling reference.