filtergc — query the GC heap for functions or tables by structural criteria
filter-gcSearch live garbage collector objects for matching Lua closures or tables using structural criteria instead of manual Luau code.
Instructions
The headline reflection tool: run the executor's UNC filtergc(filterType, options) against the entire live garbage collector to find Lua closures or tables that match a structural fingerprint, without writing any Luau by hand. Far more targeted than a raw getgc() sweep — you describe WHAT you are looking for and the executor returns only the objects that match. For filterType='function' the options are { Name?, Hash?, IgnoreExecutor? (default true), Constants? (array of constants the closure must reference), Upvalues? (array of upvalue values the closure must hold) } — e.g. find the closure that owns the string 'FireServer' and the upvalue 1337. For filterType='table' the options are { Keys? (array of keys that must be present), Values? (array of values that must be present), KeyValuePairs? (record of exact key=value pairs), Metatable? } — e.g. find the player-data table that has a 'Coins' key. Each match is encoded to a compact summary: functions report { source, line, name } (via debug.info) and tables report { address, keyCount }. Output is capped by 'limit'. Requires filtergc (type-guarded; returns { error } where it is unavailable) and every call is pcall-wrapped so a locked object can never abort the query. Returns { filterType, matchCount, truncated, matches } or { error }. Signature: { filterType: "function" | "table", options: { Name: string?, Hash: string?, IgnoreExecutor: boolean?, Constants: {string | number | boolean}?, Upvalues: {string | number | boolean}?, Keys: {string | number | boolean}?, Values: {string | number | boolean}?, KeyValuePairs: {[string]: string | number | boolean}?, Metatable: string | number | boolean? }, limit: number?, threadContext: number?, timeoutMs: number? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client. Capabilities: getgc. Produces: structured-result. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of matches to encode and return (default 100). Hitting this sets truncated=true. | |
| options | Yes | The UNC filtergc criteria. Only the fields relevant to filterType are emitted into the Luau. | |
| timeoutMs | No | Optional per-call deadline in milliseconds; omit it to use the tool or server default. | |
| filterType | Yes | What kind of GC object to search for: 'function' (Lua closures) or 'table'. This selects which option set below is meaningful. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |