import assert from "node:assert/strict"; import { validatePluginManifest } from "../dist/index.js"; const base = { ideaPluginManifestVersion: 1, id: "dev.example.tools", displayName: "Tools", version: "1.0.0", main: "dist/index.js", trustLevel: "full", capabilities: ["mcp"], contributes: { mcpServers: [ { id: "server", displayName: "Server", command: "bin/server", transport: "stdio" } ] } }; assert.equal(validatePluginManifest(base).success, true, "tools metadata remains optional"); const withTools = structuredClone(base); withTools.contributes.mcpServers[0].tools = [ { name: "read_scene", description: "Read the active scene." }, { name: "run_tests" } ]; assert.equal(validatePluginManifest(withTools).success, true, "valid tools metadata is accepted"); const duplicate = structuredClone(withTools); duplicate.contributes.mcpServers[0].tools.push({ name: "read_scene" }); const duplicateResult = validatePluginManifest(duplicate); assert.equal(duplicateResult.success, false, "duplicate tool metadata is rejected"); assert.ok(duplicateResult.errors.some((error) => error.includes("must be unique")));