Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

1.6 KB
Raw Blame
// `list_animations` — fetch the three.ws pose preset catalog (24 presets
// across Standing, Action, Sitting & Floor, Expressive). Lives at
// GET /api/render/avatar-clip on three.ws so the catalog stays
// authoritative even when this MCP version is older than the live one.

import { THREE_WS_BASE } from '../config.js';
import { fetchPoseCatalogRemote } from '../lib/render.js';

export const def = {
	name: 'list_animations',
	title: 'List three.ws pose presets + animation slots',
	// MCP ToolAnnotations — safety hints surfaced to MCP clients.
	annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: false, openWorldHint: true },
	description:
		'Return the three.ws pose preset catalog (T-pose, A-pose, wave, thinker, jump, dance, warrior2, …) grouped by category. Use this to get the ids to pass as posePresetId in render_avatar. Fetched live from three.ws so the catalog reflects the deployed version.',
	inputSchema: {},
	async handler() {
		try {
			const catalog = await fetchPoseCatalogRemote();
			const grouped = {};
			for (const p of catalog.poses || []) {
				const key = p.group || 'Other';
				if (!grouped[key]) grouped[key] = [];
				grouped[key].push({ id: p.id, label: p.label });
			}
			return {
				ok: true,
				source: `${THREE_WS_BASE}/api/render/avatar-clip`,
				poseCount: (catalog.poses || []).length,
				groups: Object.keys(grouped).map((g) => ({ group: g, poses: grouped[g] })),
				cameraOrbit: catalog.cameraOrbit,
				background: catalog.background,
				fetchedAt: new Date().toISOString(),
			};
		} catch (err) {
			return { ok: false, error: 'fetch_failed', message: err.message };
		}
	},
};