Inspect a Lua value
lua_inspectEvaluates a side-effect-free Lua expression and describes its value, type, table keys, metatable, or function source to help you discover APIs and structures.
Instructions
Evaluates an expression in a realm (it runs: keep it side-effect free; 2 s time limit) and describes the value. Result: {type, value (serialized to depth; 0 = summary only), and for a table: count, keys: [{key, key_type, type}] up to limit, truncated; metatable?: {type, name (MetaName), keys, methods (functions of __index)}}; for a function also {source, linedefined, lastlinedefined, from_mount, disk, mount_has_file, provenance} (see lua_function_source). Use it to discover an API or a structure; use lua_exec to compute something. Example: {"realm": "server", "expr": "FindMetaTable("Player")", "depth": 0, "limit": 300}.
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": {
"expr": "<expr>"
},
"name": "lua_inspect"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr | Yes | Lua expression, e.g. 'hook.GetTable()' or 'FindMetaTable("Entity")'. | |
| depth | No | Depth (default 1). | |
| limit | No | Max number of keys (default 100). | |
| realm | No | Lua state to run in. Default: menu in client mode, which has no game libraries (ents, util.TraceLine, players...): pass 'server' or 'client' for game code; they exist only once a map is loaded (map_load). On srcds: server (the default; no menu or client realm). | |
| 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. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| disk | No | ||
| keys | No | ||
| next | No | ||
| note | No | ||
| type | Yes | ||
| count | No | ||
| value | No | ||
| source | No | ||
| warning | No | ||
| metatable | No | ||
| next_call | No | ||
| truncated | No | ||
| from_mount | No | ||
| provenance | No | ||
| answered_by | No | ||
| linedefined | No | ||
| loaded_from | No | ||
| mount_has_file | No | ||
| truncated_note | No | ||
| lastlinedefined | No | ||
| provenance_note | No | ||
| version_warning | No |