exiaVoiceroidExplain
Generate Kotonoha Sisters Explainer style scenarios for the exia novel game engine to explain topics through character dialogue and narrative content.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes |
Implementation Reference
- src/server.ts:123-208 (handler)The complete inline handler for the 'exiaVoiceroidExplain' tool. It performs scenario generation using generateVoiceroidScenario, parsing with parseVoiceroidScenario, Exia setup/check, scenario saving, and Exia startup using ExiaManager. Includes error handling and success response.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, }; } });
- src/server.ts:123-123 (registration)Tool registration call with schema defining 'topic' as string using Zod.server.tool("exiaVoiceroidExplain", { topic: z.string() }, async ({ topic }) => {
- src/server.ts:123-123 (schema)Input schema for the tool: requires a 'topic' string parameter.server.tool("exiaVoiceroidExplain", { topic: z.string() }, async ({ topic }) => {