Skip to main content
Glama
kokushin

exia-scenario-generator MCP Server

by kokushin

saveScenario

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYes

Implementation Reference

  • The handler function for the 'saveScenario' MCP tool. It generates a scenario from the input 'topic' using generateVoiceroidScenario, parses it to exia format with parseVoiceroidScenario, saves it via exiaManager.saveScenario, and returns a success or 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, }; } });
  • The ExiaManager.saveScenario method, which saves the provided Scenario object as JSON to the exia's scenarios directory (S_000.json). Ensures exia is set up and creates directories if needed.
    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"); } }
  • TypeScript interface definition for the Scenario object used in saveScenario, defining the structure expected by exia's scenario format.
    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