create3DText
Generate 3D text objects in Spline scenes with customizable fonts, sizes, colors, and extrusion depth for 3D design projects.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sceneId | Yes | Scene ID | |
| text | Yes | Text content | |
| name | No | Object name | |
| position | No | Object position | |
| font | No | Font family | Inter |
| size | No | Font size | |
| extrusion | No | Extrusion depth | |
| color | No | Text color (hex) | #ffffff |
Implementation Reference
- src/tools/design/text-tools.js:15-64 (registration)Registration of the create3DText tool including inline schema and handlerserver.tool( "create3DText", { sceneId: z.string().min(1).describe("Scene ID"), text: z.string().min(1).describe("Text content"), font: z.string().optional().describe("Font name"), size: z.number().positive().default(1).describe("Text size"), depth: z.number().positive().default(0.2).describe("Extrusion depth for 3D"), position: z.object({ x: z.number().default(0), y: z.number().default(0), z: z.number().default(0), }).optional().describe("Position in 3D space"), alignment: z.enum(["left", "center", "right"]).default("left").describe("Text alignment"), material: z.string().optional().describe("Material ID to apply"), is3D: z.boolean().default(true).describe("Create 3D extruded text or flat 2D text"), }, async ({ sceneId, text, font, size, depth, position, alignment, material, is3D }) => { try { const result = await fetchFromSplineApi(`/scenes/${sceneId}/objects/text`, { method: "POST", body: JSON.stringify({ text, font, size, depth, position, alignment, material, is3D, }), }); return { content: [{ type: "text", text: `Created ${is3D ? '3D' : '2D'} text object (ID: ${result.objectId})` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating text object: ${error.message}` }], isError: true }; } } );
- src/tools/design/text-tools.js:32-63 (handler)Handler function that performs the actual API call to create the 3D text object in the Spline sceneasync ({ sceneId, text, font, size, depth, position, alignment, material, is3D }) => { try { const result = await fetchFromSplineApi(`/scenes/${sceneId}/objects/text`, { method: "POST", body: JSON.stringify({ text, font, size, depth, position, alignment, material, is3D, }), }); return { content: [{ type: "text", text: `Created ${is3D ? '3D' : '2D'} text object (ID: ${result.objectId})` }] }; } catch (error) { return { content: [{ type: "text", text: `Error creating text object: ${error.message}` }], isError: true }; } }
- src/tools/design/text-tools.js:17-31 (schema)Input schema validation using Zod for the create3DText tool parameters{ sceneId: z.string().min(1).describe("Scene ID"), text: z.string().min(1).describe("Text content"), font: z.string().optional().describe("Font name"), size: z.number().positive().default(1).describe("Text size"), depth: z.number().positive().default(0.2).describe("Extrusion depth for 3D"), position: z.object({ x: z.number().default(0), y: z.number().default(0), z: z.number().default(0), }).optional().describe("Position in 3D space"), alignment: z.enum(["left", "center", "right"]).default("left").describe("Text alignment"), material: z.string().optional().describe("Material ID to apply"), is3D: z.boolean().default(true).describe("Create 3D extruded text or flat 2D text"), },
- src/tools/design-tools.js:52-92 (registration)Alternative/stub registration of create3DText in design-tools (dummy implementation)server.tool( 'create3DText', { sceneId: z.string().min(1).describe('Scene ID'), text: z.string().min(1).describe('Text content'), name: z.string().optional().describe('Object name'), position: z.object({ x: z.number().default(0).describe('X position'), y: z.number().default(0).describe('Y position'), z: z.number().default(0).describe('Z position'), }).optional().describe('Object position'), font: z.string().optional().default('Inter').describe('Font family'), size: z.number().min(0).optional().default(1).describe('Font size'), extrusion: z.number().min(0).optional().default(0.2).describe('Extrusion depth'), color: z.string().optional().default('#ffffff').describe('Text color (hex)'), }, async ({ sceneId, text, name, position, font, size, extrusion, color }) => { try { // This would normally call the Spline API to create 3D text // For now, just return a success message return { content: [ { type: 'text', text: `3D text "${text}" created successfully` } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error creating 3D text: ${error.message}` } ], isError: true }; } } );
- src/tools/design/text-tools.js:8-8 (helper)Imports helper functions for API calls used in the handlerimport { fetchFromSplineApi, updateSplineObject } from "../../utils/api-client.js";