Skip to main content
Glama
role-mismatch-validator.js708 B
import { ROLE_HEURISTICS } from "./role-heuristics.js"; export function validateRoleMismatch(role, content) { const rules = ROLE_HEURISTICS[role]; if (!rules) return; const violations = []; for (const imp of rules.forbiddenImports || []) { if (content.includes(`from "${imp}"`) || content.includes(`require("${imp}")`)) { violations.push(`forbidden import: ${imp}`); } } for (const keyword of rules.forbiddenKeywords || []) { if (content.includes(keyword)) { violations.push(`forbidden pattern: ${keyword}`); } } if (violations.length > 0) { throw new Error( `ROLE_MISMATCH: ${role} violates constraints:\n- ${violations.join("\n- ")}` ); } }

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/dylanmarriner/MCP-server'

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