openart_create_character
Create an OpenArt character from an image by providing a name and local file path, with optional background story and voice ID.
Instructions
Create a new OpenArt character from an image. Provide name, local image path, optional background story, optional voice ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| image_path | Yes | Absolute local file path to the character image | |
| background_story | No | ||
| voice_id | No |
Implementation Reference
- src/tools.ts:76-109 (handler)The handler function `createCharacter` that implements the character creation logic via Playwright browser automation on OpenArt's website.
export async function createCharacter(params: { name: string; image_path: string; background_story?: string; voice_id?: string; }): Promise<Character> { const page = await newPage(); try { await page.goto(`${BASE_URL}/suite/characters-and-worlds`); await page.waitForLoadState("networkidle"); // TODO: real selectors. Approximate flow: await page.locator('button:has-text("Create Character")').click(); await page.locator('input[name="name"]').fill(params.name); await page.locator('input[type="file"]').setInputFiles(params.image_path); if (params.background_story) { await page.locator('textarea[name="background_story"]').fill(params.background_story); } if (params.voice_id) { await page.locator(`[data-voice-id="${params.voice_id}"]`).click(); } await page.locator('button:has-text("Create")').click(); await page.waitForURL(/\/character\/.+/); const id = page.url().split("/character/").pop() || ""; return { id, name: params.name, url: page.url(), }; } finally { await page.close(); } } - src/index.ts:40-53 (schema)The input schema / type definition for the openart_create_character tool.
{ name: "openart_create_character", description: "Create a new OpenArt character from an image. Provide name, local image path, optional background story, optional voice ID.", inputSchema: { type: "object", properties: { name: { type: "string" }, image_path: { type: "string", description: "Absolute local file path to the character image" }, background_story: { type: "string" }, voice_id: { type: "string" }, }, required: ["name", "image_path"], }, - src/index.ts:96-104 (registration)The registration / dispatch logic that routes the 'openart_create_character' tool call to the createCharacter handler with Zod validation.
case "openart_create_character": result = await createCharacter( z.object({ name: z.string(), image_path: z.string(), background_story: z.string().optional(), voice_id: z.string().optional(), }).parse(args) ); - src/openart.ts:28-31 (helper)The `newPage` helper used by createCharacter to get a Playwright page with a logged-in browser context.
export async function newPage(): Promise<Page> { const ctx = await getContext(); return ctx.newPage(); }