create_persona
Design and configure custom AI personas with specific names, descriptions, instructions, and optional trigger words for dynamic behavioral activation within the DollhouseMCP ecosystem.
Instructions
Create a new persona with guided assistance
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | Yes | A brief description of the persona | |
| instructions | Yes | The main instructions/prompt for the persona | |
| name | Yes | The display name for the persona | |
| triggers | No | Comma-separated list of trigger words (optional) |
Implementation Reference
- src/persona/PersonaManager.ts:151-224 (handler)The core handler function that implements the logic for creating a new persona. It sanitizes inputs, generates metadata and filename, validates the persona, saves it to disk, and caches it in memory.async createPersona( name: string, description: string, category: string, instructions: string ): Promise<{ success: boolean; message: string; filename?: string }> { try { // Validate inputs const cleanName = sanitizeInput(name, 50); const cleanDescription = sanitizeInput(description, 200); if (!cleanName) { return { success: false, message: "Persona name cannot be empty" }; } // Generate filename const baseFilename = slugify(cleanName) + '.md'; const filename = validateFilename(baseFilename); // Check if already exists if (this.personas.has(filename)) { return { success: false, message: `A persona named "${cleanName}" already exists` }; } // Create metadata const metadata: PersonaMetadata = { name: cleanName, description: cleanDescription, category: category || 'general', version: '1.0', author: this.getCurrentUserForAttribution() || undefined, unique_id: generateUniqueId(cleanName, this.getCurrentUserForAttribution() || undefined), triggers: this.generateTriggers(cleanName), created_date: new Date().toISOString() }; // Create persona const persona: Persona = { metadata, content: instructions, filename, unique_id: metadata.unique_id! }; // Validate const validation = this.validator.validatePersona(persona); if (!validation.valid) { return { success: false, message: `Validation failed: ${validation.issues.join(', ')}` }; } // Save to disk await this.loader.savePersona(persona); // Add to memory this.personas.set(filename, persona); return { success: true, message: `Created persona "${cleanName}" successfully`, filename }; } catch (error) { return { success: false, message: `Failed to create persona: ${error instanceof Error ? error.message : String(error)}` }; } }
- src/types/mcp.ts:61-66 (schema)Zod schema defining the input parameters and validation for the create_persona MCP tool.export const CreatePersonaArgsSchema = z.object({ name: z.string().describe("Name for the new persona"), description: z.string().describe("Brief description of the persona"), category: z.string().describe("Category (creative, professional, educational, gaming, personal)"), instructions: z.string().describe("The persona instructions/content") });
- src/server/types.ts:13-13 (schema)TypeScript interface definition for the server's createPersona method, used in IToolHandler for tool execution.createPersona(name: string, description: string, category: string, instructions: string, triggers?: string): Promise<any>;