Fields
idstringThe call's identifier. tool_end carries the same one.
toolstringThe tool's name.
categorystringIts category — computed from the arguments for six of them.
argsobjectExactly what it will run with.
Pairing it
const started = new Map();
onEvent: (e) => {
if (e.type === "tool_start") started.set(e.id, { tool: e.tool, at: Date.now(), args: e.args });
if (e.type === "tool_end") {
const call = started.get(e.id);
console.log(call.tool, e.ok ? "ok" : "failed", e.durationMs, "ms");
started.delete(e.id);
}
};import time
started = {}
def on_event(event):
if event["type"] == "tool_start":
started[event["id"]] = {"tool": event["tool"], "at": time.monotonic(), "args": event["args"]}
if event["type"] == "tool_end":
call = started.pop(event["id"])
print(call["tool"], "ok" if event["ok"] else "failed", round((time.monotonic() - call["at"]) * 1000), "ms")A refused call and a call to an unknown tool emit only tool_end. Pair by id and tolerate an end with no start, or a dangling entry will sit in your map forever.
Several can be open at once
In a turn where every call is a read or a task, the engine runs them together — so you may see several tool_start before the first tool_end, and the ends arrive in completion order, not call order. Keying on id is what makes that harmless.
The arguments are the display
args.path, args.command, args.query, args.pattern, args.key — the one meaningful string is what an interface shows beside the tool's name. The session record keeps the same idea as a short target.
They carry parentId — the identifier of the task call that started them — and agent, its name. Their own id is prefixed with the task's, so two runs never collide. Test parentId before treating an event as the main run's.