smart_duplicate
Automate duplication in Roblox Studio with customized naming, positioning, rotation, scaling, and property variations for efficient object creation.
Instructions
Smart duplication with automatic naming, positioning, and property variations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| count | Yes | Number of duplicates to create | |
| instancePath | Yes | Path to the instance to duplicate | |
| options | No |
Input Schema (JSON Schema)
{
"properties": {
"count": {
"description": "Number of duplicates to create",
"type": "number"
},
"instancePath": {
"description": "Path to the instance to duplicate",
"type": "string"
},
"options": {
"properties": {
"namePattern": {
"description": "Name pattern with {n} placeholder (e.g., \"Button{n}\")",
"type": "string"
},
"positionOffset": {
"description": "X, Y, Z offset per duplicate",
"items": {
"type": "number"
},
"maxItems": 3,
"minItems": 3,
"type": "array"
},
"propertyVariations": {
"description": "Property name to array of values",
"type": "object"
},
"rotationOffset": {
"description": "X, Y, Z rotation offset per duplicate",
"items": {
"type": "number"
},
"maxItems": 3,
"minItems": 3,
"type": "array"
},
"scaleOffset": {
"description": "X, Y, Z scale multiplier per duplicate",
"items": {
"type": "number"
},
"maxItems": 3,
"minItems": 3,
"type": "array"
},
"targetParents": {
"description": "Different parent for each duplicate",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
}
},
"required": [
"instancePath",
"count"
],
"type": "object"
}
Implementation Reference
- src/tools/index.ts:302-330 (handler)The handler function that executes the smart_duplicate tool logic. It validates the instancePath and count parameters, then forwards the request to the Studio API endpoint '/api/smart-duplicate' via the HTTP client, and formats the response as MCP content.async smartDuplicate( instancePath: string, count: number, options?: { namePattern?: string; // e.g., "Button{n}" where {n} is replaced with index positionOffset?: [number, number, number]; // X, Y, Z offset per duplicate rotationOffset?: [number, number, number]; // X, Y, Z rotation offset per duplicate scaleOffset?: [number, number, number]; // X, Y, Z scale multiplier per duplicate propertyVariations?: Record<string, any[]>; // Property name to array of values targetParents?: string[]; // Different parent for each duplicate } ) { if (!instancePath || count < 1) { throw new Error('Instance path and count > 0 are required for smart_duplicate'); } const response = await this.client.request('/api/smart-duplicate', { instancePath, count, options }); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2) } ] }; }
- src/index.ts:421-476 (schema)The detailed input schema for the smart_duplicate tool, defining parameters including required instancePath and count, and optional options object with namePattern, positionOffset, rotationOffset, scaleOffset, propertyVariations, and targetParents.name: 'smart_duplicate', description: 'Smart duplication with automatic naming, positioning, and property variations', inputSchema: { type: 'object', properties: { instancePath: { type: 'string', description: 'Path to the instance to duplicate' }, count: { type: 'number', description: 'Number of duplicates to create' }, options: { type: 'object', properties: { namePattern: { type: 'string', description: 'Name pattern with {n} placeholder (e.g., "Button{n}")' }, positionOffset: { type: 'array', items: { type: 'number' }, minItems: 3, maxItems: 3, description: 'X, Y, Z offset per duplicate' }, rotationOffset: { type: 'array', items: { type: 'number' }, minItems: 3, maxItems: 3, description: 'X, Y, Z rotation offset per duplicate' }, scaleOffset: { type: 'array', items: { type: 'number' }, minItems: 3, maxItems: 3, description: 'X, Y, Z scale multiplier per duplicate' }, propertyVariations: { type: 'object', description: 'Property name to array of values' }, targetParents: { type: 'array', items: { type: 'string' }, description: 'Different parent for each duplicate' } } } }, required: ['instancePath', 'count'] } },
- src/index.ts:698-700 (registration)The registration and dispatching logic in the MCP server's callTool request handler, which maps the 'smart_duplicate' tool name to the corresponding method on the RobloxStudioTools instance.case 'smart_duplicate': return await this.tools.smartDuplicate((args as any)?.instancePath as string, (args as any)?.count as number, (args as any)?.options); case 'mass_duplicate':