create_component
Generate and position 3D components like cubes in Sketchup using specified dimensions and coordinates, enabling direct 3D modeling and scene manipulation through integration with Claude AI.
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' MCP tool. It connects to Sketchup via socket, sends a JSON-RPC 'tools/call' request with the tool name and arguments, and returns the result as JSON string. The function signature defines the input schema (type, position, dimensions). The @mcp.tool() decorator handles registration.@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)}"