Skip to main content
Glama
okenjioxx

Roblox Executor MCP Server

by okenjioxx

Count how many times a function is called (MUTATES STATE via hookfunction)

count-function-calls
Destructive

Hook any game function to count its calls, read the live count, then restore the original. Confirms anticheat ticks, hot paths, or remote handlers actually run.

Instructions

WRITES LIVE GAME STATE — INSTALLS A PERSISTENT GLOBAL HOOK. Lightweight call-frequency counter for any function: hook a target so that every invocation bumps an integer counter, then read the counter, then restore the original. Unlike hook-and-log-function (which records full args/returns), this captures ONLY a count, so it is the cheapest way to answer 'is this function actually being called, and how often?' — ideal for confirming an anticheat tick fires, measuring how hot a code path is, or verifying a remote handler runs. WORKFLOW (stateful — survives across tool calls via getgenv().__mcp_callCounts, keyed by functionPath): 1. action='start' with functionPath — resolves the target, captures the original, installs a counting hook that transparently calls the original and increments a counter. Returns { started, key }. 2. action='fetch' with the same functionPath — returns { calls } captured so far WITHOUT stopping. Poll to watch live. 3. action='stop' with the same functionPath — restores the original and clears the entry. Returns { stopped, calls }. CAVEATS: the hook is GLOBAL and PERSISTS until you stop it (or the client restarts), adds (small) overhead on every call, and a live function hook CAN TRIP ANTICHEAT — always stop when done. The counting work is pcall-isolated and the hook always calls through to the original, so behavior is unchanged. Requires hookfunction, newcclosure, and getgenv; restoration uses hookfunction(target, original) with a restorefunction fallback. Returns { error } if a capability is missing, the target cannot be resolved, or there is no active counter for fetch/stop. Signature: { action: "start" | "fetch" | "stop", functionPath: string?, threadContext: number? }. Phase: act; cost=medium; idempotency=contextual-write. Requires: active-client, resolved-target, explicit-mutation-approval. Produces: operation-receipt. Verify with: assert-state. Safety: MUTATING; writes live game/client state. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes'start' installs the counting hook on functionPath; 'fetch' returns the call count so far (hook stays live); 'stop' restores the original function and clears the counter. Use the SAME functionPath for all three so they address the same registry entry.
functionPathNoLuau expression resolving to the function to count, e.g. 'getsenv(game.Players.LocalPlayer.PlayerScripts.Main).heartbeat', 'getrawmetatable(game).__namecall', or 'getconnections(game.Workspace.Part.Touched)[1].Function'. Evaluated as `return <functionPath>` and must resolve to a function. REQUIRED for 'start'. For 'fetch'/'stop' it is the registry key identifying which running counter to act on, so it must match the string used at start.
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.8/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing that the hook is global and persists until stopped or client restart, adds per-call overhead, and can trip anticheat, plus the pcall-isolation and call-through guarantee and the hookfunction/restorefunction fallback restoration path. This is exactly the mutation-safety context an agent needs before invoking a destructiveHint tool.

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?

Front-loads the critical warning ('WRITES LIVE GAME STATE — INSTALLS A PERSISTENT GLOBAL HOOK') and the numbered workflow is easy to follow. It is long and carries some boilerplate meta footer (Phase/cost/idempotency/Safety) that slightly dilutes density, but nearly every sentence carries operational value.

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 complex stateful mutation tool with no output schema, it documents each action's return shape ({started,key}, {calls}, {stopped,calls}), the error conditions, the persistence model, and the required capabilities — nothing an agent needs to invoke and manage it 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 100% so the baseline is 3, but the description adds real value by explaining that action='fetch' polls without stopping, that functionPath doubles as the registry key across all three actions, and the underlying getgenv().__mcp_callCounts keying. threadContext is left unexplained but the schema already documents it.

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 and resource ('Lightweight call-frequency counter for any function') and explicitly distinguishes itself from the sibling hook-and-log-function by contrasting what each captures. An agent can tell exactly what this does and how it differs without opening a schema.

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

Usage Guidelines5/5

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

Names the alternative (hook-and-log-function) with the tradeoff that selects it, and gives concrete when-to-use scenarios ('confirming an anticheat tick fires, measuring how hot a code path is, or verifying a remote handler runs'). It also spells out the three-action workflow and that the same functionPath must be reused.

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