chain_personas
Execute multiple expert personas sequentially to perform step-by-step processing tasks, passing outputs between personas for complex workflows.
Instructions
여러 페르소나를 순차적으로 실행하여 단계별 처리를 수행합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| personas | Yes | 순차 실행할 페르소나 이름 배열 | |
| initialInput | Yes | 첫 번째 페르소나에 전달할 입력 |
Implementation Reference
- src/index.ts:537-579 (handler)The core handler logic for the 'chain_personas' tool. It validates input, iterates through the specified personas, reads each persona's content, tracks usage, simulates chaining with placeholder inputs, and returns a formatted report of the chain execution steps.case 'chain_personas': { const validated = chainPersonasSchema.parse(args); const results: ChainResult[] = []; let currentInput = validated.initialInput; for (const personaName of validated.personas) { try { const personaContent = await readPersona(personaName); await trackUsage(personaName, currentInput); results.push({ persona: personaName, prompt: personaContent, input: currentInput, }); // 다음 입력은 현재 페르소나의 출력이 될 것임을 명시 currentInput = `[Previous output from ${personaName} will be used as input here]`; } catch (error) { results.push({ persona: personaName, error: (error as Error).message, }); break; } } const resultText = results.map((r, i) => { if (r.error) { return `Step ${i + 1} - ${r.persona}: ❌ ${r.error}`; } return `Step ${i + 1} - ${r.persona}:\n\nPrompt:\n${r.prompt}\n\nInput:\n${r.input}\n`; }).join('\n' + '='.repeat(50) + '\n\n'); return { content: [ { type: 'text', text: `🔗 Persona Chain Execution\n\n${resultText}\n✅ Chain completed: ${results.filter(r => !r.error).length}/${validated.personas.length} steps`, }, ], }; }
- src/validation.ts:38-41 (schema)Zod schema defining the input structure for chain_personas: an array of 1-10 valid persona names and an initial input string (max 10k chars).export const chainPersonasSchema = z.object({ personas: z.array(personaNameSchema).min(1).max(10), initialInput: z.string().min(1).max(10000), });
- src/index.ts:396-412 (registration)Tool registration in the MCP listTools handler, providing the name, description, and JSON schema matching the Zod validation schema.name: 'chain_personas', description: '여러 페르소나를 순차적으로 실행하여 단계별 처리를 수행합니다', inputSchema: { type: 'object', properties: { personas: { type: 'array', items: { type: 'string' }, description: '순차 실행할 페르소나 이름 배열', }, initialInput: { type: 'string', description: '첫 번째 페르소나에 전달할 입력', }, }, required: ['personas', 'initialInput'], },