Skip to content

MCP tool reference

{
"mcpServers": {
"memscope": {
"command": "memscope-mcp"
}
}
}

The bare command and memscope-mcp server use the same stdio server. The server name is memscope-mcp. Handshake metadata keeps the public shape minimal; the server advertises tools and instructions, not a second transport or namespace.

Tool Request shape Purpose
processes filter?, pid?, parent?, service?, limit?, offset? Enumerate processes, with optional service and parent filtering. Entries can include path, command line, threads, and services.
attach process_name, pid? Open or switch the session to a selected process and publish a module snapshot.
modules filter?, limit?, refresh? List the current snapshot; refresh=true publishes a new snapshot generation.
read address, type_name, count? Read primitive, special, or composite values.
write address, value, type_name, verify? Write typed data or bytes. verify=true performs writable-range validation, pre-image capture, readback, and a restore attempt after a verification failure.
dump address, size?, pointers_only?, start_offset?, non_null_only?, max_entries?, annotation_level? Inspect a bounded 4096-byte window with pointer heuristics and pagination metadata.
chain base, offsets, read_final? Follow [[base+offset0]+offset1]... and format the final value.
scan start request or cursor continuation Run one strict AOB scan in addresses, first, or count mode.
scan_many patterns, scope?, mode?, max_matches?, timeout_ms?, diagnostics? Run 1–32 keyed AOB patterns in one shared traversal; mode is first or count.
lua script, timeout? Execute composed Lua with loops, dependent reads, native calls, and registered extension/plugin functions.
scripts action, name?, process?, args?, timeout? List or run saved Lua scripts. File tools create and edit scripts.

The server does not add a separate MCP tool for plugins. A plugin registers Lua functions into the existing lua tool.

processes(filter="target", limit=20)
attach(process_name="Target.exe", pid=1234)
modules(refresh=false, limit=50)
read(address="Target.exe+0x1000", type_name="bytes", count=2)

read, dump, chain, and scan require an attached process. processes and PEB-related Lua helpers can work before attachment.

scan rejects unknown fields, accepts either pattern or cursor, and uses strict request models. A start request can include a structured scope, mode, limit, max_matches, timeout_ms, and diagnostics. A continuation request contains a cursor plus only limit, timeout_ms, and diagnostics. See Scanning reference.

scan_many accepts 1–32 unique {key, pattern} entries, strict module/range scopes, first or count, and one shared traversal status. It intentionally has no address pagination.

Ordinary tools return dictionaries with success=true or success=false, an error code, and a bounded detail when an operation fails. The strict scan boundary returns a validated flat failure envelope:

{
"success": false,
"error": "INVALID_ARGUMENT",
"detail": "Unknown scan argument 'offset'",
"field": "offset"
}

The write result distinguishes MEMORY_NOT_WRITABLE, WRITE_ERROR, VERIFY_READ_FAILED, and VERIFY_MISMATCH when verification is enabled. See Errors and status.

Use lua for composed operations:

local base = getModuleBase("Target.exe")
if base then
addResult("signature", readBytesHex(base, 2))
end

Use scripts(action="list") to obtain absolute script paths. Use file tools to create or edit a .lua file, then run it with scripts(action="run", name="finder"). A process argument selects the saved-script namespace; it does not attach or switch targets.

The full function contract is in the Lua reference.

Server: Memscope MCP

List running processes with smart filtering. Returns array of {pid, name, path, parent_pid, threads, command_line, services[]}. Services are auto-included for svchost processes. Filters (combine as needed): filter - Substring match on process name pid - Exact PID lookup (returns single process) parent - Only processes with this parent PID service - Only processes hosting this service (e.g., "EventLog") Examples: processes(service="EventLog") - Find which svchost hosts EventLog processes(filter="svchost") - All svchosts with their services processes(pid=1820) - Details for specific PID processes(parent=700) - Children of services.exe

{
"properties": {
"filter": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Filter"
},
"pid": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Pid"
},
"parent": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Parent"
},
"service": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Service"
},
"limit": {
"default": 100,
"title": "Limit",
"type": "integer"
},
"offset": {
"default": 0,
"title": "Offset",
"type": "integer"
}
},
"title": "processesArguments",
"type": "object"
}

