create_component
Add a new component to a SketchUp model by specifying its type (cube, cylinder, cone, sphere), position, and dimensions.
Instructions
Create a new component in Sketchup.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | cube | |
| position | No | ||
| dimensions | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/sketchup_mcp/tools.py:74-91 (handler)The tool handler for create_component. Decorated with @mcp.tool(), it accepts type (cube/cylinder/cone/sphere), position (3 floats), and dimensions (3 positive floats). Delegates to _call() which sends the JSON-RPC command "create_component" to the SketchUp Ruby extension via TCP socket.
@mcp.tool() async def create_component( ctx: Context, type: Literal["cube", "cylinder", "cone", "sphere"] = "cube", position: Annotated[list[float], Field(min_length=3, max_length=3)] = [0, 0, 0], dimensions: Annotated[ list[Annotated[float, Field(gt=0)]], Field(min_length=3, max_length=3), ] = [1, 1, 1], ) -> str: """Create a new component in Sketchup.""" return await _call( ctx, "create_component", type=type, position=position, dimensions=dimensions, ) - src/sketchup_mcp/tools.py:77-82 (schema)Input schema definitions for create_component — typed Literal for shape type, position vector [x,y,z], and dimensions vector [width,depth,height] with all-positive constraints.
type: Literal["cube", "cylinder", "cone", "sphere"] = "cube", position: Annotated[list[float], Field(min_length=3, max_length=3)] = [0, 0, 0], dimensions: Annotated[ list[Annotated[float, Field(gt=0)]], Field(min_length=3, max_length=3), ] = [1, 1, 1], - src/sketchup_mcp/tools.py:74-74 (registration)Registration via @mcp.tool() decorator on the create_component async function, registering it with the FastMCP application instance. The import of sketchup_mcp.tools in app.py (line 51) ensures tools are registered.
@mcp.tool()