Skip to main content
Glama

eval_script

Destructive

Execute custom Frida JavaScript inside a running game process to probe engine internals or debug issues when built-in tools are insufficient; returns JSON-serializable results.

Instructions

在游戏进程内执行任意 Frida JS 代码 —— 应急逃生舱。

与 AiMod 的 eval_script 同定位:当预置工具不够用时, 直接下发 JS 探测。

可用全局对象:mod / api / funcs / hooks(IL2CPP 侧), 以及 monoFuncs 与 BE(Mono 侧的已绑定导出、以及当前选中的后端对象)。 后者是排查 Mono 问题的必需品:例如 "typeof monoFuncs.mono_field_get_offset" 能直接看出某个导出有没有绑上, 不必去复刻绑定逻辑。

返回值必须是可 JSON 序列化的(字符串/数字/布尔/数组/普通对象)。

示例: "Process.arch" "mod.base.add(0x1000).toString()" "(function(){ return Process.enumerateModules().length; })()" "typeof monoFuncs.mono_get_root_domain"

Args: code: JS 表达式或语句块。

Input Schema

NameRequiredDescriptionDefault
codeYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true, openWorldHint=true, readOnlyHint=false and idempotentHint=false, so the safety bar is lower; the description still adds genuine substance by documenting the available globals (mod/api/funcs/hooks, monoFuncs/BE) and the hard constraint that return values must be JSON-serializable. It does not say what happens on a thrown exception or a crashed process, which for an arbitrary-code tool is a notable omission.

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?

The critical framing ('escape hatch', 'when preset tools are not enough') is front-loaded, then globals, then return contract, then examples — a sensible dependency order. It is on the long side and the monoFuncs explanation is slightly instructional rather than definitional, but every block is usable information.

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

Completeness4/5

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

No output schema exists, so the description correctly steps in to define the return contract as JSON-serializable values. Combined with the annotations and the examples, an agent has enough to invoke it competently; only failure-mode and side-effect disclosure is thin for a tool that runs arbitrary code in a live process.

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 description coverage is 0% for the single `code` parameter, so the description must carry the load — and it does, defining it as a JS expression or statement block and supplying four concrete examples spanning a plain expression, an address chain, an IIFE and a `typeof` probe. What it lacks is any statement about error/exception surfacing or size limits on the payload.

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 + resource (execute arbitrary Frida JS inside the game process) and immediately frames its niche with '应急逃生舱' (escape hatch of last resort) and '与 AiMod 的 eval_script 同定位'. An agent can distinguish it from the 40+ targeted siblings like hook_method or read_memory without opening the schema.

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?

'当预置工具不够用时,直接下发 JS 探测' gives explicit triggering context, and naming the preset tools collectively as the alternative routes the agent correctly. It falls short of a full 5 because it never says when NOT to use it (e.g. prefer the dedicated tool for a known operation) nor warns about how easily the escape hatch can destabilize the session.

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