Skip to main content
Glama
kokushin

exia-scenario-generator MCP Server

by kokushin

exiaVoiceroidExplain

Explain topics using the Kotonoha Sisters Explainer style for the exia novel game engine. Generates scenarios based on user-provided topics.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicYes

Implementation Reference

  • The complete handler function for the 'exiaVoiceroidExplain' MCP tool. It performs scenario generation using OpenAI, parses it for VOICERROID/Exia format, checks and performs Exia setup if needed, saves the scenario, starts the Exia application, and returns a success message. All steps are wrapped in try-catch for robust error handling.
    server.tool("exiaVoiceroidExplain", { topic: z.string() }, async ({ topic }) => {
      try {
        // 各ステップの結果を保存する変数
        let rawScenario: string;
        let scenario: any;
        let url: string;
        let setupNeeded = false;
    
        // 1. シナリオの生成
        console.error(`Generating scenario for topic: ${topic}`);
        try {
          rawScenario = await generateVoiceroidScenario({ topic, minLength: 2000 });
          console.error("Scenario generation completed successfully");
        } catch (error) {
          console.error("Error generating scenario:", error);
          throw new Error(`シナリオの生成に失敗しました: ${error}`);
        }
    
        // 2. シナリオのパースとexia形式への変換
        console.error("Parsing scenario to exia format");
        try {
          scenario = parseVoiceroidScenario(rawScenario);
          console.error("Scenario parsing completed successfully");
        } catch (error) {
          console.error("Error parsing scenario:", error);
          throw new Error(`シナリオのパースに失敗しました: ${error}`);
        }
    
        // 3. exiaのセットアップ(必要な場合)
        try {
          setupNeeded = !(await exiaManager.checkSetup());
          if (setupNeeded) {
            console.error("Setting up exia");
            await exiaManager.setup();
            console.error("Exia setup completed successfully");
          } else {
            console.error("Exia is already set up");
          }
        } catch (error) {
          console.error("Error checking or setting up exia:", error);
          throw new Error(`exiaのセットアップに失敗しました: ${error}`);
        }
    
        // 4. シナリオの保存
        console.error("Saving scenario");
        try {
          await exiaManager.saveScenario(scenario);
          console.error("Scenario saved successfully");
        } catch (error) {
          console.error("Error saving scenario:", error);
          throw new Error(`シナリオの保存に失敗しました: ${error}`);
        }
    
        // 5. exiaの起動(必ず最後に実行)
        console.error("Starting exia (final step)");
        try {
          url = await exiaManager.start();
          console.error(`Exia started successfully at ${url}`);
        } catch (error) {
          console.error("Error starting exia:", error);
          throw new Error(`exiaの起動に失敗しました: ${error}`);
        }
    
        // 全ステップが成功した場合の応答
        // 明確な成功メッセージを返して、Claudeが誤ったエラーメッセージを表示しないようにする
        return {
          content: [
            {
              type: "text",
              text: `✅ 成功: 「${topic}」についての琴葉姉妹解説シナリオを生成し、exiaを正常に起動しました。\n\n処理は正常に完了しました。exiaアプリケーション(Electron)が別ウィンドウで起動しています。シナリオをお楽しみください。`,
            },
          ],
        };
      } catch (error) {
        console.error("Error in exiaVoiceroidExplain:", error);
        return {
          content: [
            {
              type: "text",
              text: `処理に失敗しました: ${error}`,
            },
          ],
          isError: true,
        };
      }
    });
  • Input schema for the exiaVoiceroidExplain tool, defining a single string parameter 'topic' validated by Zod.
    server.tool("exiaVoiceroidExplain", { topic: z.string() }, async ({ topic }) => {
  • src/server.ts:123-123 (registration)
    Registration of the exiaVoiceroidExplain tool on the MCP server, including schema and inline handler.
    server.tool("exiaVoiceroidExplain", { topic: z.string() }, async ({ topic }) => {

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