Skip to main content
Glama

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
NameRequiredDescriptionDefault
descriptionYesA brief description of the persona
instructionsYesThe main instructions/prompt for the persona
nameYesThe display name for the persona
triggersNoComma-separated list of trigger words (optional)

Implementation Reference

  • 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)}` }; } }
  • 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") });
  • 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>;

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/DollhouseMCP/DollhouseMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server