Files
morluto 8e18bdecef test(clients): check configured MCP catalogs in native harnesses (#15121)
* test(clients): check configured MCP catalogs in native harnesses

* test(opencode): resolve the native CLI in the isolated home

* ci(clients): identify native catalog discovery in the job log

* test(ci): isolate native clients and preserve registration failures
2026-11-29 18:03:55 +00:00

37 lines
1.2 KiB
JavaScript

import assert from "node:assert/strict";
import { contractsForToolFamilies } from "../../../dist/contracts/toolFamilies.js";
const scopedFamilies = ["electron", "javascript-runtime"];
/** Only setup receives the family selection. The native client must load it
* from its registration and forward exactly that catalog to the model. */
export function clientCatalogFixture(mode) {
const scoped = mode === "scoped-chat";
const all = contractsForToolFamilies(undefined);
const expected = scoped
? contractsForToolFamilies(new Set(scopedFamilies))
: all;
const assertNames = (names, prefix = "") => {
assert.deepEqual(
[...names].sort(),
expected.map(({ name }) => prefix + name).sort(),
"The native client must expose exactly the configured REA catalog",
);
};
return {
setupArguments: scoped ? ["--tool-families", scopedFamilies.join(",")] : [],
assertNames,
check(tools, prefix) {
const known = new Set(all.map(({ name }) => prefix + name));
const rea = tools.filter(({ name }) =>
prefix ? name.startsWith(prefix) : known.has(name),
);
assertNames(
rea.map(({ name }) => name),
prefix,
);
return rea;
},
};
}