Files
rea/tests/support/mcp/artifactSession.ts
morluto 11d38cbc00 test(mcp): verify retained Interface Builder limits
Verify retained hierarchy limits and summary identity through the production artifact-only composition and real MCP SDK, alongside compiled CLI controls. Deep-provider selection is a separate lane.

Co-authored-by: Aliciawque <166712943+Aliciawque@users.noreply.github.com>
2026-10-14 15:20:09 +08:00

26 lines
965 B
TypeScript

import type { Client } from "@modelcontextprotocol/client";
import { expect, type OnTestFinishedHandler } from "vitest";
import { createArtifactBinarySession } from "../../../src/composition/binary.js";
import { createServer } from "../../../src/server/createServer.js";
import type { TestMcp } from "./mcpFixture.js";
/** Open a static artifact target in the production artifact-only MCP composition. */
export const openArtifactTarget = async (
mcp: TestMcp,
onTestFinished: (handler: OnTestFinishedHandler) => void,
path: string,
): Promise<Client> => {
const session = await createArtifactBinarySession(process.env);
onTestFinished(async () => {
await session.close();
});
const client = await mcp.connect(createServer({ kind: "session", session }));
const opened = await client.callTool({
name: "open_binary",
arguments: { path },
});
expect(opened.isError, JSON.stringify(opened.content)).not.toBe(true);
return client;
};