Skip to main content
Glama
kokushin

exia-scenario-generator MCP Server

by kokushin

saveScenario

Save generated 'Kotonoha Sisters Explainer' style scenarios to the exia novel game engine for future use.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYes

Implementation Reference

  • Implements the saveScenario method in ExiaManager class, which saves the given Scenario object as JSON to exia's scenarios directory (S_000.json).
    async saveScenario(scenario: Scenario): Promise<void> { if (!this.isSetup && !(await this.checkSetup())) { throw new Error("exia is not set up"); } const scenarioPath = path.join(this.exiaPath, "renderer", "src", "scenarios", "S_000.json"); try { // ディレクトリが存在するか確認 const scenarioDir = path.dirname(scenarioPath); if (!fs.existsSync(scenarioDir)) { fs.mkdirSync(scenarioDir, { recursive: true }); } fs.writeFileSync(scenarioPath, JSON.stringify(scenario, null, 2)); console.error("Scenario saved to:", scenarioPath); } catch (error) { console.error("Error saving scenario:", error); throw new Error("Failed to save scenario"); } }
  • src/server.ts:87-118 (registration)
    Registers the MCP tool 'saveScenario' which takes a topic string input, generates a scenario using generateVoiceroidScenario and parseVoiceroidScenario, then calls exiaManager.saveScenario to save it, and returns success/error message.
    server.tool("saveScenario", { topic: z.string() }, async ({ topic }) => { try { // シナリオの生成 const rawScenario = await generateVoiceroidScenario({ topic, minLength: 2000 }); // シナリオのパースとexia形式への変換 const scenario = parseVoiceroidScenario(rawScenario); // シナリオの保存 await exiaManager.saveScenario(scenario); return { content: [ { type: "text", text: `「${topic}」についてのシナリオを保存しました。`, }, ], }; } catch (error) { console.error("Error saving scenario:", error); return { content: [ { type: "text", text: `シナリオの保存に失敗しました: ${error}`, }, ], isError: true, }; } });
  • TypeScript interface definition for 'Scenario' type, which is the input parameter for the saveScenario handler method. Defines the structure expected for the scenario JSON.
    export interface Scenario { id: string; backgroundFile: string; currentLineIndex: number; characters: Character[]; lines: Line[]; }

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/kokushin/exia-mcp'

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