list_components
List groups and component instances in a SketchUp model, returning their IDs, names, types, layers, depths, and bounding boxes. Optionally recurse into nested components with a configurable maximum depth.
Instructions
List groups and component instances in the model.
Returns each as {id, name, type, layer, depth, bbox_mm}. Bounds are in world coordinates. Set recursive=true to descend into nested components (bounded by max_depth, default 3).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recursive | No | ||
| max_depth | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/sketchup_mcp/tools.py:386-398 (handler)The handler function for the 'list_components' tool. It is registered via @mcp.tool() decorator, accepts optional recursive (bool) and max_depth (int, 1-10) parameters, and delegates to _call() which sends the command to the SketchUp Ruby backend.
@mcp.tool() async def list_components( ctx: Context, recursive: bool = False, max_depth: Annotated[int, Field(ge=1, le=10)] = 3, ) -> str: """List groups and component instances in the model. Returns each as {id, name, type, layer, depth, bbox_mm}. Bounds are in world coordinates. Set recursive=true to descend into nested components (bounded by max_depth, default 3). """ return await _call(ctx, "list_components", recursive=recursive, max_depth=max_depth) - src/sketchup_mcp/tools.py:389-390 (schema)Input schema/parameters for list_components: recursive (bool, default False) and max_depth (int, ge=1 le=10, default 3).
recursive: bool = False, max_depth: Annotated[int, Field(ge=1, le=10)] = 3, - src/sketchup_mcp/tools.py:386-386 (registration)The tool is registered via the @mcp.tool() decorator on the list_components function. The 'mcp' FastMCP instance is imported from sketchup_mcp.app (line 15), and tools.py is imported as a side-effect in app.py (line 51) to ensure registration happens on startup.
@mcp.tool() - src/sketchup_mcp/tools.py:48-71 (helper)The _call() helper function that list_components delegates to. It acquires the connection, sends the command, and formats the response as a string.
async def _call(ctx: Context, tool_name: str, /, **kwargs) -> str: """Dispatch a tool call to SketchUp and shape the response for Claude. Same external contract as before — kept for compatibility with the 22 existing string-returning tools. Now delegates to :func:`_raw_call` for connection acquisition and converts the result to a string. Connection failures surface as the canonical legacy string so the LLM sees a stable, actionable hint. """ try: result = await _raw_call(ctx, tool_name, **kwargs) except ConnectionError as e: return f"SketchUp not running or extension not started: {e}" except SketchUpError as e: return format_error(e, debug=config.LOG_LEVEL == "DEBUG") content = result.get("content") if isinstance(result, dict) else None if ( isinstance(content, list) and content and isinstance(content[0], dict) and "text" in content[0] ): return content[0]["text"] return json.dumps(result) - src/sketchup_mcp/connection.py:46-46 (registration)list_components is listed in _RETRY_SAFE_TOOLS (read-only whitelist), so connection retries are allowed for this tool.
"list_components",