Skip to main content
Glama

emu_stubs

Redirects import slots to generated stubs and sets per-API return values, letting captured code keep running and take desired success paths without patching the binary.

Instructions

Redirect every import slot to a generated stub, so the code can keep running.

A snapshot holds the image, not the module it imports from, so call qword ptr [rip+iat] would fault. This rewrites each IAT slot to a mov eax, imm; ret stub in a mapped page and logs every hit.

returns sets per-API return values: "Sleep=0,GetTickCount=0x64" or "kernel32.dll!CreateFileW=0x40"; unlisted imports return default. Driving a return value is how you take the success path through a check without patching the binary.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "key": "<key>"
    },
    "name": "emu_stubs"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyYes
defaultNo
returnsNo
sessionNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the full burden, and it does disclose the mechanism and one side effect: every hit gets logged. It does not say whether the rewrite is confined to the running emulator or mutates the snapshot file, whether stubs persist across sessions, or whether the operation is reversible, which matters for a tool that rewrites every import slot.

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 action and then justified by the concrete fault it prevents; each sentence adds information. The middle explanation of the fault is slightly verbose but earns its place by explaining why the stub is needed, and the `returns` example is compactly presented.

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

Completeness3/5

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

An output schema exists, so return values need no explanation, but the definition leaves open what `key` and `session` identify, whether the stub mapping persists, and how this relates to emu_stub_list for inspection. For a tool that modifies every IAT slot with zero annotation coverage, the description is solid on mechanism but incomplete on operating context.

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 0%, so the description must compensate, and it does so well for `returns` — documenting the `"Sleep=0,GetTickCount=0x64"` and `"kernel32.dll!CreateFileW=0x40"` syntax plus the `default` fallback for unlisted imports. However, `key` (the sole required parameter) and `session` are never explained, leaving half the surface undocumented.

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

Purpose4/5

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

States a concrete verb and resource: "Redirect every import slot to a generated stub," then specifies the exact mechanism (rewriting each IAT slot to a `mov eax, imm; ret` stub in a mapped page and logging every hit). That is far more than a restatement of the name, but it never distinguishes itself from sibling tools such as emu_stub_list or emu_available, so a reader must infer the boundary.

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 a clear triggering scenario — a snapshot holds the image but not the module it imports from, so `call qword ptr [rip+iat]` would fault — plus a working guidance note that driving a return value is how you take the success path through a check without patching the binary. It does not name an alternative tool or state when NOT to use this approach, so it falls short of explicit routing.

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