Skip to main content
Glama

hook_address

Installs a hook at any specified address to intercept native functions, system APIs, or module-base-plus-RVA targets, recording calls and optionally overriding return values.

Instructions

在任意地址安装 Hook(不限于托管方法)。适用于原生函数、系统 API、以及「模块基址 + RVA」算出的地址。

适用于:原生游戏函数、系统 API、以及从静态分析里算出的地址 (模块基址 + RVA)。

Args: address: 目标地址,十六进制(如 "0x7ffa05f7f050")。 args_type: 参数类型列表,逗号分隔(同 hook_method)。 写错规格名会直接报错。 retval_type: 返回值类型(int/uint/float/double/ptr/string/bool)。 max_calls: 最多记录多少次。 backtrace: 是否记录调用栈。 override_retval: 受控改写返回值(默认空串 = 只观察不改)。语义与 取值规则同 hook_method(override_retval=...):支持 int/uint/long/ulong/bool/ptr/float/double,其余当场拒绝。 它进探针的 hooks 表 → hook_status 可见、unhook 可卸。

Input Schema

NameRequiredDescriptionDefault
labelNo
addressYes
args_typeNo
backtraceNo
max_callsNo
retval_typeNoptr
override_retvalNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=false, idempotentHint=false and openWorldHint=true, so the description's job is lighter, yet it still adds real behavior: the hook lands in the probe's hooks table, is visible via hook_status, and is removable with unhook. It also warns that an invalid args_type spec fails immediately and that unsupported override_retval types are rejected on the spot. It does not say whether a live session/process is required before calling, which would have made this a 5.

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-loaded with the scope statement and the hook_method contrast, and the args block is easy to scan. However, the applicability clause is repeated almost verbatim in the opening two paragraphs ('适用于原生函数、系统 API、以及「模块基址 + RVA」算出的地址' twice), which is wasted space.

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?

For a 7-parameter mutation tool with no output schema, the description covers target identification, argument typing, throttling, backtracing, and return-value override behavior, plus lifecycle integration with hook_status/unhook. It stops short of explaining how captured calls are retrieved (the drain_events sibling) and leaves 'label' undocumented, so an agent still has a small inference to make.

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%, so the description must carry the parameters, and it does: address format (hex example), args_type syntax and failure mode, retval_type enum list, max_calls, backtrace, and the full override_retval semantics with accepted types and the empty-string default meaning. The only gap is the 'label' parameter, which appears in the schema but is never mentioned.

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 (install hook) and resource (arbitrary address), and explicitly scopes itself as 'not limited to managed methods', which cleanly separates it from the sibling hook_method. An agent can decide between the two without opening either 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?

Gives concrete when-to-use conditions: native game functions, system APIs, and addresses computed as module base + RVA from static analysis. It also implicitly routes managed-method hooking to hook_method by contrasting scope and by referencing hook_method's argument semantics.

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