mcp_server.tools
mcp_server.tools is a deprecated import path for the functions below.
Use memdiver.app.tools or the public memdiver.services interface in new code.
Scan datasets, run analysis, and import dumps for a tool session.
- scan_dataset(session, root, keylog_filename='keylog.csv', protocols=None)[source]
Scan a dataset directory for protocols, libraries, and lifecycle phases.
The result includes the number of runs with a packet capture and the capture counts by version, scenario, and library. Raise
FileNotFoundServiceErrorif the root is missing.
- list_protocols(session)[source]
List all registered protocol descriptors.
- Parameters:
session (ToolSession)
- Return type:
- set_region_filter(session, region_filter=None)[source]
Set (or clear) the session’s analysis-time region view filter.
region_filteris a category list ("heap,stack"), a persisted note ("regions=...") or"all"/None/"", which clear it. Tools that takeregion_filterfall back to this value when the caller omits theirs. Returns the normalisedto_note()form. An unknown category name raises an INVALID_INPUTCapabilityErrorand leaves the filter unchanged.
- get_region_filter(session)[source]
Return the session’s region view filter (
None= every region).- Parameters:
session (ToolSession)
- Return type:
- analyze_library(session, library_dirs, phase, protocol_version, keylog_filename='keylog.csv', template_name='Auto-detect', max_runs=10, normalize=False, expand_keys=True, algorithms=None, *, force=False)[source]
Run the full analysis pipeline on library directories.
forcebypasses the consensus memory-budget guard.
- import_dump(session, raw_path, output_path, pid=0, selection=None, materialize=False, exclude=None, key_material=None, decrypt_output=False, key_file=None, passphrase=None, kem_key_file=None, maps_path=None)[source]
Import a dump (raw .dump, ELF core, or minidump) to .msl format.
Delegates to
msl.importer.import_dump(), which sniffs the source format and dispatches to the raw, ELF-core, or minidump importer. Plain raw .dump imports remain a byte-for-byte no-op regression.selection restricts the import to some region categories: a
RegionSelectionor a spec string such as"heap,stack"/"all"; exclude (e.g."image") drops categories.Nonefor both imports everything. For.mslinput the copy stays verbatim unless materialize is True. Selection outcome fields (selection,excluded_region_count,excluded_bytes,secrets_only_in_excluded,warnings) appear only when relevant.key_material (
core.key_materialdict, request-scoped, never cached or logged) opens an encrypted.msl; a materialized copy is re-encrypted under the same key wrapping unless decrypt_output asks for plaintext. key_file / passphrase / kem_key_file (file-path idiom, MCP) are an alternative to key_material. A missing or wrong key on a materialize raisesCapabilityError(PRECONDITION) and writes nothing.maps_path names a
/proc/<pid>/maps-style memory map that splits a raw dump into real regions (default: auto-detect a.mapssidecar next to the dump). Formats with their own layout ignore it (warning).- Parameters:
- Return type:
- preview_import(session, path, selection=None, exclude=None, key_material=None, key_file=None, passphrase=None, kem_key_file=None, maps_path=None)[source]
Metadata-only preview of the regions an import of path would emit.
Returns
ImportPreview.to_dict()—format,is_msl, per-regionregions(withcategory), per-categorytotalsand asummaryof what selection / exclude would keep and drop. Reads no region payloads and writes nothing. Key material (dict or the file-path params) opens an encrypted.mslso its regions are listed; the result carriesencrypted/decrypted.layoutsays where the regions came from (native/maps/none); maps_path is the memory map of a raw dump, as forimport_dump().
- import_raw_dump(session, raw_path, output_path, pid=0, selection=None, materialize=False, exclude=None, key_file=None, passphrase=None, kem_key_file=None, decrypt_output=False, maps_path=None)[source]
Back-compat alias for
import_dump().Retained so existing callers keep working; new code should call
import_dump(), which routes through the unified dispatcher.