Skip to main content
Glama

transform_component

Adjust a component's position, rotation, or scale in Sketchup using the SketchupMCP server. Simplify 3D model manipulation by directly modifying component properties.

Instructions

Transform a component's position, rotation, or scale

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
positionNo
rotationNo
scaleNo

Implementation Reference

  • The handler function for the 'transform_component' MCP tool. It connects to the Sketchup extension via a socket, prepares arguments for position, rotation, or scale, and sends a JSON-RPC 'tools/call' request to Sketchup's corresponding tool. Includes error handling and logging.
    @mcp.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)}"
  • The @mcp.tool() decorator registers the transform_component function as an MCP tool, automatically using the function name as the tool name.
    @mcp.tool()
  • The function signature defines the input schema with type hints: required 'id' (str), optional 'position', 'rotation', 'scale' as lists of floats, returning a JSON string.
    def transform_component(
        ctx: Context,
        id: str,
        position: List[float] = None,
        rotation: List[float] = None,
        scale: List[float] = None
    ) -> str:
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/BearNetwork-BRNKC/SketchUp-MCP'

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