test(linux): verify setup through CLI and MCP
This commit is contained in:
@@ -3,6 +3,8 @@ import { z } from "zod";
|
||||
|
||||
import type { ToolContract } from "../src/contracts/toolContracts.js";
|
||||
import { ok } from "../src/domain/result.js";
|
||||
import { err } from "../src/domain/result.js";
|
||||
import { HopperProcessError } from "../src/domain/errors.js";
|
||||
import { toCallToolResult } from "../src/server/toolResult.js";
|
||||
|
||||
const contract: ToolContract = {
|
||||
@@ -21,6 +23,16 @@ const contract: ToolContract = {
|
||||
};
|
||||
|
||||
describe("tool result projection", () => {
|
||||
it("exposes an actionable adapter code to MCP callers", () => {
|
||||
const result = toCallToolResult(err(new HopperProcessError(76)), contract);
|
||||
expect(result.structuredContent).toMatchObject({
|
||||
error: {
|
||||
code: "unsupported_demo_dialog",
|
||||
category: "execution_failure",
|
||||
},
|
||||
});
|
||||
expect(JSON.stringify(result)).not.toContain("expected Hopper");
|
||||
});
|
||||
it("classifies output contract failures without naming a provider", () => {
|
||||
expect(toCallToolResult(ok({ value: 42 }), contract)).toEqual({
|
||||
content: [
|
||||
|
||||
Reference in New Issue
Block a user