test(server): share tool catalog message fixtures (#16492)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-04 06:23:54 +08:00
1 parent fe29cab95a
commit 5bf3586b8a
1 file changed
+11 -30
+11 -30
View File
@@ -167,45 +167,26 @@ describe("suggestAdvertisedTools", () => {
});
describe("formatUnknownMcpToolMessage", () => {
const message = (name: string, discoveryAvailable: boolean) =>
formatUnknownMcpToolMessage(name, {
tools: SAMPLE_CATALOG,
discoveryAvailable,
});
it("formats full-catalog and progressive-catalog messages for zero, one, and multiple matches", () => {
expect(
formatUnknownMcpToolMessage("zzzzzz", {
tools: SAMPLE_CATALOG,
discoveryAvailable: false,
}),
).toBe(
expect(message("zzzzzz", false)).toBe(
"The requested MCP tool is not advertised by this REA server. Call tools/list, select an advertised tool, and retry; do not repeat the unknown tool name.",
);
expect(
formatUnknownMcpToolMessage("open-binary", {
tools: SAMPLE_CATALOG,
discoveryAvailable: false,
}),
).toBe(
expect(message("open-binary", false)).toBe(
"The requested MCP tool is not advertised by this REA server. Closest advertised tool: open_binary. Select an advertised tool or call tools/list, and retry; do not repeat the unknown tool name.",
);
expect(
formatUnknownMcpToolMessage("decompile", {
tools: SAMPLE_CATALOG,
discoveryAvailable: false,
}),
).toBe(
expect(message("decompile", false)).toBe(
"The requested MCP tool is not advertised by this REA server. Closest advertised tools: batch_decompile, decompile_all, procedure_pseudo_code, import_managed_reconstruction. Select an advertised tool or call tools/list, and retry; do not repeat the unknown tool name.",
);
expect(
formatUnknownMcpToolMessage("zzzzzz", {
tools: SAMPLE_CATALOG,
discoveryAvailable: true,
}),
).toBe(
expect(message("zzzzzz", true)).toBe(
"The requested MCP tool is not advertised by this REA server. Call discover_tools to find and load an in-scope tool, then retry; do not repeat the unknown tool name.",
);
expect(
formatUnknownMcpToolMessage("open-binary", {
tools: SAMPLE_CATALOG,
discoveryAvailable: true,
}),
).toBe(
expect(message("open-binary", true)).toBe(
"The requested MCP tool is not advertised by this REA server. Closest advertised tool: open_binary. Select an advertised tool or call discover_tools to find and load other in-scope tools, then retry; do not repeat the unknown tool name.",
);
});