transform_component
Adjust the position, rotation, or scale of a 3D component in Sketchup using the MCP server to enable precise model transformations and scene manipulation.
Instructions
Transform a component's position, rotation, or scale
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| position | No | ||
| rotation | No | ||
| scale | No |
Implementation Reference
- src/sketchup_mcp/server.py:313-341 (handler)Handler function for the transform_component tool. It connects to SketchUp via socket, prepares arguments for position, rotation, scale, and sends a JSON-RPC request to SketchUp's transform_component tool.def transform_component( ctx: Context, id: str, position: List[float] = None, rotation: List[float] = None, scale: List[float] = None ) -> str: """Transform a component's position, rotation, or scale""" try: sketchup = get_sketchup_connection() arguments = {"id": id} if position is not None: arguments["position"] = position if rotation is not None: arguments["rotation"] = rotation if scale is not None: arguments["scale"] = scale result = sketchup.send_command( method="tools/call", params={ "name": "transform_component", "arguments": arguments }, request_id=ctx.request_id ) return json.dumps(result) except Exception as e: return f"Error transforming component: {str(e)}"
- src/sketchup_mcp/server.py:313-341 (registration)The @mcp.tool() decorator registers this function as an MCP tool named 'transform_component' based on the function name.def transform_component( ctx: Context, id: str, position: List[float] = None, rotation: List[float] = None, scale: List[float] = None ) -> str: """Transform a component's position, rotation, or scale""" try: sketchup = get_sketchup_connection() arguments = {"id": id} if position is not None: arguments["position"] = position if rotation is not None: arguments["rotation"] = rotation if scale is not None: arguments["scale"] = scale result = sketchup.send_command( method="tools/call", params={ "name": "transform_component", "arguments": arguments }, request_id=ctx.request_id ) return json.dumps(result) except Exception as e: return f"Error transforming component: {str(e)}"