Attach to process and cache module bases. Returns pid, key_modules (base/size), saved_scripts list, scripts_dir, and log_file path. Use pid parameter when multiple processes share the same name (e.g., svchost.exe). Use processes() tool first to find the right PID. Examples: attach("Game.exe") or attach("svchost.exe", pid=1820)

{
"properties": {
"process_name": {
"title": "Process Name",
"type": "string"
},
"pid": {
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Pid"
}
},
"required": [
"process_name"
],
"title": "attachArguments",
"type": "object"
}

List loaded modules with base addresses, sizes, and paths. Set refresh to rebuild the module snapshot and advance its generation.

{
"properties": {
"filter": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Filter"
},
"limit": {
"default": 30,
"title": "Limit",
"type": "integer"
},
"refresh": {
"default": false,
"title": "Refresh",
"type": "boolean"
}
},
"title": "modulesArguments",
"type": "object"
}

Read typed data from memory. Primitive types: int8/sbyte, uint8/byte, int16/short, uint16/ushort, char, int32/int, uint32/uint, int64/long, uint64/ulong, float/single, double, bool/boolean, ptr/pointer/intptr. Special types: cstring, bytes, bytes[N]. Composite types: vector2/3/4, quaternion, color, color32, rect, bounds, matrix4x4. Use count > 1 for consecutive values; count controls length for bytes. Returns value or values array.

{
"properties": {
"address": {
"title": "Address",
"type": "string"
},
"type_name": {
"title": "Type Name",
"type": "string"
},
"count": {
"default": 1,
"title": "Count",
"type": "integer"
}
},
"required": [
"address",
"type_name"
],
"title": "readArguments",
"type": "object"
}

Write typed data to memory. Types: primitives, composite types (vector3 as {x,y,z} dict), bytes, and bytes[N]. Bytes values accept compact hex ("DEADBEEF"), spaced hex ("DE AD BE EF"), or [222, 173, 190, 239]. bytes[N] requires exactly N bytes. Set verify=True to require a writable range check, pre-image capture, byte-for-byte readback, and a pre-image restore attempt on post-write verification failure.

{
"properties": {
"address": {
"title": "Address",
"type": "string"
},
"value": {
"title": "value",
"type": "string"
},
"type_name": {
"title": "Type Name",
"type": "string"
},
"verify": {
"default": false,
"title": "Verify",
"type": "boolean"
}
},
"required": [
"address",
"value",
"type_name"
],
"title": "writeArguments",
"type": "object"
}

Smart memory dump with auto pointer detection. For exploring unknown structures. size is clamped to the remaining 4096-byte window. start_offset selects a byte offset within that window. annotation_level: minimal, normal, or full. Returns annotated entries showing likely pointers and values.

{
"properties": {
"address": {
"title": "Address",
"type": "string"
},
"size": {
"default": 256,
"title": "Size",
"type": "integer"
},
"pointers_only": {
"default": false,
"title": "Pointers Only",
"type": "boolean"
},
"start_offset": {
"default": 0,
"title": "Start Offset",
"type": "integer"
},
"non_null_only": {
"default": false,
"title": "Non Null Only",
"type": "boolean"
},
"max_entries": {
"default": 100,
"title": "Max Entries",
"type": "integer"
},
"annotation_level": {
"default": "normal",
"title": "Annotation Level",
"type": "string"
}
},
"required": [
"address"
],
"title": "dumpArguments",
"type": "object"
}

Follow pointer chain with standard RE semantics: add offset, then read. [[base+off0]+off1]... Offsets accept hex: ["0x148", "0x10"]. Returns chain steps, final_address, and final_value.

{
"properties": {
"base": {
"title": "Base",
"type": "string"
},
"offsets": {
"items": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
]
},
"title": "Offsets",
"type": "array"
},
"read_final": {
"default": "ptr",
"title": "Read Final",
"type": "string"
}
},
"required": [
"base",
"offsets"
],
"title": "chainArguments",
"type": "object"
}

Scan target memory with strict AOB patterns. Supports address pages with authenticated cursor continuation, first-hit mode, count mode, structured scopes, planner filters, and bounded diagnostics.

