Skip to main content
Glama

Inspect running code

inspect_code
Read-only

Inspect running game code for reverse engineering: read upvalues and constants, search the garbage collector for functions or tables, and list signal connections.

Instructions

Look inside code that is running in the game, for reverse engineering. Actions: upvalues and constants (path of a script; for a ModuleScript also function_name to look at one function of the module), gc (search the garbage collector for functions by name_contains or has_constant, or for tables by has_key; at least one filter is required) and connections (path of an instance and the name of one of its signals: lists the handlers that are connected, with the function name, line, source and owning script). Needs the matching executor functions (getscriptclosure, getupvalues, getconstants, getgc, getconnections) and says which one is missing. Only reads. Requires the connected state.

Input Schema

NameRequiredDescriptionDefault
kindNogc: what to search for (default function).
pathNoupvalues, constants: dotted path of the script. connections: dotted path of the instance.
limitNoMaximum entries to return (default 40 for upvalues and constants, 25 otherwise).
actionYesWhat to inspect.
clientNoClient id from list_clients, for example c2. Defaults to the client that connected last.
signalNoconnections: the event name, for example MouseButton1Click or Touched.
has_keyNogc, tables: the table has this string key.
has_constantNogc, functions: the function uses this string constant.
function_nameNoupvalues, constants: a function of the ModuleScript's returned table, instead of the main chunk.
name_containsNogc, functions: the function name contains this.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.4.0

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and openWorldHint=false, and the description usefully reinforces this ('Only reads') while adding execution-environment requirements (needs getscriptclosure/getupvalues/getconstants/getgc/getconnections, reports which one is missing, requires the connected state) and the shape of connection results. These are real value-adds beyond the annotations, but it says nothing about failure modes for non-existent paths, rate/cost of a gc scan, or result size behavior beyond the limit default.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

It is one dense but front-loaded block that leads with purpose before enumerating actions and requirements; essentially every clause carries information. It is slightly run-on as a single paragraph, and a short bulleted action breakdown would have scanned better, keeping it from a 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 10-parameter, four-action tool with no output schema, the description covers what each action does, which parameters pair with which action, the executor dependency and its error reporting, the connection-state prerequisite, and even the fields returned for connections. Little an agent needs in order to invoke this correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, so the baseline is 3; the description earns the extra point by tying parameters to actions (path means a script path for upvalues/constants but an instance path for connections; function_name only applies to ModuleScript tables) and by stating the gc filter constraint that the schema cannot express. The 40/25 limit defaults are left to the schema, which is fine.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening verb+resource ("Look inside code that is running in the game, for reverse engineering") plus the enumeration of the four actions (upvalues, constants, gc, connections) makes the tool's scope unmistakable and cleanly separates it from static-source siblings like get_script_source by stressing 'running' code. It never names a sibling explicitly, so it stops short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives per-action context and prerequisites: path for upvalues/constants vs. instance path + signal name for connections, function_name only when targeting a function of a ModuleScript's returned table, and 'at least one filter is required' for gc. That is strong when-to-use guidance, though it never points an agent to alternatives when this tool is the wrong choice.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.