Find entities
ents_findLists map entities filtered by class, model, or distance from a point, returning IDs, positions, and distances for inspection or targeting.
Instructions
Lists entities, filtered by class, model and/or distance (all filters combine; none = every entity). class and model are case-insensitive globs where * matches anything ("prop_*", "door", "models/props_c17/"). near + radius keep the entities whose position is within radius of near (ents.FindInSphere), sorted nearest first, each with distance. Result: {entities: [{id, class, model, name (targetname, if any), nick (players), pos [x,y,z], ang [p,y,r], distance?}], count (all matches), truncated (count > limit)}. id is the entity index: pass it to ent_info, ent_fire, ent_remove (a clientside-only entity, ClientsideModel and the like, has id -1: no tool can address it, see note; use lua_exec in the client realm). A number the game cannot hold (NaN, infinity) reads null. Server realm by default; the client realm only sees networked entities (and no targetnames). Example: {"class": "func_door", "near": [0, 0, 64], "radius": 1024, "limit": 10}. Needs a loaded map (map_load): the server and client realms do not exist at the main menu.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "ents_find"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| near | No | Center of the search sphere, [x, y, z] in Hammer units. | |
| class | No | Class glob, case-insensitive, e.g. prop_physics or prop_*. | |
| limit | No | Max entities returned (default 100); count still counts all. | |
| model | No | Model path glob, case-insensitive, e.g. *chair*. | |
| realm | No | Realm (default server). | |
| radius | No | Sphere radius in Hammer units, used with near (default 512). | |
| 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 |
|---|---|---|---|
| next | No | ||
| note | No | ||
| count | Yes | ||
| warning | No | ||
| entities | Yes | ||
| next_call | No | ||
| truncated | Yes | ||
| answered_by | No | ||
| truncated_note | No | ||
| version_warning | No |