inspect_analysis_view is the recovery path when an analyze_function dossier exceeds the MCP response budget, but its native facets covered only procedure, pseudocode, assembly, callers/callees, references, and value flow. Basic blocks, comments, unresolved calls, referenced strings and names, and the native API record could not be read from retained Evidence at all; basic blocks grow with the function just like assembly. These are now facets: collections page by rows, and native_api is a singleton. A dossier without an unresolved_calls record reports "not recorded" rather than the value-flow failure reason. Refs #1247 and #1065. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
3.1 KiB
TypeScript
79 lines
3.1 KiB
TypeScript
import {
|
|
analysisViewResultSchema,
|
|
inspectAnalysisViewInputSchema,
|
|
} from "../domain/analysisView/analysisView.js";
|
|
import type { ToolContract } from "./toolContractTypes.js";
|
|
import { toolContractMetadata } from "./toolEffects.js";
|
|
import { evidenceResultOf } from "./toolOutputSchemaPrimitives.js";
|
|
|
|
const RETAINED_EXAMPLE_ID = `ev_${"a".repeat(64)}`;
|
|
|
|
/** Selected views of already completed layout, JavaScript and native function Evidence. */
|
|
export const ANALYSIS_VIEW_TOOL_CONTRACTS = [
|
|
{
|
|
name: "inspect_analysis_view",
|
|
...toolContractMetadata("inspect_analysis_view"),
|
|
kind: "application",
|
|
description:
|
|
"Inspect selected views of completed binary-layout, JavaScript application or native analyze_function Evidence without repeating analysis. Use an exact same-session retained evidence_id or portable inline Evidence. Select a summary, layout mitigations/linkage facet, one section/symbol/module, or a stable page. Module pages include assets, bundled and source modules; use node_id for ambiguous or unavailable paths. Native views select procedure, pseudocode, assembly, basic blocks, comments, callers/callees, references, unresolved calls, referenced strings/names, native API and high-pcode. Use nonnegative offset and a positive caller-selected limit (defaults 0 and 64); pseudocode uses UTF-16 code units, other native pages use rows. Returns artifact identity, parent Evidence ID, a distinct view digest, coverage, limitations and unknowns. Actual serialized size determines MCP transport admission; choose a smaller page or export the complete retained Evidence if needed.",
|
|
inputSchema: inspectAnalysisViewInputSchema,
|
|
outputSchema: evidenceResultOf(analysisViewResultSchema),
|
|
examples: [
|
|
{
|
|
title: "Summarize retained JavaScript application Evidence",
|
|
input: {
|
|
source: {
|
|
kind: "retained-evidence",
|
|
evidence_id: RETAINED_EXAMPLE_ID,
|
|
},
|
|
view: { kind: "summary" },
|
|
},
|
|
},
|
|
{
|
|
title: "Read one ELF section from retained layout Evidence",
|
|
input: {
|
|
source: {
|
|
kind: "retained-evidence",
|
|
evidence_id: RETAINED_EXAMPLE_ID,
|
|
},
|
|
view: {
|
|
kind: "item",
|
|
collection: "sections",
|
|
selector: { name: ".text" },
|
|
},
|
|
},
|
|
},
|
|
{
|
|
title: "Page native high-pcode operations from retained Evidence",
|
|
input: {
|
|
source: {
|
|
kind: "retained-evidence",
|
|
evidence_id: RETAINED_EXAMPLE_ID,
|
|
},
|
|
view: {
|
|
kind: "native",
|
|
facet: "value_flow_operations",
|
|
offset: 0,
|
|
limit: 32,
|
|
},
|
|
},
|
|
},
|
|
{
|
|
title: "Page module identities from retained application Evidence",
|
|
input: {
|
|
source: {
|
|
kind: "retained-evidence",
|
|
evidence_id: RETAINED_EXAMPLE_ID,
|
|
},
|
|
view: {
|
|
kind: "page",
|
|
collection: "modules",
|
|
offset: 0,
|
|
limit: 32,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
] as const satisfies readonly ToolContract[];
|