Skip to main content
Glama

generateEmbedCode

Generate embed code for Spline 3D scenes to integrate interactive designs into websites using customizable iframe parameters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sceneIdYesScene ID
widthNoIframe width100%
heightNoIframe height100%
frameBorderNoIframe border0

Implementation Reference

  • The async handler function that implements the generateEmbedCode tool logic. It creates an iframe embed code for the Spline scene using the provided sceneId and optional dimensions.
    async ({ sceneId, width, height, frameBorder }) => { try { const embedUrl = `https://my.spline.design/${sceneId}/`; const embedCode = `<iframe src='${embedUrl}' frameborder='${frameBorder}' width='${width}' height='${height}'></iframe>`; return { content: [ { type: 'text', text: embedCode } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error generating embed code: ${error.message}` } ], isError: true }; } }
  • Zod input schema for the generateEmbedCode tool, validating sceneId and optional iframe attributes.
    { sceneId: z.string().min(1).describe('Scene ID'), width: z.string().default('100%').describe('Iframe width'), height: z.string().default('100%').describe('Iframe height'), frameBorder: z.string().default('0').describe('Iframe border'), },
  • The server.tool call that registers the generateEmbedCode tool with MCP server, including name, schema, and handler.
    'generateEmbedCode', { sceneId: z.string().min(1).describe('Scene ID'), width: z.string().default('100%').describe('Iframe width'), height: z.string().default('100%').describe('Iframe height'), frameBorder: z.string().default('0').describe('Iframe border'), }, async ({ sceneId, width, height, frameBorder }) => { try { const embedUrl = `https://my.spline.design/${sceneId}/`; const embedCode = `<iframe src='${embedUrl}' frameborder='${frameBorder}' width='${width}' height='${height}'></iframe>`; return { content: [ { type: 'text', text: embedCode } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error generating embed code: ${error.message}` } ], isError: true }; } } );
  • src/index.js:92-92 (registration)
    Top-level call to registerSceneTools function, which registers the generateEmbedCode tool among scene tools.
    registerSceneTools(server);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aydinfer/spline-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server