build_cylinder
Create cylinders, towers, or pipes in Minecraft Bedrock by specifying center coordinates, radius, height, and material. Choose axis (y, x, z) and hollow or solid design for versatile builds.
Instructions
Build CYLINDER: tower, pillar, column, chimney, pipe, tube. Requires: centerX,centerY,centerZ,radius,height. Optional: axis
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Build action to perform | build |
| axis | No | Direction the cylinder extends: y=vertical (normal tower), x=horizontal east-west, z=horizontal north-south | y |
| centerX | Yes | Center X coordinate (east-west position where the cylinder will be centered) | |
| centerY | Yes | Bottom Y coordinate (ground level height where cylinder starts, typically 64) | |
| centerZ | Yes | Center Z coordinate (north-south position where the cylinder will be centered) | |
| height | Yes | Height in blocks (how tall the cylinder is). Short: 5-10, Medium: 15-25, Tall: 30-50 | |
| hollow | No | Make it hollow (true) for cylinder shell/walls only, or solid (false) for full cylinder | |
| material | No | Block type to build with (e.g. stone, brick, concrete, wood, etc.) | minecraft:stone |
| radius | Yes | Radius in blocks (how wide the cylinder is). Thin: 2-4, Medium: 5-10, Wide: 15-30 |
Implementation Reference
- The primary handler function that implements the build_cylinder tool logic: validates inputs, calculates cylinder positions, checks limits, and executes the build using optimized build executor.async execute(args: { action?: string; centerX: number; centerY: number; centerZ: number; radius: number; height: number; material?: string; hollow?: boolean; axis?: string; }): Promise<ToolCallResult> { try { // Socket-BE API接続確認 if (!this.world) { return { success: false, message: "World not available. Ensure Minecraft is connected." }; } // 引数の基本検証 if (!args || typeof args !== 'object') { return this.createErrorResponse('Invalid arguments provided'); } if (!this.validateArgs(args)) { return this.createErrorResponse('Missing required arguments: centerX, centerY, centerZ, radius, height'); } const { action = 'build', centerX, centerY, centerZ, radius, height, material = 'minecraft:stone', hollow = false, axis = 'y' } = args; // actionパラメータをサポート(現在は build のみ) if (action !== 'build') { return this.createErrorResponse(`Unknown action: ${action}. Only 'build' is supported.`); } // 座標の整数化 const center = { x: this.normalizeCoordinate(centerX), y: this.normalizeCoordinate(centerY), z: this.normalizeCoordinate(centerZ) }; const radiusInt = Math.round(radius); const heightInt = Math.round(height); // パラメータ検証 if (radiusInt < 1 || radiusInt > 30) { return this.createErrorResponse('Radius must be between 1 and 30'); } if (heightInt < 1 || heightInt > 50) { return this.createErrorResponse('Height must be between 1 and 50'); } if (!['x', 'y', 'z'].includes(axis)) { return this.createErrorResponse('Axis must be x, y, or z'); } // 座標検証(軸に応じて範囲をチェック) let minX = center.x, maxX = center.x; let minY = center.y, maxY = center.y; let minZ = center.z, maxZ = center.z; if (axis === 'y') { minX = center.x - radiusInt; maxX = center.x + radiusInt; minY = center.y; maxY = center.y + heightInt - 1; minZ = center.z - radiusInt; maxZ = center.z + radiusInt; } else if (axis === 'x') { minX = center.x; maxX = center.x + heightInt - 1; minY = center.y - radiusInt; maxY = center.y + radiusInt; minZ = center.z - radiusInt; maxZ = center.z + radiusInt; } else if (axis === 'z') { minX = center.x - radiusInt; maxX = center.x + radiusInt; minY = center.y - radiusInt; maxY = center.y + radiusInt; minZ = center.z; maxZ = center.z + heightInt - 1; } if (!this.validateCoordinates(minX, minY, minZ) || !this.validateCoordinates(maxX, maxY, maxZ)) { return this.createErrorResponse('Cylinder extends beyond valid coordinates'); } // ブロックIDの正規化 const blockId = this.normalizeBlockId(material); // 円柱の座標を計算 const positions = calculateCylinderPositions(center, radiusInt, heightInt, axis as 'x' | 'y' | 'z', hollow); // ブロック数制限チェック(最適化効果を考慮) if (positions.length > BUILD_LIMITS.CYLINDER) { return this.createErrorResponse(`Too many blocks to place (maximum ${BUILD_LIMITS.CYLINDER.toLocaleString()})`); } try { // 最適化されたビルド実行 const result = await executeBuildWithOptimization( this.world, positions, blockId, { type: 'cylinder', center: center, radius: radiusInt, height: heightInt, axis: axis, hollow: hollow, material: blockId, apiUsed: 'Socket-BE' } ); if (!result.success) { return this.createErrorResponse(result.message); } return { success: true, message: result.message, data: result.data }; } catch (buildError) { return this.createErrorResponse(`Building error: ${buildError instanceof Error ? buildError.message : String(buildError)}`); } } catch (error) { return this.createErrorResponse( `Error building cylinder: ${error instanceof Error ? error.message : String(error)}` ); } }
- Input schema defining parameters for the build_cylinder tool including required coordinates, radius, height, and optional material, hollow, axis.readonly inputSchema: InputSchema = { type: 'object', properties: { action: { type: 'string', description: 'Build action to perform', enum: ['build'], default: 'build' }, centerX: { type: 'number', description: 'Center X coordinate (east-west position where the cylinder will be centered)' }, centerY: { type: 'number', description: 'Bottom Y coordinate (ground level height where cylinder starts, typically 64)' }, centerZ: { type: 'number', description: 'Center Z coordinate (north-south position where the cylinder will be centered)' }, radius: { type: 'number', description: 'Radius in blocks (how wide the cylinder is). Thin: 2-4, Medium: 5-10, Wide: 15-30', minimum: 1, maximum: 30 }, height: { type: 'number', description: 'Height in blocks (how tall the cylinder is). Short: 5-10, Medium: 15-25, Tall: 30-50', minimum: 1, maximum: 50 }, material: { type: 'string', description: 'Block type to build with (e.g. stone, brick, concrete, wood, etc.)', default: 'minecraft:stone' }, hollow: { type: 'boolean', description: 'Make it hollow (true) for cylinder shell/walls only, or solid (false) for full cylinder', default: false }, axis: { type: 'string', description: 'Direction the cylinder extends: y=vertical (normal tower), x=horizontal east-west, z=horizontal north-south', enum: ['y', 'x', 'z'], default: 'y' } }, required: ['centerX', 'centerY', 'centerZ', 'radius', 'height'] };
- src/server.ts:359-372 (registration)Instantiation of BuildCylinderTool in the tools array within the server constructor, which leads to its registration via registerModularTools() method.// 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:17-17 (registration)Import statement for BuildCylinderTool used in server registration.import { BuildCylinderTool } from "./tools/advanced/building/build-cylinder";