openart_list_characters
Retrieve a complete list of all characters and avatars from your OpenArt account.
Instructions
List all characters/avatars in the user's OpenArt account.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:25-51 (handler)The actual handler function `listCharacters` that navigates to the OpenArt characters page and scrapes the character cards using Playwright.
export async function listCharacters(): Promise<Character[]> { const page = await newPage(); try { await page.goto(`${BASE_URL}/suite/characters-and-worlds`); await page.waitForLoadState("networkidle"); // TODO: replace with real selectors after inspecting OpenArt UI. // Use `npx playwright codegen https://openart.ai/suite/characters-and-worlds` const cards = await page.locator('[data-character-card]').all(); const results: Character[] = []; for (const card of cards) { const id = (await card.getAttribute("data-character-id")) || ""; const name = (await card.locator(".character-name").textContent())?.trim() || ""; const thumb = await card.locator("img").first().getAttribute("src"); results.push({ id, name, thumbnail_url: thumb || undefined, url: `${BASE_URL}/character/${id}`, }); } return results; } finally { await page.close(); } } - src/index.ts:23-29 (schema)Schema definition for openart_list_characters: no required input, readOnlyHint + openWorldHint annotations.
const tools = [ { name: "openart_list_characters", description: "List all characters/avatars in the user's OpenArt account.", inputSchema: { type: "object", properties: {}, required: [] }, annotations: { readOnlyHint: true, openWorldHint: true }, }, - src/index.ts:88-92 (registration)Registration/dispatch in CallToolRequestSchema handler: routes 'openart_list_characters' to listCharacters().
let result: unknown; switch (name) { case "openart_list_characters": result = await listCharacters(); break; - src/openart.ts:28-31 (helper)Helper `newPage()` used by listCharacters to create a Playwright page with an authenticated context.
export async function newPage(): Promise<Page> { const ctx = await getContext(); return ctx.newPage(); } - src/tools.ts:10-15 (helper)The `Character` interface returned by listCharacters.
export interface Character { id: string; name: string; thumbnail_url?: string; url: string; }