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.

802 B
Raw Blame
// MCP tool-result content builders, shared by every bridge tool.

/**
 * Wrap a value as an MCP tool result. Everything goes out as a JSON `text`
 * block (universally consumable); plain objects ALSO go out as
 * `structuredContent` so typed clients can skip re-parsing the text. MCP
 * requires structuredContent to be an object, so strings/arrays stay text-only.
 */
export function asTextContent(value) {
	const text = typeof value === 'string' ? value : JSON.stringify(value, null, 2);
	const result = { content: [{ type: 'text', text }] };
	if (value !== null && typeof value === 'object' && !Array.isArray(value)) {
		result.structuredContent = value;
	}
	return result;
}

export function asErrorContent(message) {
	return {
		isError: true,
		content: [{ type: 'text', text: message }],
	};
}