Skip to main content
Glama
okenjioxx

Roblox Executor MCP Server

by okenjioxx

Hook a metamethod on an object (MUTATES live state)

hook-metamethod
Destructive

Replace a metamethod on a live Roblox object with a custom hook to intercept every call routed through it. Requires confirm=true because it mutates state persistently.

Instructions

WRITES LIVE GAME STATE. DANGER — MUTATES STATE PERSISTENTLY. Resolve a Luau expression to an object and replace one of its metamethods (e.g. __namecall, __index, __newindex) with your own function via hookmetamethod. The hook stays active and INTERCEPTS EVERY call routed through that metamethod (for __namecall that is essentially every method call in the game), so a slow, throwing, or mis-behaving hook can hang or crash the client and is a strong anticheat signal. The original metamethod is stored in getgenv().__mcp_hooks under a descriptive key so you can later restore it with restorefunction or by re-hooking the saved original. Your hook function typically wraps the stored original (call it for unhandled cases) and should be a C closure (wrap it in newcclosure) to look native. Requires hookmetamethod. Because it mutates state you MUST pass confirm=true; otherwise the tool refuses and does nothing. Returns { Target, Method, Hooked, OriginalStored } or { error }. Signature: { objectPath: string, method: string, hookFunction: string, confirm: boolean, threadContext: number? }. Phase: act; cost=medium; idempotency=contextual-write. Requires: active-client, resolved-target, explicit-mutation-approval. Capabilities: getrawmetatable. Produces: structured-result. Verify with: is-function-hooked. Safety: MUTATING; changes persistent executor-side observer or hook state. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
methodYesThe metamethod name to hook, e.g. '__namecall', '__index', '__newindex'. __namecall is the usual target for intercepting method calls (RemoteEvent:FireServer, etc.).
confirmYesSafety gate. Must be exactly true to apply the hook. If omitted or false the tool refuses and does nothing, because a persistent metamethod hook intercepts every call through it and can crash the game or trip anticheat.
objectPathYesLuau expression resolving to the object whose metamethod you want to hook, e.g. 'game', 'game.Players.LocalPlayer', or 'getgenv().SomeTable'. Evaluated as `return <objectPath>`.
hookFunctionYesRaw Luau expression evaluating to the replacement function, MUST resolve to a function. Usually wrapped in newcclosure so it appears as a native C closure, e.g. 'newcclosure(function(self, ...) local m = getnamecallmethod(); if m == "FireServer" then return end; return getgenv().__mcp_hooks["..."](self, ...) end)'. Evaluated as `return <hookFunction>`.
threadContextNoOptional Roblox thread identity for this call; omit it to use the server default.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.0-spies.2

TDQS

A4.3/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=false, but the description adds substantial behavioral context beyond them: the hook persists and intercepts every call (crash/hang/anticheat risk), the original is stored under getgenv().__mcp_hooks, the confirm gate, the C-closure wrapping guidance, and the exact return shape.

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

Conciseness3/5

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

Front-loaded with the danger warning and reasonably ordered, but it is dense and repeats the mutation warning multiple times ('WRITES LIVE GAME STATE', 'MUTATES STATE PERSISTENTLY', 'Safety: MUTATING') and includes a signature line that duplicates the schema. Some trimming would improve signal density.

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?

Despite no output schema, the description documents the return object ({ Target, Method, Hooked, OriginalStored } or { error }), the verification path (is-function-hooked), prerequisites, and failure guidance. An agent has everything needed to invoke and validate correctly.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already documents all five parameters thoroughly (method names, confirm gate, objectPath evaluation, hookFunction wrapping, threadContext default). The description restates the signature and confirm behavior but adds little syntax or format detail beyond what the schema provides, so baseline 3 applies.

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

Purpose5/5

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

States a specific verb (hook/replace) and resource (a metamethod on a resolved object) and names the underlying primitive hookmetamethod. It is clearly distinguishable from siblings like hook-function, list-hooks, restore-hook, and restore-function, which are referenced explicitly.

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?

Gives strong context: when to hook (to intercept calls routed through a metamethod), the requirement to pass confirm=true, and the recovery path via restorefunction or re-hooking the saved original. It does not, however, explicitly contrast itself against the closest sibling hook-function, leaving that selection to inference.

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

Deploy Server

Other Tools