Skip to main content
Glama
loader.ts1.11 kB
/** * WP Navigator Roles Loader * * Loads role files from the roles/ directory. * * @package WP_Navigator_MCP * @since 1.2.0 */ import * as fs from 'fs'; import * as path from 'path'; import type { Role, ParsedRole } from './types.js'; /** * Load a role from file */ export async function loadRole(filePath: string): Promise<ParsedRole> { const content = fs.readFileSync(filePath, 'utf8'); // Placeholder - actual implementation in Phase B3 const roleName = path.basename(filePath, path.extname(filePath)); return { role: { name: roleName, description: '', context: '', }, source: filePath, errors: [], }; } /** * Load all roles from a directory */ export async function loadRoles(directory: string): Promise<ParsedRole[]> { if (!fs.existsSync(directory)) { return []; } const files = fs.readdirSync(directory).filter((f) => f.endsWith('.yaml') || f.endsWith('.yml')); const roles: ParsedRole[] = []; for (const file of files) { const role = await loadRole(path.join(directory, file)); roles.push(role); } return roles; }

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/littlebearapps/wp-navigator-mcp'

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