Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 47 lines 1.3 kB view raw
1// Tool: publish_kidlisp 2// Publish KidLisp code to aesthetic.computer 3 4export const publishKidLispTool = { 5 name: "publish_kidlisp", 6 description: "Publish KidLisp code to aesthetic.computer. KidLisp is a creative coding Lisp dialect.", 7 inputSchema: { 8 type: "object" as const, 9 properties: { 10 source: { 11 type: "string", 12 description: "KidLisp source code (max 50,000 characters)", 13 }, 14 }, 15 required: ["source"], 16 }, 17}; 18 19export async function publishKidLisp(args: { source: string }, token?: string) { 20 const headers: Record<string, string> = { 21 "Content-Type": "application/json", 22 }; 23 24 if (token) { 25 headers["Authorization"] = `Bearer ${token}`; 26 } 27 28 const response = await fetch("https://aesthetic.computer/api/store-kidlisp", { 29 method: "POST", 30 headers, 31 body: JSON.stringify({ 32 source: args.source, 33 }), 34 }); 35 36 if (!response.ok) { 37 const error: any = await response.json().catch(() => ({ error: response.statusText })); 38 throw new Error(`Failed to publish KidLisp: ${error.error || response.statusText}`); 39 } 40 41 const result: any = await response.json(); 42 return { 43 code: result.code, 44 url: `https://aesthetic.computer/${result.code}`, 45 cached: result.cached, 46 }; 47}