create_component
Generate and insert a 3D component in SketchUp by specifying dimensions, position, and type. Integrates with Claude AI via SketchupMCP for precise, prompt-driven modeling tasks.
Instructions
Create a new component in Sketchup
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dimensions | No | ||
| position | No | ||
| type | No | cube |
Implementation Reference
- src/sketchup_mcp/server.py:256-290 (handler)The handler function for the 'create_component' tool. It is registered via the @mcp.tool() decorator. The function proxies the tool call to SketchUp's own 'create_component' tool by sending a JSON-RPC request over a socket connection.@mcp.tool() def create_component( ctx: Context, type: str = "cube", position: List[float] = None, dimensions: List[float] = None ) -> str: """Create a new component in Sketchup""" try: logger.info(f"create_component called with type={type}, position={position}, dimensions={dimensions}, request_id={ctx.request_id}") sketchup = get_sketchup_connection() params = { "name": "create_component", "arguments": { "type": type, "position": position or [0,0,0], "dimensions": dimensions or [1,1,1] } } logger.info(f"Calling send_command with method='tools/call', params={params}, request_id={ctx.request_id}") result = sketchup.send_command( method="tools/call", params=params, request_id=ctx.request_id ) logger.info(f"create_component result: {result}") return json.dumps(result) except Exception as e: logger.error(f"Error in create_component: {str(e)}") return f"Error creating component: {str(e)}"