feat(mcp): return structured typed tool results
This commit is contained in:
@@ -252,6 +252,17 @@ describe("full MCP integration with multi-tool sequences", () => {
|
||||
},
|
||||
});
|
||||
expect(unavailable.isError).toBe(true);
|
||||
expect(structured(unavailable)).toMatchObject({
|
||||
error: {
|
||||
tag: "AnalysisCapabilityUnavailableError",
|
||||
category: "unsupported_provider",
|
||||
details: {
|
||||
providerId: "partial",
|
||||
operation: "procedure_pseudo_code",
|
||||
reason: "Decompiler is not installed.",
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(received[0]).not.toHaveProperty("unknown_registry_approved");
|
||||
expect(
|
||||
structured(
|
||||
@@ -354,7 +365,7 @@ describe("full MCP integration with multi-tool sequences", () => {
|
||||
expect(names).not.toContain("open_binary");
|
||||
});
|
||||
|
||||
it("propagates remote Hopper errors with structured content", async () => {
|
||||
it("projects remote failures without provider or bridge details", async () => {
|
||||
const client = await connect({
|
||||
execute: () =>
|
||||
Promise.resolve(err(new HopperRemoteError(-32000, "bridge timeout"))),
|
||||
@@ -365,8 +376,20 @@ describe("full MCP integration with multi-tool sequences", () => {
|
||||
arguments: {},
|
||||
});
|
||||
expect(result.isError).toBe(true);
|
||||
expect(text(result)).toContain("HopperRemoteError");
|
||||
expect(text(result)).toContain("bridge timeout");
|
||||
expect(structured(result)).toMatchObject({
|
||||
error: {
|
||||
tag: "HopperRemoteError",
|
||||
category: "execution_failure",
|
||||
details: {
|
||||
code: -32000,
|
||||
safeMessage: "bridge timeout",
|
||||
diagnosticType: "remote",
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(text(result)).toBe(
|
||||
"Analysis could not complete. Retry once; if it continues, run `rea doctor`.",
|
||||
);
|
||||
});
|
||||
|
||||
it("handles concurrent tool calls without corruption", async () => {
|
||||
|
||||
Reference in New Issue
Block a user