refactor(mcp): simplify workflow and observation scope
This commit is contained in:
@@ -96,11 +96,11 @@ it("exposes root-confined Electron discovery and inspection as Evidence", async
|
||||
targets: [{ target_id: "electron-page" }],
|
||||
},
|
||||
});
|
||||
const discoveryEvidenceId = evidenceIdFrom(listed.structuredContent);
|
||||
const inspected = await client.callTool({
|
||||
name: "inspect_electron_page",
|
||||
arguments: {
|
||||
cdp_endpoint: browser.endpoint,
|
||||
allowed_file_roots: [root],
|
||||
discovery_evidence_id: discoveryEvidenceId,
|
||||
target_id: "electron-page",
|
||||
observation_ms: 0,
|
||||
include_script_sources: true,
|
||||
@@ -369,3 +369,12 @@ const evidenceFor = (session: BinarySession, value: unknown) => {
|
||||
if (evidence === undefined) throw new TypeError("Missing session Evidence");
|
||||
return evidence;
|
||||
};
|
||||
|
||||
const evidenceIdFrom = (value: unknown): string => {
|
||||
if (typeof value !== "object" || value === null)
|
||||
throw new TypeError("Missing structured result");
|
||||
const evidenceId = Reflect.get(value, "evidence_id");
|
||||
if (typeof evidenceId !== "string")
|
||||
throw new TypeError("Missing Evidence ID");
|
||||
return evidenceId;
|
||||
};
|
||||
|
||||
@@ -81,13 +81,12 @@ describe("JavaScript runtime observation MCP tools", () => {
|
||||
targets: [{ target_id: inspector.targetId }],
|
||||
},
|
||||
});
|
||||
const discoveryEvidenceId = evidenceIdFrom(listed.structuredContent);
|
||||
|
||||
const observedRuntime = await client.callTool({
|
||||
name: "observe_javascript_runtime",
|
||||
arguments: {
|
||||
inspector_endpoint: inspector.endpoint,
|
||||
allowed_file_roots: [root],
|
||||
allowed_origins: [],
|
||||
discovery_evidence_id: discoveryEvidenceId,
|
||||
target_id: inspector.targetId,
|
||||
runtime_kind: "node",
|
||||
observation_ms: 10,
|
||||
|
||||
@@ -49,7 +49,10 @@ it("advertises the native function discovery-to-dossier workflow", async () => {
|
||||
});
|
||||
|
||||
expect(client.getInstructions()).toContain(
|
||||
"call binary_overview for target metadata and inventory counts, then search_procedures or list_procedures to choose a function",
|
||||
"use search_procedures or list_procedures to choose a function",
|
||||
);
|
||||
expect(client.getInstructions()).toContain(
|
||||
"Call binary_overview when target metadata or inventory counts are useful",
|
||||
);
|
||||
|
||||
const tools = new Map(
|
||||
|
||||
Reference in New Issue
Block a user