Skip to main content
Glama
Mming-Lab
by Mming-Lab

build_rotate

Rotate and duplicate structures around a pivot point in Minecraft Bedrock. Create symmetrical layouts, multiple orientations, or decorative spins by specifying coordinates, axis, and angle.

Instructions

Rotate and copy a structure around a pivot point. Perfect for creating rotated copies of buildings, making symmetrical structures, or spinning decorations. Example: rotate a house 90° around its center to create multiple orientations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionNoBuild action to performbuild
angleYesRotation angle in degrees. Common angles: 90=quarter turn, 180=half turn, 270=three-quarter turn, 45=diagonal
axisYesRotation axis: y=spin horizontally (most common), x=tip forward/backward, z=roll left/right
materialNoBlock type to build the rotated copy with (e.g. same as original, or different material for contrast)minecraft:stone
originXYesCenter of rotation X coordinate
originYYesCenter of rotation Y coordinate
originZYesCenter of rotation Z coordinate
sourceCorner1XYesSource region corner 1 X coordinate
sourceCorner1YYesSource region corner 1 Y coordinate
sourceCorner1ZYesSource region corner 1 Z coordinate
sourceCorner2XYesSource region corner 2 X coordinate
sourceCorner2YYesSource region corner 2 Y coordinate
sourceCorner2ZYesSource region corner 2 Z coordinate

