chamfer_edge
Chamfer all edges of a selected group or component by a specified distance in millimeters.
Instructions
Chamfer all edges of a group/component by distance (mm).
Default 5mm — visible on the documented 100mm-cube use case. Ruby tool name
is chamfer_edges (plural); Python parameter id maps to Ruby entity_id.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| distance | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/sketchup_mcp/tools.py:268-279 (handler)The `chamfer_edge` async function is the MCP tool handler. It is decorated with @mcp.tool(), accepts `id` (str) and `distance` (float, default 5.0) parameters, and delegates to `_call(ctx, 'chamfer_edges', entity_id=id, distance=distance)`. The docstring notes the Ruby tool name is 'chamfer_edges' (plural) and the Python `id` maps to Ruby `entity_id`.
@mcp.tool() async def chamfer_edge( ctx: Context, id: Annotated[str, Field(min_length=1)], distance: Annotated[float, Field(gt=0)] = 5.0, ) -> str: """Chamfer all edges of a group/component by ``distance`` (mm). Default 5mm — visible on the documented 100mm-cube use case. Ruby tool name is ``chamfer_edges`` (plural); Python parameter ``id`` maps to Ruby ``entity_id``. """ return await _call(ctx, "chamfer_edges", entity_id=id, distance=distance) - src/sketchup_mcp/tools.py:268-273 (schema)Input schema is defined inline via type annotations: `id: Annotated[str, Field(min_length=1)]` and `distance: Annotated[float, Field(gt=0)] = 5.0`. Return type is `str`. The `@mcp.tool()` decorator auto-generates the JSON Schema for MCP.
@mcp.tool() async def chamfer_edge( ctx: Context, id: Annotated[str, Field(min_length=1)], distance: Annotated[float, Field(gt=0)] = 5.0, ) -> str: - src/sketchup_mcp/tools.py:268-268 (registration)Registration is done via the `@mcp.tool()` decorator on the `chamfer_edge` function. The `mcp` FastMCP instance is imported from `sketchup_mcp.app`, and the side-effect import in `app.py` (line 51: `import sketchup_mcp.tools`) ensures tools are registered on the MCP server.
@mcp.tool() - src/sketchup_mcp/tools.py:48-71 (helper)The `_call` helper function centralizes dispatching tool calls to the SketchUp connection. It handles `ConnectionError` and `SketchUpError`, unwraps the response dict, and returns a string. `chamfer_edge` delegates to this with tool_name='chamfer_edges'.
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/tools.py:22-45 (helper)The `_raw_call` helper acquires the connection via `get_connection()` and calls `sketchup.send_command(tool_name, kwargs)`. This is the lowest-level dispatch layer that `_call` delegates to.
async def _raw_call(ctx: Context, tool_name: str, /, **kwargs) -> dict: """Acquire the connection and execute one tools/call. Returns the raw MCP-shaped result dict (``{"content": [...], "isError": False}``). ``tool_name`` is positional-only (PEP 570) so wrappers can forward user kwargs containing a ``name`` key via ``**args`` without colliding with this parameter — see ``find_components`` / ``create_layer`` callers below for the pattern. Does **not** translate :class:`ConnectionError` to anything — that is each caller's responsibility, since callers have divergent strategies for unavailable-server (string-returning tools surface a graceful string, Image-returning tools raise). Centralising the conversion here would introduce brittle string-based detection in callers and lose the canonical error text shared by the 22 existing text-returning tools. See the design's §5.8 for the rationale on error-handling asymmetry between text-returning and Image-returning tools. """ sketchup = await get_connection() # may raise ConnectionError return await sketchup.send_command(tool_name, kwargs) # raises SketchUpError