Skip to main content
Glama
world-manager.ts810 B
import { GeneratedWorld } from '../../engine/worldgen/index.js'; export class WorldManager { private worlds: Map<string, GeneratedWorld> = new Map(); create(id: string, world: GeneratedWorld): void { if (this.worlds.has(id)) { throw new Error(`World ${id} already exists`); } this.worlds.set(id, world); } get(id: string): GeneratedWorld | null { return this.worlds.get(id) || null; } delete(id: string): boolean { return this.worlds.delete(id); } list(): string[] { return Array.from(this.worlds.keys()); } } // Singleton for server lifetime let instance: WorldManager | null = null; export function getWorldManager(): WorldManager { if (!instance) instance = new WorldManager(); return instance; }

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/Mnehmos/rpg-mcp'

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