fix(contracts): mark foreign execution and device mutation destructive (#1904)

MCP annotations derived destructiveHint only from mayDiscardData, so tools
that run the analysis target or a caller-selected executable
(capture_process_scenario, observe_native_calls) and tools that change an
attached Android device (install/uninstall/push/start/stop) advertised
destructiveHint: false.

Add explicit executesForeignCode and mutatesDevice effect flags, audit them
across all 170 tool effect records, and derive
destructiveHint = mayDiscardData || executesForeignCode || mutatesDevice.
readOnlyHint semantics are unchanged.

Hopper/Ghidra metadata writers (set_address_name, set_addresses_names,
set_bookmark, set_comment, set_inline_comment, annotate_native_function)
can replace or clear existing analyst names and comments, so they now
declare mayDiscardData as well.

A contract test pins the destructive set and requires every tool whose
description mentions running, launching, executing, starting, installing or
uninstalling to declare one of the new flags or carry a reasoned exception,
so wording and effects cannot silently drift. The binary_session effects
output schema carries the new flags.
This commit is contained in:
Lluís Ariño
2026-10-12 01:09:01 +08:00
committed by GitHub
parent 7a0140b4aa
commit 0b7fc40eee
6 changed files with 239 additions and 9 deletions
+2
View File
@@ -50,6 +50,8 @@ const contract: ToolContract = {
accessesNetwork: false,
changesUiState: false,
mayDiscardData: false,
executesForeignCode: false,
mutatesDevice: false,
idempotent: true,
},
annotations: {
+15 -1
View File
@@ -73,7 +73,7 @@ function expectKnownAuthorityHints(tools: readonly ToolSchemas[]): void {
},
annotate_native_function: {
readOnlyHint: false,
destructiveHint: false,
destructiveHint: true,
idempotentHint: true,
openWorldHint: true,
},
@@ -102,8 +102,22 @@ function expectKnownAuthorityHints(tools: readonly ToolSchemas[]): void {
openWorldHint: false,
},
capture_process_scenario: {
readOnlyHint: false,
destructiveHint: true,
openWorldHint: true,
},
observe_native_calls: {
readOnlyHint: false,
destructiveHint: true,
},
uninstall_adb_package: {
readOnlyHint: false,
destructiveHint: true,
},
start_adb_app: {
readOnlyHint: false,
destructiveHint: true,
},
export_evidence_bundle: {
readOnlyHint: false,
destructiveHint: true,