{
"$defs": {
"AllModulesScopeInput": {
"additionalProperties": false,
"properties": {
"kind": {
"const": "all_modules",
"title": "Kind",
"type": "string"
},
"filters": {
"$ref": "#/$defs/ScanFiltersInput"
}
},
"required": [
"kind"
],
"title": "AllModulesScopeInput",
"type": "object"
},
"ModulesScopeInput": {
"additionalProperties": false,
"properties": {
"kind": {
"const": "modules",
"title": "Kind",
"type": "string"
},
"names": {
"items": {
"minLength": 1,
"type": "string"
},
"maxItems": 64,
"minItems": 1,
"title": "Names",
"type": "array"
},
"filters": {
"$ref": "#/$defs/ScanFiltersInput"
}
},
"required": [
"kind",
"names"
],
"title": "ModulesScopeInput",
"type": "object"
},
"RangeScopeInput": {
"additionalProperties": false,
"properties": {
"kind": {
"const": "range",
"title": "Kind",
"type": "string"
},
"start": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"title": "Start"
},
"end_exclusive": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"title": "End Exclusive"
},
"filters": {
"$ref": "#/$defs/ScanFiltersInput"
}
},
"required": [
"kind",
"start",
"end_exclusive"
],
"title": "RangeScopeInput",
"type": "object"
},
"ScanFiltersInput": {
"additionalProperties": false,
"properties": {
"memory_types": {
"anyOf": [
{
"items": {
"enum": [
"image",
"mapped",
"private"
],
"type": "string"
},
"maxItems": 3,
"minItems": 1,
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Memory Types"
},
"executable": {
"default": "any",
"enum": [
"any",
"required",
"forbidden"
],
"title": "Executable",
"type": "string"
},
"writable": {
"default": "any",
"enum": [
"any",
"required",
"forbidden"
],
"title": "Writable",
"type": "string"
},
"sections": {
"anyOf": [
{
"items": {
"minLength": 1,
"type": "string"
},
"maxItems": 64,
"minItems": 1,
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Sections"
}
},
"title": "ScanFiltersInput",
"type": "object"
}
},
"additionalProperties": false,
"description": "Flat start-or-continuation request accepted by the strict MCP adapter.",
"oneOf": [
{
"not": {
"required": [
"cursor"
]
},
"required": [
"pattern"
]
},
{
"not": {
"anyOf": [
{
"required": [
"pattern"
]
},
{
"required": [
"scope"
]
},
{
"required": [
"mode"
]
},
{
"required": [
"max_matches"
]
}
]
},
"required": [
"cursor"
]
}
],
"properties": {
"pattern": {
"anyOf": [
{
"maxLength": 4096,
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Pattern"
},
"scope": {
"anyOf": [
{
"discriminator": {
"mapping": {
"all_modules": "#/$defs/AllModulesScopeInput",
"modules": "#/$defs/ModulesScopeInput",
"range": "#/$defs/RangeScopeInput"
},
"propertyName": "kind"
},
"oneOf": [
{
"$ref": "#/$defs/AllModulesScopeInput"
},
{
"$ref": "#/$defs/ModulesScopeInput"
},
{
"$ref": "#/$defs/RangeScopeInput"
}
]
},
{
"type": "null"
}
],
"default": null,
"title": "Scope"
},
"mode": {
"default": "addresses",
"enum": [
"addresses",
"first",
"count"
],
"title": "Mode",
"type": "string"
},
"limit": {
"anyOf": [
{
"maximum": 500,
"minimum": 1,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Limit"
},
"max_matches": {
"anyOf": [
{
"maximum": 100000,
"minimum": 1,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Max Matches"
},
"timeout_ms": {
"default": 30000,
"maximum": 30000,
"minimum": 100,
"title": "Timeout Ms",
"type": "integer"
},
"diagnostics": {
"default": false,
"title": "Diagnostics",
"type": "boolean"
},
"cursor": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Cursor"
}
},
"title": "ScanInput",
"type": "object"
}
{
"$defs": {
"AddressScanSuccess": {
"additionalProperties": false,
"properties": {
"success": {
"const": true,
"title": "Success",
"type": "boolean"
},
"mode": {
"const": "addresses",
"title": "Mode",
"type": "string"
},
"matches": {
"items": {
"$ref": "#/$defs/ScanHit"
},
"maxItems": 500,
"title": "Matches",
"type": "array"
},
"returned_count": {
"anyOf": [
{
"maximum": 500,
"minimum": 1,
"type": "integer"
},
{
"const": 0,
"type": "integer"
}
],
"title": "Returned Count"
},
"sequence_returned_count": {
"maximum": 100000,
"minimum": 0,
"title": "Sequence Returned Count",
"type": "integer"
},
"next_cursor": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"title": "Next Cursor"
},
"status": {
"$ref": "#/$defs/ScanStatus"
},
"diagnostics": {
"anyOf": [
{
"$ref": "#/$defs/ScanDiagnostics"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
"success",
"mode",
"matches",
"returned_count",
"sequence_returned_count",
"next_cursor",
"status"
],
"title": "AddressScanSuccess",
"type": "object"
},
"CountScanSuccess": {
"additionalProperties": false,
"properties": {
"success": {
"const": true,
"title": "Success",
"type": "boolean"
},
"mode": {
"const": "count",
"title": "Mode",
"type": "string"
},
"count": {
"anyOf": [
{
"maximum": 100000,
"minimum": 1,
"type": "integer"
},
{
"const": 0,
"type": "integer"
}
],
"title": "Count"
},
"observation": {
"enum": [
"complete_traversal",
"partial_traversal"
],
"title": "Observation",
"type": "string"
},
"status": {
"$ref": "#/$defs/ScanStatus"
},
"diagnostics": {
"anyOf": [
{
"$ref": "#/$defs/ScanDiagnostics"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
"success",
"mode",
"count",
"observation",
"status"
],
"title": "CountScanSuccess",
"type": "object"
},
"FirstScanSuccess": {
"additionalProperties": false,
"properties": {
"success": {
"const": true,
"title": "Success",
"type": "boolean"
},
"mode": {
"const": "first",
"title": "Mode",
"type": "string"
},
"match": {
"anyOf": [
{
"$ref": "#/$defs/ScanHit"
},
{
"type": "null"
}
]
},
"status": {
"$ref": "#/$defs/ScanStatus"
},
"diagnostics": {
"anyOf": [
{
"$ref": "#/$defs/ScanDiagnostics"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
"success",
"mode",
"match",
"status"
],
"title": "FirstScanSuccess",
"type": "object"
},
"ScanDiagnostics": {
"additionalProperties": false,
"properties": {
"duration_ms": {
"minimum": 0,
"title": "Duration Ms",
"type": "number"
},
"scope_fingerprint": {
"pattern": "^[0-9a-f]{64}$",
"title": "Scope Fingerprint",
"type": "string"
},
"sections": {
"items": {
"type": "string"
},
"maxItems": 64,
"title": "Sections",
"type": "array"
},
"strategy_counts": {
"additionalProperties": {
"minimum": 0,
"type": "integer"
},
"maxProperties": 4,
"propertyNames": {
"enum": [
"exact",
"all_wildcard",
"anchor",
"regex"
]
},
"title": "Strategy Counts",
"type": "object"
},
"unique_bytes_examined": {
"minimum": 0,
"title": "Unique Bytes Examined",
"type": "integer"
},
"physical_read_calls": {
"minimum": 0,
"title": "Physical Read Calls",
"type": "integer"
},
"physical_bytes_read": {
"minimum": 0,
"title": "Physical Bytes Read",
"type": "integer"
},
"physical_cursor_prefix_bytes": {
"minimum": 0,
"title": "Physical Cursor Prefix Bytes",
"type": "integer"
},
"region_count": {
"minimum": 0,
"title": "Region Count",
"type": "integer"
},
"span_count": {
"minimum": 0,
"title": "Span Count",
"type": "integer"
},
"candidate_count": {
"minimum": 0,
"title": "Candidate Count",
"type": "integer"
},
"verification_count": {
"minimum": 0,
"title": "Verification Count",
"type": "integer"
},
"control_polls": {
"minimum": 0,
"title": "Control Polls",
"type": "integer"
}
},
"required": [
"duration_ms",
"scope_fingerprint",
"sections",
"strategy_counts",
"unique_bytes_examined",
"physical_read_calls",
"physical_bytes_read",
"physical_cursor_prefix_bytes",
"region_count",
"span_count",
"candidate_count",
"verification_count",
"control_polls"
],
"title": "ScanDiagnostics",
"type": "object"
},
"ScanFailure": {
"additionalProperties": false,
"properties": {
"success": {
"const": false,
"default": false,
"title": "Success",
"type": "boolean"
},
"error": {
"enum": [
"INVALID_PATTERN",
"INVALID_SCOPE",
"INVALID_MODE",
"INVALID_ARGUMENT",
"MODULE_NOT_FOUND",
"AMBIGUOUS_MODULE",
"SECTION_NOT_FOUND",
"PROCESS_NOT_ATTACHED",
"INVALID_CURSOR",
"CURSOR_STALE",
"TARGET_CHANGED",
"INTERNAL_SCAN_ERROR"
],
"title": "Error",
"type": "string"
},
"detail": {
"maxLength": 1024,
"minLength": 1,
"title": "Detail",
"type": "string"
},
"field": {
"anyOf": [
{
"maxLength": 256,
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Field"
},
"hint": {
"anyOf": [
{
"maxLength": 512,
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hint"
}
},
"required": [
"error",
"detail"
],
"title": "ScanFailure",
"type": "object"
},
"ScanHit": {
"additionalProperties": false,
"properties": {
"address": {
"pattern": "^0x(?:0|[1-9A-F][0-9A-F]*)$",
"title": "Address",
"type": "string"
},
"module": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Module"
},
"module_offset": {
"anyOf": [
{
"pattern": "^0x(?:0|[1-9A-F][0-9A-F]*)$",
"type": "string"
},
{
"type": "null"
}
],
"title": "Module Offset"
}
},
"required": [
"address",
"module",
"module_offset"
],
"title": "ScanHit",
"type": "object"
},
"ScanStatus": {
"additionalProperties": false,
"properties": {
"termination": {
"enum": [
"scope_exhausted",
"page_limit",
"match_limit",
"first_hit",
"timeout",
"cancelled",
"target_changed",
"reader_error"
],
"title": "Termination",
"type": "string"
},
"read_gaps_detected": {
"title": "Read Gaps Detected",
"type": "boolean"
}
},
"required": [
"termination",
"read_gaps_detected"
],
"title": "ScanStatus",
"type": "object"
}
},
"anyOf": [
{
"discriminator": {
"mapping": {
"addresses": "#/$defs/AddressScanSuccess",
"count": "#/$defs/CountScanSuccess",
"first": "#/$defs/FirstScanSuccess"
},
"propertyName": "mode"
},
"oneOf": [
{
"$ref": "#/$defs/AddressScanSuccess"
},
{
"$ref": "#/$defs/FirstScanSuccess"
},
{
"$ref": "#/$defs/CountScanSuccess"
}
]
},
{
"$ref": "#/$defs/ScanFailure"
}
],
"title": "ScanResponse",
"type": "object"
}

Scan 1-32 keyed AOB patterns in one shared target-memory traversal. Supports only bounded first-hit and count modes, structured scopes, PE-section filters, and shared diagnostics.

{
"$defs": {
"AllModulesScopeInput": {
"additionalProperties": false,
"properties": {
"kind": {
"const": "all_modules",
"title": "Kind",
"type": "string"
},
"filters": {
"$ref": "#/$defs/ScanFiltersInput"
}
},
"required": [
"kind"
],
"title": "AllModulesScopeInput",
"type": "object"
},
"ModulesScopeInput": {
"additionalProperties": false,
"properties": {
"kind": {
"const": "modules",
"title": "Kind",
"type": "string"
},
"names": {
"items": {
"minLength": 1,
"type": "string"
},
"maxItems": 64,
"minItems": 1,
"title": "Names",
"type": "array"
},
"filters": {
"$ref": "#/$defs/ScanFiltersInput"
}
},
"required": [
"kind",
"names"
],
"title": "ModulesScopeInput",
"type": "object"
},
"NamedPatternInput": {
"additionalProperties": false,
"description": "One caller-keyed AOB pattern in a bounded batch request.",
"properties": {
"key": {
"minLength": 1,
"title": "Key",
"type": "string"
},
"pattern": {
"maxLength": 4096,
"minLength": 1,
"title": "Pattern",
"type": "string"
}
},
"required": [
"key",
"pattern"
],
"title": "NamedPatternInput",
"type": "object"
},
"RangeScopeInput": {
"additionalProperties": false,
"properties": {
"kind": {
"const": "range",
"title": "Kind",
"type": "string"
},
"start": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"title": "Start"
},
"end_exclusive": {
"anyOf": [
{
"type": "integer"
},
{
"type": "string"
}
],
"title": "End Exclusive"
},
"filters": {
"$ref": "#/$defs/ScanFiltersInput"
}
},
"required": [
"kind",
"start",
"end_exclusive"
],
"title": "RangeScopeInput",
"type": "object"
},
"ScanFiltersInput": {
"additionalProperties": false,
"properties": {
"memory_types": {
"anyOf": [
{
"items": {
"enum": [
"image",
"mapped",
"private"
],
"type": "string"
},
"maxItems": 3,
"minItems": 1,
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Memory Types"
},
"executable": {
"default": "any",
"enum": [
"any",
"required",
"forbidden"
],
"title": "Executable",
"type": "string"
},
"writable": {
"default": "any",
"enum": [
"any",
"required",
"forbidden"
],
"title": "Writable",
"type": "string"
},
"sections": {
"anyOf": [
{
"items": {
"minLength": 1,
"type": "string"
},
"maxItems": 64,
"minItems": 1,
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Sections"
}
},
"title": "ScanFiltersInput",
"type": "object"
}
},
"additionalProperties": false,
"description": "Bounded first-hit or count batch over one shared scan traversal.",
"properties": {
"patterns": {
"items": {
"$ref": "#/$defs/NamedPatternInput"
},
"maxItems": 32,
"minItems": 1,
"title": "Patterns",
"type": "array"
},
"scope": {
"anyOf": [
{
"discriminator": {
"mapping": {
"all_modules": "#/$defs/AllModulesScopeInput",
"modules": "#/$defs/ModulesScopeInput",
"range": "#/$defs/RangeScopeInput"
},
"propertyName": "kind"
},
"oneOf": [
{
"$ref": "#/$defs/AllModulesScopeInput"
},
{
"$ref": "#/$defs/ModulesScopeInput"
},
{
"$ref": "#/$defs/RangeScopeInput"
}
]
},
{
"type": "null"
}
],
"default": null,
"title": "Scope"
},
"mode": {
"default": "first",
"enum": [
"first",
"count"
],
"title": "Mode",
"type": "string"
},
"max_matches": {
"anyOf": [
{
"maximum": 100000,
"minimum": 1,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Max Matches"
},
"timeout_ms": {
"default": 30000,
"maximum": 30000,
"minimum": 100,
"title": "Timeout Ms",
"type": "integer"
},
"diagnostics": {
"default": false,
"title": "Diagnostics",
"type": "boolean"
}
},
"required": [
"patterns"
],
"title": "ScanManyInput",
"type": "object"
}
{
"$defs": {
"CountScanManyItem": {
"additionalProperties": false,
"properties": {
"key": {
"minLength": 1,
"title": "Key",
"type": "string"
},
"count": {
"anyOf": [
{
"maximum": 100000,
"minimum": 1,
"type": "integer"
},
{
"const": 0,
"type": "integer"
}
],
"title": "Count"
},
"observation": {
"enum": [
"complete_traversal",
"partial_traversal"
],
"title": "Observation",
"type": "string"
},
"status": {
"$ref": "#/$defs/ScanStatus"
}
},
"required": [
"key",
"count",
"observation",
"status"
],
"title": "CountScanManyItem",
"type": "object"
},
"CountScanManySuccess": {
"additionalProperties": false,
"properties": {
"success": {
"const": true,
"title": "Success",
"type": "boolean"
},
"mode": {
"const": "count",
"title": "Mode",
"type": "string"
},
"results": {
"items": {
"$ref": "#/$defs/CountScanManyItem"
},
"maxItems": 32,
"minItems": 1,
"title": "Results",
"type": "array"
},
"shared": {
"$ref": "#/$defs/ScanManyShared"
}
},
"required": [
"success",
"mode",
"results",
"shared"
],
"title": "CountScanManySuccess",
"type": "object"
},
"FirstScanManyItem": {
"additionalProperties": false,
"properties": {
"key": {
"minLength": 1,
"title": "Key",
"type": "string"
},
"match": {
"anyOf": [
{
"$ref": "#/$defs/ScanHit"
},
{
"type": "null"
}
]
},
"status": {
"$ref": "#/$defs/ScanStatus"
}
},
"required": [
"key",
"match",
"status"
],
"title": "FirstScanManyItem",
"type": "object"
},
"FirstScanManySuccess": {
"additionalProperties": false,
"properties": {
"success": {
"const": true,
"title": "Success",
"type": "boolean"
},
"mode": {
"const": "first",
"title": "Mode",
"type": "string"
},
"results": {
"items": {
"$ref": "#/$defs/FirstScanManyItem"
},
"maxItems": 32,
"minItems": 1,
"title": "Results",
"type": "array"
},
"shared": {
"$ref": "#/$defs/ScanManyShared"
}
},
"required": [
"success",
"mode",
"results",
"shared"
],
"title": "FirstScanManySuccess",
"type": "object"
},
"ScanDiagnostics": {
"additionalProperties": false,
"properties": {
"duration_ms": {
"minimum": 0,
"title": "Duration Ms",
"type": "number"
},
"scope_fingerprint": {
"pattern": "^[0-9a-f]{64}$",
"title": "Scope Fingerprint",
"type": "string"
},
"sections": {
"items": {
"type": "string"
},
"maxItems": 64,
"title": "Sections",
"type": "array"
},
"strategy_counts": {
"additionalProperties": {
"minimum": 0,
"type": "integer"
},
"maxProperties": 4,
"propertyNames": {
"enum": [
"exact",
"all_wildcard",
"anchor",
"regex"
]
},
"title": "Strategy Counts",
"type": "object"
},
"unique_bytes_examined": {
"minimum": 0,
"title": "Unique Bytes Examined",
"type": "integer"
},
"physical_read_calls": {
"minimum": 0,
"title": "Physical Read Calls",
"type": "integer"
},
"physical_bytes_read": {
"minimum": 0,
"title": "Physical Bytes Read",
"type": "integer"
},
"physical_cursor_prefix_bytes": {
"minimum": 0,
"title": "Physical Cursor Prefix Bytes",
"type": "integer"
},
"region_count": {
"minimum": 0,
"title": "Region Count",
"type": "integer"
},
"span_count": {
"minimum": 0,
"title": "Span Count",
"type": "integer"
},
"candidate_count": {
"minimum": 0,
"title": "Candidate Count",
"type": "integer"
},
"verification_count": {
"minimum": 0,
"title": "Verification Count",
"type": "integer"
},
"control_polls": {
"minimum": 0,
"title": "Control Polls",
"type": "integer"
}
},
"required": [
"duration_ms",
"scope_fingerprint",
"sections",
"strategy_counts",
"unique_bytes_examined",
"physical_read_calls",
"physical_bytes_read",
"physical_cursor_prefix_bytes",
"region_count",
"span_count",
"candidate_count",
"verification_count",
"control_polls"
],
"title": "ScanDiagnostics",
"type": "object"
},
"ScanFailure": {
"additionalProperties": false,
"properties": {
"success": {
"const": false,
"default": false,
"title": "Success",
"type": "boolean"
},
"error": {
"enum": [
"INVALID_PATTERN",
"INVALID_SCOPE",
"INVALID_MODE",
"INVALID_ARGUMENT",
"MODULE_NOT_FOUND",
"AMBIGUOUS_MODULE",
"SECTION_NOT_FOUND",
"PROCESS_NOT_ATTACHED",
"INVALID_CURSOR",
"CURSOR_STALE",
"TARGET_CHANGED",
"INTERNAL_SCAN_ERROR"
],
"title": "Error",
"type": "string"
},
"detail": {
"maxLength": 1024,
"minLength": 1,
"title": "Detail",
"type": "string"
},
"field": {
"anyOf": [
{
"maxLength": 256,
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Field"
},
"hint": {
"anyOf": [
{
"maxLength": 512,
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Hint"
}
},
"required": [
"error",
"detail"
],
"title": "ScanFailure",
"type": "object"
},
"ScanHit": {
"additionalProperties": false,
"properties": {
"address": {
"pattern": "^0x(?:0|[1-9A-F][0-9A-F]*)$",
"title": "Address",
"type": "string"
},
"module": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "Module"
},
"module_offset": {
"anyOf": [
{
"pattern": "^0x(?:0|[1-9A-F][0-9A-F]*)$",
"type": "string"
},
{
"type": "null"
}
],
"title": "Module Offset"
}
},
"required": [
"address",
"module",
"module_offset"
],
"title": "ScanHit",
"type": "object"
},
"ScanManyShared": {
"additionalProperties": false,
"properties": {
"termination": {
"enum": [
"scope_exhausted",
"page_limit",
"match_limit",
"first_hit",
"timeout",
"cancelled",
"target_changed",
"reader_error"
],
"title": "Termination",
"type": "string"
},
"read_gaps_detected": {
"title": "Read Gaps Detected",
"type": "boolean"
},
"diagnostics": {
"anyOf": [
{
"$ref": "#/$defs/ScanDiagnostics"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
"termination",
"read_gaps_detected"
],
"title": "ScanManyShared",
"type": "object"
},
"ScanStatus": {
"additionalProperties": false,
"properties": {
"termination": {
"enum": [
"scope_exhausted",
"page_limit",
"match_limit",
"first_hit",
"timeout",
"cancelled",
"target_changed",
"reader_error"
],
"title": "Termination",
"type": "string"
},
"read_gaps_detected": {
"title": "Read Gaps Detected",
"type": "boolean"
}
},
"required": [
"termination",
"read_gaps_detected"
],
"title": "ScanStatus",
"type": "object"
}
},
"anyOf": [
{
"discriminator": {
"mapping": {
"count": "#/$defs/CountScanManySuccess",
"first": "#/$defs/FirstScanManySuccess"
},
"propertyName": "mode"
},
"oneOf": [
{
"$ref": "#/$defs/FirstScanManySuccess"
},
{
"$ref": "#/$defs/CountScanManySuccess"
}
]
},
{
"$ref": "#/$defs/ScanFailure"
}
],
"title": "ScanManyResponse",
"type": "object"
}

Execute Lua script for complex memory operations (loops, conditionals, multi-step). See server instructions for full list of available Lua functions. Args: script - Lua code. timeout - optional max seconds (default: 180 seconds). Returns: {success, results (dict), output (array of prints)}

{
"properties": {
"script": {
"title": "Script",
"type": "string"
},
"timeout": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Timeout"
}
},
"required": [
"script"
],
"title": "luaArguments",
"type": "object"
}

Lua script management. Scripts live under $MEMSCOPE_HOME/scripts/<process>/<name>.lua. Actions: list - Returns scripts with absolute paths. Use process='*' for all processes. run - Execute by name. Pass args={} for script arguments. timeout=seconds optional. process='ProcessName.exe' selects the saved-script namespace only; it does not attach or switch. Without an attachment, pass process for detached execution. When attached, process must match. Responses include requested_process, attached_process, attached_pid, and detached_execution. CREATE/EDIT: Use file tools on paths from 'list'. First line comment = description. Example: scripts(action='list') -> get scripts_dir, then Write to {scripts_dir}/<name>.lua

{
"properties": {
"action": {
"title": "Action",
"type": "string"
},
"name": {
"default": "",
"title": "Name",
"type": "string"
},
"process": {
"default": "",
"title": "Process",
"type": "string"
},
"args": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Args"
},
"timeout": {
"anyOf": [
{
"type": "number"
},
{
"type": "null"
}
],
"default": null,
"title": "Timeout"
}
},
"required": [
"action"
],
"title": "scriptsArguments",
"type": "object"
}