feat(mcp): return structured typed tool results
This commit is contained in:
+16
-10
@@ -312,7 +312,9 @@ describe("enhanced MCP tools", () => {
|
||||
status: "error",
|
||||
error: {
|
||||
tag: "AnalysisOutputError",
|
||||
message: "Invalid analysis output for decompile: failed",
|
||||
category: "execution_failure",
|
||||
message:
|
||||
"Analysis returned an unreadable result. Retry once; if it continues, run `rea doctor`.",
|
||||
details: { operation: "decompile", reason: "failed" },
|
||||
},
|
||||
},
|
||||
@@ -352,7 +354,11 @@ describe("enhanced MCP tools", () => {
|
||||
{
|
||||
address: "0x1",
|
||||
status: "error",
|
||||
error: { tag: "AnalysisOutputError" },
|
||||
error: {
|
||||
category: "execution_failure",
|
||||
message:
|
||||
"Analysis returned an unreadable result. Retry once; if it continues, run `rea doctor`.",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -551,8 +557,8 @@ describe("enhanced MCP tools", () => {
|
||||
});
|
||||
expect(result.isError).toBe(true);
|
||||
const text = result.content.find((item) => item.type === "text");
|
||||
expect(text?.type === "text" ? text.text : "").toContain(
|
||||
"non-advancing pagination offset",
|
||||
expect(text?.type === "text" ? text.text : "").toBe(
|
||||
"Analysis returned an unreadable result. Retry once; if it continues, run `rea doctor`.",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -598,8 +604,8 @@ describe("enhanced MCP tools", () => {
|
||||
});
|
||||
expect(result.isError).toBe(true);
|
||||
const text = result.content.find((item) => item.type === "text");
|
||||
expect(text?.type === "text" ? text.text : "").toContain(
|
||||
"HopperProtocolError",
|
||||
expect(text?.type === "text" ? text.text : "").toBe(
|
||||
"Analysis returned an unreadable result. Retry once; if it continues, run `rea doctor`.",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -619,8 +625,8 @@ describe("enhanced MCP tools", () => {
|
||||
});
|
||||
expect(result.isError).toBe(true);
|
||||
const text = result.content.find((item) => item.type === "text");
|
||||
expect(text?.type === "text" ? text.text : "").toContain(
|
||||
"AnalysisOutputError",
|
||||
expect(text?.type === "text" ? text.text : "").toBe(
|
||||
"Analysis returned an unreadable result. Retry once; if it continues, run `rea doctor`.",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -655,8 +661,8 @@ describe("enhanced MCP tools", () => {
|
||||
});
|
||||
expect(result.isError).toBe(true);
|
||||
const text = result.content.find((item) => item.type === "text");
|
||||
expect(text?.type === "text" ? text.text : "").toContain(
|
||||
"AnalysisOutputError",
|
||||
expect(text?.type === "text" ? text.text : "").toBe(
|
||||
"Analysis returned an unreadable result. Retry once; if it continues, run `rea doctor`.",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user