Skip to main content
Glama

inject_process

Idempotent

Inject a runtime probe into a running game process to unlock online tools like runtime_*, hook_*, and drain_events. Automatically switches session context when the target belongs to another game.

Instructions

把运行时探针注入正在运行的游戏进程。目标换了游戏时会把会话身份与索引一起换过去,并在返回里给 context_switched。

注入后才能使用 runtime_* / hook_* / drain_events 等在线工具。 同一个进程只会注入一次(重复调用会复用,不会重复 Hook)。

会话上下文会自动跟随目标:注入的进程若属于另一个游戏,会话身份 (game_dir / engine / metadata_path)与静态索引会一起切过去,返回里给 context_switched 说明换了哪个游戏。为什么必须切:否则 search_*(旧游戏) 与 runtime_*(新游戏)属于两个游戏,token 对账这把「尺子」本身就是错的。 反推不出目标属于哪个游戏时不猜,改用 context_warning 如实提示。

权限:不需要管理员。实测(2026-10)普通用户权限注入 IL2CPP 游戏 成功(本进程与游戏进程的完整性级别都是 Medium,attach 后取运行时、 枚举实例都正常)。唯一要匹配的是权限级:游戏若以管理员身份运行 (完整性级别 High),普通权限的 Agent 才注入不进去。 游戏带反调试 / 反注入时也会失败 —— 那是保护机制,不是权限问题。

Args: pid: 目标进程号。留空则自动找当前游戏的主程序。 auto_find: 没给 pid 时是否自动查找。 preferred_module: IL2CPP 模块名,默认自动识别 (GameAssembly.dll / libil2cpp.so)。

Returns: {ok, pid, init: {module, base, api_available, api_missing, fallbacks}, context_switched?, context_warning?}

Input Schema

NameRequiredDescriptionDefault
pidNo
auto_findNo
preferred_moduleNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.6/5.0
Behavior5/5

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

Adds substantial context beyond annotations: permission requirement (no admin needed, measured 2026-10), the integrity-level condition that actually causes failure (High vs Medium), anti-debug protection as a distinct failure mode, and forced session-context switching with context_switched/context_warning signaling. The idempotency claim matches idempotentHint=true and destructiveHint=false is consistent with a non-destructive attach.

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 and generally well-organized, but the session-context switch is explained three times (first sentence, the dedicated paragraph, and again in the Returns section), and the '为什么必须切' rationale plus the token-reconciliation metaphor consume space without adding actionable information.

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 zero-required-param, no-output-schema tool, the description covers inputs, the return shape (ok, pid, init with module/base/api_available/api_missing/fallbacks, plus context_switched/context_warning), failure modes, and permission setup. An agent has everything needed to call it and interpret the result.

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

Parameters5/5

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

Schema description coverage is 0%, so the description carries the full burden and does: pid (blank → auto-locate main program), auto_find (whether to auto-search without pid), preferred_module (IL2CPP module name, auto-detected as GameAssembly.dll / libil2cpp.so). Each parameter gets meaning the bare schema lacks.

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: injecting a runtime probe into a running game process. It also states the consequence (enables runtime_*/hook_*/drain_events) and the scope (one injection per process), which clearly separates it from siblings like hook_method or find_game_processes.

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?

Explicitly states the prerequisite relationship — the online tools runtime_*/hook_*/drain_events only work after injection — and that repeat calls reuse the existing session rather than re-hooking. It does not route the agent on how to obtain a pid (find_game_processes is a sibling), only that blank pid triggers auto-find.

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