mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
test(server): share tool catalog message fixtures (#16492)
This commit is contained in:
1 parent
fe29cab95a
commit
5bf3586b8a
1 file changed
+11
-30
@@ -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.",
|
||||
);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user