Trace a hook
hook_traceRecords calls to a Garry's Mod hook event over a set duration or call cap, serializing arguments so you can inspect what fired and when without changing game behavior.
Instructions
Records the calls of a hook event for duration_s (or until max_calls), with each call's arguments serialized (entities as {__type, id, class...}), through a temporary hook.Add that returns nothing (game behaviour unchanged), removed at the end. Waits the whole duration (progress reported; MCP task possible). Result: {event, calls: [{t (seconds since start), args: [...]}], recorded, total_calls (also those past max_calls), capped, duration_s, tracer_removed}. Not seen: calls that a hook running before it stopped by returning a value. Error realm_lost if the map changes meanwhile. Example: {"realm": "server", "event": "PlayerSay", "duration_s": 10}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"event": "<event>"
},
"name": "hook_trace"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No | Argument serialization depth (default 2). | |
| event | Yes | E.g. EntityEmitSound, PlayerSpawn, Think. | |
| realm | No | Default server. | |
| instance | No | Optional. Instance identifier (see instances_list). If present and different from the local instance, the call is relayed by the coordinator to that instance. | |
| max_calls | No | Cap on recorded calls (default 100). | |
| duration_s | No | Default 5. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| next | No | ||
| note | No | ||
| calls | Yes | ||
| event | Yes | ||
| capped | No | ||
| warning | No | ||
| recorded | Yes | ||
| next_call | No | ||
| duration_s | No | ||
| answered_by | No | ||
| total_calls | Yes | ||
| tracer_removed | No | ||
| truncated_note | No | ||
| version_warning | No |