edit_persona
Modify specific properties of an existing AI persona, such as name, description, instructions, or metadata, to tailor its behavior and functionality within the DollhouseMCP server.
Instructions
Edit an existing persona's properties
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field | Yes | Field to edit: name, description, instructions, triggers, category, version, or metadata fields | |
| persona | Yes | The persona name or filename to edit | |
| value | Yes | The new value for the field |
Implementation Reference
- src/persona/PersonaManager.ts:229-300 (handler)Core implementation of the edit_persona tool handler. Locates the persona by identifier, sanitizes and updates the specified field (name, description, instructions/content, category, triggers, version), auto-increments version, validates the persona, saves to disk via loader, and returns success/error status.async editPersona( personaName: string, field: string, value: string ): Promise<{ success: boolean; message: string }> { const persona = this.findPersona(personaName); if (!persona) { return { success: false, message: `Persona not found: "${personaName}"` }; } try { const oldVersion = String(persona.metadata.version || '1.0'); switch (field.toLowerCase()) { case 'name': persona.metadata.name = sanitizeInput(value, 50); break; case 'description': persona.metadata.description = sanitizeInput(value, 200); break; case 'instructions': case 'content': persona.content = value; break; case 'category': persona.metadata.category = value; break; case 'triggers': persona.metadata.triggers = value.split(',').map(t => t.trim()).filter(t => t); break; case 'version': persona.metadata.version = value; break; default: return { success: false, message: `Unknown field: "${field}". Valid fields: name, description, instructions, category, triggers, version` }; } // Auto-increment version if not explicitly setting version if (field !== 'version') { persona.metadata.version = this.incrementVersion(oldVersion); } // Validate const validation = this.validator.validatePersona(persona); if (!validation.valid) { return { success: false, message: `Validation failed: ${validation.issues.join(', ')}` }; } // Save changes await this.loader.savePersona(persona); return { success: true, message: `Updated ${field} for "${persona.metadata.name}" (v${persona.metadata.version})` }; } catch (error) { return { success: false, message: `Failed to edit persona: ${error instanceof Error ? error.message : String(error)}` }; } }
- src/types/mcp.ts:68-72 (schema)Zod input schema for the edit_persona MCP tool, defining required parameters: persona_name (string), field (string), value (string) with descriptions.export const EditPersonaArgsSchema = z.object({ persona_name: z.string().describe("Name of the persona to edit"), field: z.string().describe("Field to edit (name, description, instructions, category, triggers, version)"), value: z.string().describe("New value for the field") });
- src/server/types.ts:14-14 (registration)Interface definition in IToolHandler for the editPersona method, which corresponds to the 'edit_persona' MCP tool. This interface is implemented by the server, mapping method calls to MCP tool invocations.editPersona(persona: string, field: string, value: string): Promise<any>;