fix(mcp): require absolute JavaScript application inputs

This commit is contained in:
morluto
2026-10-24 04:03:06 +08:00
parent 59f0eb4244
commit 4e7fb1ee8a
2 changed files with 15 additions and 2 deletions
@@ -1,4 +1,5 @@
import { z } from "zod";
import { absoluteLocalPathStringSchema } from "../../domain/localPath.js";
import type { ToolContract } from "../toolContractTypes.js";
import { toolContractMetadata } from "../toolEffects.js";
import { electronFuseOutputSchemas } from "../toolOutputSchemaGroups.js";
@@ -35,13 +36,19 @@ import { JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE } from "./javascriptRuntimeRe
const listOutputSchema = evidenceResultOf(electronTargetListSchema);
const inspectionOutputSchema = evidenceResultOf(electronPageInspectionSchema);
const javascriptApplicationMcpInputSchema =
analyzeJavaScriptApplicationInputSchema.extend({
input_path: absoluteLocalPathStringSchema.describe(
"Absolute path to the JavaScript application on the machine running REA.",
),
});
/** Caller-selected delivery of a completed JavaScript application analysis. */
export const analyzeJavaScriptApplicationRequestSchema = z
.discriminatedUnion("detail", [
analyzeJavaScriptApplicationInputSchema.extend(
javascriptApplicationMcpInputSchema.extend(
javaScriptRoutesCompleteDeliveryShape,
),
analyzeJavaScriptApplicationInputSchema.extend(
javascriptApplicationMcpInputSchema.extend(
javaScriptRoutesSummaryDeliveryShape,
),
])
@@ -106,6 +106,12 @@ const inputCases = (
return [
pathCase("open_binary", "path", { path: absolute }, { path: relative }),
pathCase(
"analyze_javascript_application",
"input_path",
{ input_path: absolute, detail: "complete" },
{ input_path: relative, detail: "complete" },
),
pathCase(
"open_binary",
"snapshot_path",