Skip to main content
Glama

MCPMan

by semistrict
macro-compile-validation.test.ts2.65 kB
import { test, expect, describe } from "./test-fixtures.js"; import { TRACE } from "../src/utils/logging.js"; describe("Macro Compile-Time Validation", () => { test("should fail to compile macro that uses non-existent tool", async ({ client }) => { const result = await client.callTool({ name: "list_macros", arguments: {}, }); const content = result.content as Array<{ type: string; text: string }>; const data = JSON.parse(content[0]?.text || "{}"); TRACE`Full list_macros response: ${JSON.stringify(data, null, 2)}`; // Should have an errors array expect(data.errors).toBeDefined(); expect(Array.isArray(data.errors)).toBe(true); TRACE`Errors array: ${JSON.stringify(data.errors, null, 2)}`; // Should have an error for nonexistent-tool.ts const nonExistentToolError = data.errors.find((e: any) => e.name === "nonexistentTool"); TRACE`nonExistentToolError: ${JSON.stringify(nonExistentToolError, null, 2)}`; expect(nonExistentToolError).toBeDefined(); expect(nonExistentToolError.error).toBeDefined(); // Error should mention TypeScript validation failure const errorMsg = nonExistentToolError.error.toLowerCase(); TRACE`Error message: ${errorMsg}`; expect(errorMsg).toContain("typescript validation failed"); expect(errorMsg).toContain("nonexistenttool"); expect(errorMsg).toContain("does not exist"); }); test("macro with non-existent tool should not appear in valid macros list", async ({ client }) => { const result = await client.callTool({ name: "list_macros", arguments: {}, }); const content = result.content as Array<{ type: string; text: string }>; const data = JSON.parse(content[0]?.text || "{}"); const macroNames = data.macros.map((m: { name: string }) => m.name); // nonexistentTool should NOT be in the valid macros list expect(macroNames).not.toContain("nonexistentTool"); }); test("should fail to invoke macro that uses non-existent tool", async ({ client }) => { // Try to invoke the macro (should fail because it didn't load) const result = await client.callTool({ name: "invoke", arguments: { calls: [ { server: "macros", tool: "nonexistentTool", parameters: { path: "/tmp/test" }, }, ], }, }); const content = result.content as Array<{ type: string; text: string }>; const text = content[0]?.text || ""; TRACE`Invoke result: ${text}`; // Should error because macro didn't load expect(text.toLowerCase()).toContain("cannot execute macro"); }); });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/semistrict/mcpman'

If you have feedback or need assistance with the MCP directory API, please join our Discord server