Implementation Reference

  • Core handler function that validates parameters, rotates source region blocks around specified origin and axis, deduplicates positions, and places rotated structure using Socket-BE world.setBlock API.
    async execute(args: {
        action?: string;
        sourceCorner1X: number;
        sourceCorner1Y: number;
        sourceCorner1Z: number;
        sourceCorner2X: number;
        sourceCorner2Y: number;
        sourceCorner2Z: number;
        originX: number;
        originY: number;
        originZ: number;
        axis: string;
        angle: number;
        material?: string;
    }): Promise<ToolCallResult> {
        try {
            // Socket-BE API接続確認
            if (!this.world) {
                return { success: false, message: "World not available. Ensure Minecraft is connected." };
            }
    
            const {
                action = 'build',
                sourceCorner1X, sourceCorner1Y, sourceCorner1Z,
                sourceCorner2X, sourceCorner2Y, sourceCorner2Z,
                originX, originY, originZ,
                axis, angle,
                material = 'minecraft:stone'
            } = args;
            
            // actionパラメータをサポート(現在は build のみ)
            if (action !== 'build') {
                return this.createErrorResponse(`Unknown action: ${action}. Only 'build' is supported.`);
            }
    
            // 座標の整数化
            const source1 = {
                x: this.normalizeCoordinate(sourceCorner1X),
                y: this.normalizeCoordinate(sourceCorner1Y),
                z: this.normalizeCoordinate(sourceCorner1Z)
            };
    
            const source2 = {
                x: this.normalizeCoordinate(sourceCorner2X),
                y: this.normalizeCoordinate(sourceCorner2Y),
                z: this.normalizeCoordinate(sourceCorner2Z)
            };
    
            const origin = {
                x: this.normalizeCoordinate(originX),
                y: this.normalizeCoordinate(originY),
                z: this.normalizeCoordinate(originZ)
            };
    
            // パラメータ検証
            if (!['x', 'y', 'z'].includes(axis)) {
                return this.createErrorResponse('Axis must be x, y, or z');
            }
    
            if (angle < 0 || angle > 360) {
                return this.createErrorResponse('Angle must be between 0 and 360 degrees');
            }
    
            // ソース領域の範囲を計算
            const minX = Math.min(source1.x, source2.x);
            const maxX = Math.max(source1.x, source2.x);
            const minY = Math.min(source1.y, source2.y);
            const maxY = Math.max(source1.y, source2.y);
            const minZ = Math.min(source1.z, source2.z);
            const maxZ = Math.max(source1.z, source2.z);
    
            // 座標検証
            if (!this.validateCoordinates(minX, minY, minZ) || 
                !this.validateCoordinates(maxX, maxY, maxZ) ||
                !this.validateCoordinates(origin.x, origin.y, origin.z)) {
                return this.createErrorResponse('Coordinates extend beyond valid range');
            }
    
            // ブロック数の事前チェック
            const totalBlocks = (maxX - minX + 1) * (maxY - minY + 1) * (maxZ - minZ + 1);
            if (totalBlocks > 5000) {
                return this.createErrorResponse('Source region too large (maximum 5000 blocks)');
            }
    
            // ブロックIDの正規化
            const blockId = this.normalizeBlockId(material);
    
            const commands: string[] = [];
            let blocksPlaced = 0;
            const placedPositions = new Set<string>();
    
            // ソース領域の各座標を回転して配置
            for (let x = minX; x <= maxX; x++) {
                for (let y = minY; y <= maxY; y++) {
                    for (let z = minZ; z <= maxZ; z++) {
                        // 座標を回転(共通ライブラリ使用)
                        const rotated = rotatePoint3D(
                            { x, y, z },
                            origin,
                            axis as 'x' | 'y' | 'z',
                            angle
                        );
    
                        // 回転後の座標が有効範囲内かチェック
                        if (this.validateCoordinates(rotated.x, rotated.y, rotated.z)) {
                            const positionKey = `${rotated.x},${rotated.y},${rotated.z}`;
                            
                            // 重複座標を避ける
                            if (!placedPositions.has(positionKey)) {
                                placedPositions.add(positionKey);
                                commands.push(`setblock ${rotated.x} ${rotated.y} ${rotated.z} ${blockId}`);
                                blocksPlaced++;
                            }
                        }
                    }
                }
            }
    
            if (commands.length === 0) {
                return this.createErrorResponse('No valid blocks to place after rotation');
            }
    
            try {
                // Socket-BE APIを使用した実装
                let actualBlocksPlaced = 0;
                
                // コマンド配列をSocket-BE API呼び出しに変換
                for (const command of commands) {
                    if (command.startsWith('setblock ')) {
                        const parts = command.split(' ');
                        if (parts.length >= 5) {
                            const x = parseInt(parts[1]);
                            const y = parseInt(parts[2]);
                            const z = parseInt(parts[3]);
                            const block = parts[4];
                            
                            await this.world.setBlock({x, y, z}, block);
                            actualBlocksPlaced++;
                            
                            if (actualBlocksPlaced > BUILD_LIMITS.ROTATE) {
                                return this.createErrorResponse(`Too many blocks to place (maximum ${BUILD_LIMITS.ROTATE.toLocaleString()})`);
                            }
                        }
                    }
                }
                
                return this.createSuccessResponse(
                    `Rotated structure built with ${blockId}. Rotated ${totalBlocks} blocks by ${angle}° around ${axis}-axis at origin (${origin.x},${origin.y},${origin.z}). Placed ${actualBlocksPlaced} blocks.`,
                    {
                        type: 'rotation',
                        sourceRegion: {
                            corner1: source1,
                            corner2: source2
                        },
                        origin: origin,
                        axis: axis,
                        angle: angle,
                        material: blockId,
                        originalBlocks: totalBlocks,
                        blocksPlaced: actualBlocksPlaced,
                        apiUsed: 'Socket-BE'
                    }
                );
            } catch (buildError) {
                return this.createErrorResponse(`Building error: ${buildError instanceof Error ? buildError.message : String(buildError)}`);
            }
    
        } catch (error) {
            return this.createErrorResponse(
                `Error building rotated structure: ${error instanceof Error ? error.message : String(error)}`
            );
        }
    }
  • Input schema defining parameters for source region (two corners), rotation origin, axis (x/y/z), angle in degrees, and optional material for placed blocks.
    readonly inputSchema: InputSchema = {
        type: 'object',
        properties: {
            action: {
                type: 'string',
                description: 'Build action to perform',
                enum: ['build'],
                default: 'build'
            },
            sourceCorner1X: {
                type: 'number',
                description: 'Source region corner 1 X coordinate'
            },
            sourceCorner1Y: {
                type: 'number',
                description: 'Source region corner 1 Y coordinate'
            },
            sourceCorner1Z: {
                type: 'number',
                description: 'Source region corner 1 Z coordinate'
            },
            sourceCorner2X: {
                type: 'number',
                description: 'Source region corner 2 X coordinate'
            },
            sourceCorner2Y: {
                type: 'number',
                description: 'Source region corner 2 Y coordinate'
            },
            sourceCorner2Z: {
                type: 'number',
                description: 'Source region corner 2 Z coordinate'
            },
            originX: {
                type: 'number',
                description: 'Center of rotation X coordinate'
            },
            originY: {
                type: 'number',
                description: 'Center of rotation Y coordinate'
            },
            originZ: {
                type: 'number',
                description: 'Center of rotation Z coordinate'
            },
            axis: {
                type: 'string',
                description: 'Rotation axis: y=spin horizontally (most common), x=tip forward/backward, z=roll left/right',
                enum: ['x', 'y', 'z']
            },
            angle: {
                type: 'number',
                description: 'Rotation angle in degrees. Common angles: 90=quarter turn, 180=half turn, 270=three-quarter turn, 45=diagonal',
                minimum: 0,
                maximum: 360
            },
            material: {
                type: 'string',
                description: 'Block type to build the rotated copy with (e.g. same as original, or different material for contrast)',
                default: 'minecraft:stone'
            }
        },
        required: ['sourceCorner1X', 'sourceCorner1Y', 'sourceCorner1Z', 'sourceCorner2X', 'sourceCorner2Y', 'sourceCorner2Z', 'originX', 'originY', 'originZ', 'axis', 'angle']
    };
  • src/server.ts:348-372 (registration)
    Tool instantiation within the tools array in initializeTools(), which are then registered to MCP server via registerModularTools() loop using tool.name ('build_rotate'). Import at line 21.
    this.tools = [
      // Socket-BE Core API ツール(推奨 - シンプルでAI使いやすい)
      new AgentTool(),
      new WorldTool(),
      new PlayerTool(),
      new BlocksTool(),
      new SystemTool(),
      new CameraTool(),
      new SequenceTool(),
      new MinecraftWikiTool(),
    
      // Advanced Building ツール(高レベル建築機能)
      new BuildCubeTool(), // ✅ 完全動作
      new BuildLineTool(), // ✅ 完全動作
      new BuildSphereTool(), // ✅ 完全動作
      new BuildCylinderTool(), // ✅ 修正済み
      new BuildParaboloidTool(), // ✅ 基本動作
      new BuildHyperboloidTool(), // ✅ 基本動作
      new BuildRotateTool(), // ✅ 基本動作
      new BuildTransformTool(), // ✅ 基本動作
      new BuildTorusTool(), // ✅ 修正完了
      new BuildHelixTool(), // ✅ 修正完了
      new BuildEllipsoidTool(), // ✅ 修正完了
      new BuildBezierTool(), // ✅ 新規追加(可変制御点ベジェ曲線)
    ];
  • src/server.ts:21-21 (registration)
    Import statement for BuildRotateTool class.
    import { BuildRotateTool } from "./tools/advanced/building/build-rotate";
  • Class definition extending BaseTool with tool name 'build_rotate' and description.
    export class BuildRotateTool extends BaseTool {
        readonly name = 'build_rotate';
        readonly description = 'Rotate and copy a structure around a pivot point. Perfect for creating rotated copies of buildings, making symmetrical structures, or spinning decorations. Example: rotate a house 90° around its center to create multiple orientations';
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool 'rotate and copy,' implying a mutation operation that creates new structures, but doesn't specify behavioral traits such as whether it requires specific permissions, if it destroys the original structure, rate limits, or error handling. The description adds some context with examples but misses critical details for a mutation tool with many parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured, with two sentences that efficiently convey the purpose and examples. The first sentence states the core function, and the second provides illustrative use cases. There's no unnecessary verbosity, and it's front-loaded with the main action. However, it could be slightly more comprehensive given the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (13 parameters, 11 required, no output schema, and no annotations), the description is incomplete. It lacks details on behavioral aspects like mutation effects, permissions, or output format, and doesn't compensate for the absence of annotations. While it states the purpose, it doesn't provide enough context for safe and effective use by an AI agent, especially for a tool with many parameters and no structured safety hints.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, meaning all parameters are documented in the input schema. The description adds minimal value beyond the schema, as it doesn't explain parameter semantics, interactions, or provide additional context like how coordinates define regions or how rotation works practically. It mentions 'pivot point' which relates to origin parameters, but this is already covered in the schema. Baseline 3 is appropriate given high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Rotate and copy a structure around a pivot point.' It specifies the verb ('rotate and copy'), resource ('structure'), and context ('around a pivot point'), with examples like buildings and decorations. However, it doesn't explicitly distinguish this from sibling tools like 'build_transform' or other build tools, which might offer similar transformation capabilities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidelines through examples: 'Perfect for creating rotated copies of buildings, making symmetrical structures, or spinning decorations.' This suggests contexts like architectural design or decorative arrangements. However, it lacks explicit guidance on when to use this tool versus alternatives (e.g., 'build_transform' or other sibling tools), and doesn't mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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/Mming-Lab/minecraft-bedrock-mcp-server'

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