Wrap a Luau function as a C closure and retain it
new-c-closureCreates a debug closure wrapper from a Luau function path, stores it under getgenv().__mcp_closure_refs, and returns a reusable Reference plus metadata.
Instructions
Call newcclosure(function, debugName?) and store the wrapper under getgenv().__mcp_closure_refs, returning a reusable Reference expression and closure metadata. Signature: { functionPath: string, threadContext: number?, key: any?, debugName: any? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client, resolved-target. Capabilities: debug closure primitives. Produces: created-handle. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Optional stable key for getgenv().__mcp_closure_refs. Generated when omitted. | |
| debugName | No | Optional validated input for debug name. | |
| functionPath | Yes | Luau expression resolving to the target function. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |