Skip to main content
Glama
coordination.test.ts3.35 kB
import { describe, it, expect } from "vitest"; import { suggestToolChainHandler, projectProfilerHandler, } from "./coordination.js"; describe("Coordination Tools", () => { describe("suggestToolChainHandler", () => { it("should suggest refactoring tools", () => { const result = suggestToolChainHandler({ goal: "I want to refactor the auth system", }); expect(result.content[0].text).toContain( "Recommended Tool Chain: Refactoring Workflow", ); expect(result.content[0].text).toContain("derive_patterns"); expect(result.content[0].text).toContain("plan_task"); }); it("should handle new project requests", () => { const result = suggestToolChainHandler({ goal: "Create a new feature", // "create" triggers intent }); // "Create a new feature" currently falls into "New Project Workflow" (due to "create" or "new") OR dynamic fallback. // My regex was /create|new|start|scaffold/. So "Create" triggers it. // Wait, "Create a new feature" hits "New Project Workflow" if I'm not careful. // Actually my code checks "includesStart" which is triggered by "Create". // But typically feature creation is different from project creation. // In my updated code: includesStart = /create|new|start|scaffold/. // Then "New Project Workflow" is triggered. expect(result.content[0].text).toContain("New Project Workflow"); expect(result.content[0].text).toContain("act_as_architect"); }); it("should suggest generic tools for unknown goal", () => { const result = suggestToolChainHandler({ goal: "Do something random", }); expect(result.content[0].text).toContain("Dynamic Workflow"); expect(result.content[0].text).toContain("sequential_thinking"); }); it("should suggest python tools based on context", () => { const result = suggestToolChainHandler({ goal: "Analyze this script", context: "It is a python data script", }); // The new logic prioritizes the comprehensive dynamic workflow which includes verification expect(result.content[0].text).toContain("reflect_on_code"); }); }); describe("projectProfilerHandler", () => { it("should suggest quick wins when items missing", () => { const result = projectProfilerHandler({ files: ["src/index.ts"], hasTests: false, hasDocs: false, hasCI: false, }); expect(result.content[0].text).toContain( "**Missing Critical Areas**: Documentation, Tests, CI/CD", ); expect(result.content[0].text).toContain("generate_readme"); expect(result.content[0].text).toContain("generate_dockerfile"); expect(result.content[0].text).toContain("GEMINI.md"); }); it("should praise complete project", () => { const result = projectProfilerHandler({ files: [ "src/index.ts", "Dockerfile", ".env.example", "GEMINI.md", ".cursorrules", ], hasTests: true, hasDocs: true, hasCI: true, }); expect(result.content[0].text).toContain("None! 🎉"); // New logic suggests improvements even for empty projects expect(result.content[0].text).toContain("Quick Wins"); }); }); });

Latest Blog Posts

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/millsydotdev/Code-MCP'

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