Skip to content

solidworks_mcp.tools.sketching

solidworks_mcp.tools.sketching

Sketching tools for SolidWorks MCP Server.

Provides tools for creating and editing sketches, including geometric entities like lines, circles, rectangles, arcs, and constraints.

Attributes

SketchPoint module-attribute

SketchPoint = Annotated[list[float], Field(min_length=2, max_length=2)]

TInput module-attribute

TInput = TypeVar('TInput', bound=BaseModel)

Classes

AddArcInput

Bases: BaseModel

Input schema for adding an arc to sketch.

Attributes:

Name Type Description
kind str

center, three_point or tangent.

center_x float | None

The center x value (center).

center_y float | None

The center y value (center).

end_x float

The end x value.

end_y float

The end y value.

start_x float

The start x value.

start_y float

The start y value.

through_x float | None

A point on the arc, x (three_point).

through_y float | None

A point on the arc, y (three_point).

AddCircleInput

Bases: CompatInput

Input schema for adding a circle to sketch.

Attributes:

Name Type Description
center_x float

The center x value.

center_y float

The center y value.

construction bool

The construction value.

radius float

The radius value.

Methods:
model_post_init
model_post_init(__context: Any) -> None

Provide model post init support for the add circle input.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Returns:

Name Type Description
None None

None.

Raises:

Type Description
ValueError

Radius must be positive.

Source code in src/solidworks_mcp/tools/sketching.py
def model_post_init(self, __context: Any) -> None:
    """Provide model post init support for the add circle input.

    Args:
        __context (Any): The context value.

    Returns:
        None: None.

    Raises:
        ValueError: Radius must be positive.
    """
    if self.radius <= 0:
        raise ValueError("radius must be positive")

AddDimensionInput

Bases: BaseModel

Input schema for adding a dimension to sketch.

Attributes:

Name Type Description
dimension_type str

The dimension type value.

entity1 str

The entity1 value.

entity2 str | None

The entity2 value.

value float

The value value.

AddLineInput

Bases: CompatInput

Input schema for adding a line to sketch.

Attributes:

Name Type Description
construction bool

The construction value.

end_x float | None

The end x value.

end_y float | None

The end y value.

start_x float | None

The start x value.

start_y float | None

The start y value.

x1 float | None

The x1 value.

x2 float | None

The x2 value.

y1 float | None

The y1 value.

y2 float | None

The y2 value.

Methods:
model_post_init
model_post_init(__context: Any) -> None

Provide model post init support for the add line input.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/tools/sketching.py
def model_post_init(self, __context: Any) -> None:
    """Provide model post init support for the add line input.

    Args:
        __context (Any): The context value.

    Returns:
        None: None.
    """
    self.x1 = self.x1 if self.x1 is not None else self.start_x
    self.y1 = self.y1 if self.y1 is not None else self.start_y
    self.x2 = self.x2 if self.x2 is not None else self.end_x
    self.y2 = self.y2 if self.y2 is not None else self.end_y

AddRectangleInput

Bases: CompatInput

Input schema for adding a rectangle to sketch.

Attributes:

Name Type Description
construction bool

The construction value.

from_center bool

x1/y1 is the centre, x2/y2 a corner.

corner1_x float | None

The corner1 x value.

corner1_y float | None

The corner1 y value.

corner2_x float | None

The corner2 x value.

corner2_y float | None

The corner2 y value.

x1 float | None

The x1 value.

x2 float | None

The x2 value.

y1 float | None

The y1 value.

y2 float | None

The y2 value.

Methods:
model_post_init
model_post_init(__context: Any) -> None

Provide model post init support for the add rectangle input.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Returns:

Name Type Description
None None

None.

Raises:

Type Description
ValueError

Rectangle corners must differ.

Source code in src/solidworks_mcp/tools/sketching.py
def model_post_init(self, __context: Any) -> None:
    """Provide model post init support for the add rectangle input.

    Args:
        __context (Any): The context value.

    Returns:
        None: None.

    Raises:
        ValueError: Rectangle corners must differ.
    """
    self.x1 = self.x1 if self.x1 is not None else self.corner1_x
    self.y1 = self.y1 if self.y1 is not None else self.corner1_y
    self.x2 = self.x2 if self.x2 is not None else self.corner2_x
    self.y2 = self.y2 if self.y2 is not None else self.corner2_y
    if (
        None not in (self.x1, self.y1, self.x2, self.y2)
        and self.x1 == self.x2
        and self.y1 == self.y2
    ):
        raise ValueError("rectangle corners must differ")

AddRelationInput

Bases: BaseModel

Input schema for adding a geometric relation.

Attributes:

Name Type Description
entity1 str

The entity1 value.

entity2 str | None

The entity2 value.

entity3 str | None

Third entity ID — only used by the symmetric relation (the centerline of symmetry). All other relation types reject a non-null entity3.

relation_type str

The relation type value.

AddSketchChamferInput

Bases: CompatInput

Input schema for bevelling sketch corners.

Attributes:

Name Type Description
corners list[list[float]]

Corners, [x, y] sketch mm.

distance float

Distance along the first side, mm.

distance2 float | None

Distance along the second side, mm.

angle float | None

Angle from the first side, degrees.

AddSketchFilletInput

Bases: CompatInput

Input schema for rounding sketch corners.

Attributes:

Name Type Description
corners list[list[float]]

Corners, [x, y] sketch mm.

radius float

Fillet radius in mm.

AddSketchTextInput

Bases: CompatInput

Input schema for adding text to the open sketch.

Attributes:

Name Type Description
text str

The text; $PRP:"name" shows a custom property.

x float

Start x in mm (sketch coordinates).

y float

Start y (baseline) in mm.

height float

Letter height in mm.

center_at list[float] | None

A model point [x, y, z] in mm for the text's middle.

AddSlotInput

Bases: CompatInput

Input schema for drawing a slot.

Attributes:

Name Type Description
kind str

straight or arc.

width float

Slot width in mm.

start list[float]

Straight: first end's centre; arc: start on the arc.

end list[float]

Straight: second end's centre; arc: end on the arc.

center list[float] | None

Arc: the centre of the arc it follows.

AddSplineInput

Bases: BaseModel

Input schema for adding a spline to sketch.

Attributes:

Name Type Description
points list[dict[str, float]]

The points value.

CheckSketchDefinitionInput

Bases: CompatInput

Input schema for checking sketch definition status.

Attributes:

Name Type Description
sketch_name str | None

Optional sketch name to inspect.

CompatInput

Bases: BaseModel

Base schema allowing legacy/extra fields used by existing tests.

Attributes:

Name Type Description
model_config Any

The model config value.

CreateSketchInput

Bases: CompatInput

Input schema for creating a sketch.

Attributes:

Name Type Description
plane str | None

The plane to sketch on.

face_point list[float] | None

A point on a flat face to sketch on instead.

sketch_name str | None

The sketch name value.

Methods:
model_post_init
model_post_init(__context: Any) -> None

Require exactly one of plane and face_point.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Raises:

Type Description
ValueError

When both or neither are given, or face_point is not three numbers.

Source code in src/solidworks_mcp/tools/sketching.py
def model_post_init(self, __context: Any) -> None:
    """Require exactly one of ``plane`` and ``face_point``.

    Args:
        __context (Any): The context value.

    Raises:
        ValueError: When both or neither are given, or ``face_point`` is not
            three numbers.
    """
    has_plane = bool((self.plane or "").strip())
    if has_plane == (self.face_point is not None):
        raise ValueError("give exactly one of plane and face_point")
    if self.face_point is not None and len(self.face_point) != 3:
        raise ValueError("face_point must be [x, y, z] in millimetres")

SetConstructionGeometryInput

Bases: CompatInput

Input schema for making entities construction geometry.

Attributes:

Name Type Description
entities list[str]

Sketch entity ids.

construction bool

Construction (True) or normal (False).

SetSketchTextInput

Bases: CompatInput

Input schema for rewriting the text in a sketch.

Attributes:

Name Type Description
sketch_name str

The sketch whose text to rewrite.

text str

The new text.

SketchConvertEntitiesInput

Bases: CompatInput

Input schema for copying model edges into the open sketch.

Attributes:

Name Type Description
edge_points list[list[float]]

A point in mm on each edge to copy.

face_point list[float] | None

A point in mm on a face whose outline to copy.

construction bool

Make the copies construction geometry.

SketchPointInput

Bases: CompatInput

Input schema for trimming or extending at a point.

Attributes:

Name Type Description
point list[float]

[x, y] sketch mm on the entity.

SolidWorksAdapter

SolidWorksAdapter(config: object | None = None)

Bases: ABC

Base adapter interface for SolidWorks integration.

Parameters:

Name Type Description Default
config object | None

Configuration values for the operation. Defaults to None.

None

Attributes:

Name Type Description
_metrics Any

The metrics value.

config Any

The config value.

config_dict Any

The config dict value.

Initialize adapter with configuration.

Parameters:

Name Type Description Default
config object | None

Configuration values for the operation. Defaults to None.

None
Source code in src/solidworks_mcp/adapters/base.py
def __init__(self, config: object | None = None):
    """Initialize adapter with configuration.

    Args:
        config (object | None): Configuration values for the operation. Defaults to None.
    """
    if config is None:
        normalized_config: dict[str, Any] = {}
    elif isinstance(config, Mapping):
        normalized_config = dict(config)
    elif hasattr(config, "model_dump"):
        normalized_config = dict(config.model_dump())
    else:
        normalized_config = {}

    # Preserve original config object for compatibility with tests and
    # call sites that compare object identity/equality.
    self.config = config
    # Keep a normalized mapping for adapter internals.
    self.config_dict = normalized_config
    self._metrics = {
        "operations_count": 0,
        "errors_count": 0,
        "average_response_time": 0.0,
    }
    # SolidWorks-as-Code session logging. Set soc_session_id to enable
    # automatic ToolCallRecord writes for every adapter operation.
    self.soc_session_id: str | None = None
    self.soc_db_path: Path | None = None
Methods:
activate_configuration async
activate_configuration(name: str) -> AdapterResult[dict[str, Any]]

Make a configuration active.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def activate_configuration(
    self,
    name: str,
) -> AdapterResult[dict[str, Any]]:
    """Make a configuration active.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="activate_configuration is not implemented by this adapter",
    )
activate_document async
activate_document(title_or_path: str) -> AdapterResult[dict[str, Any]]

Make an already-open document the active one.

Parameters:

Name Type Description Default
title_or_path str

Title, full path, or file name of an open document.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: What was activated, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def activate_document(
    self, title_or_path: str
) -> AdapterResult[dict[str, Any]]:
    """Make an already-open document the active one.

    Args:
        title_or_path (str): Title, full path, or file name of an open
            document.

    Returns:
        AdapterResult[dict[str, Any]]: What was activated, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="activate_document is not implemented by this adapter",
    )
active_configuration async
active_configuration() -> AdapterResult[str]

Read the active configuration's name.

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def active_configuration(
    self,
) -> AdapterResult[str]:
    """Read the active configuration's name.

    Returns:
        AdapterResult[str]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="active_configuration is not implemented by this adapter",
    )
add_arc async
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float, kind: str = 'center', through: tuple[float, float] | None = None) -> AdapterResult[str]

Add an arc to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
start_x float

The start x value.

required
start_y float

The start y value.

required
end_x float

The end x value.

required
end_y float

The end y value.

required
kind str

center, three_point or tangent.

'center'
through tuple[float, float] | None

A point on a three-point arc.

None

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_arc(
    self,
    center_x: float,
    center_y: float,
    start_x: float,
    start_y: float,
    end_x: float,
    end_y: float,
    kind: str = "center",
    through: tuple[float, float] | None = None,
) -> AdapterResult[str]:
    """Add an arc to the current sketch.

    Args:
        center_x (float): The center x value.
        center_y (float): The center y value.
        start_x (float): The start x value.
        start_y (float): The start y value.
        end_x (float): The end x value.
        end_y (float): The end y value.
        kind (str): ``center``, ``three_point`` or ``tangent``.
        through (tuple[float, float] | None): A point on a three-point arc.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_arc is not implemented by this adapter",
    )
add_balloons async
add_balloons(view_name: str, layout: str = 'square') -> AdapterResult[dict[str, Any]]

Number a drawing view's parts with balloons, one per part.

Parameters:

Name Type Description Default
view_name str

The drawing view.

required
layout str

square, circle, top, bottom, left or right.

'square'

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_balloons(
    self, view_name: str, layout: str = "square"
) -> AdapterResult[dict[str, Any]]:
    """Number a drawing view's parts with balloons, one per part.

    Args:
        view_name (str): The drawing view.
        layout (str): ``square``, ``circle``, ``top``, ``bottom``, ``left`` or ``right``.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_balloons is not implemented by this adapter",
    )
add_centerline async
add_centerline(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add a centerline to the current sketch.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_centerline(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add a centerline to the current sketch.

    Args:
        x1 (float): The x1 value.
        y1 (float): The y1 value.
        x2 (float): The x2 value.
        y2 (float): The y2 value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_centerline is not implemented by this adapter",
    )
add_chamfer async
add_chamfer(distance: float, edge_names: list[str], angle: float = 45.0, flip: bool = False) -> AdapterResult[Any]

Add an angle-distance chamfer to the named or selected edges.

At the default 45 degrees both legs equal distance.

Parameters:

Name Type Description Default
distance float

Chamfer distance in millimeters, along one face.

required
edge_names list[str]

List of edge names to chamfer.

required
angle float

Chamfer angle in degrees. Defaults to 45.

45.0
flip bool

Measure distance along the other face.

False

Returns:

Name Type Description
AdapterResult AdapterResult[Any]

Feature result or error.

Source code in src/solidworks_mcp/adapters/base.py
async def add_chamfer(
    self,
    distance: float,
    edge_names: list[str],
    angle: float = 45.0,
    flip: bool = False,
) -> AdapterResult[Any]:
    """Add an angle-distance chamfer to the named or selected edges.

    At the default 45 degrees both legs equal ``distance``.

    Args:
        distance (float): Chamfer distance in millimeters, along one face.
        edge_names (list[str]): List of edge names to chamfer.
        angle (float): Chamfer angle in degrees. Defaults to 45.
        flip (bool): Measure ``distance`` along the other face.

    Returns:
        AdapterResult: Feature result or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_chamfer is not implemented by this adapter",
    )
add_circle abstractmethod async
add_circle(center_x: float, center_y: float, radius: float) -> AdapterResult[str]

Add a circle to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
radius float

The radius value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def add_circle(
    self, center_x: float, center_y: float, radius: float
) -> AdapterResult[str]:
    """Add a circle to the current sketch.

    Args:
        center_x (float): The center x value.
        center_y (float): The center y value.
        radius (float): The radius value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    pass
add_cosmetic_thread async
add_cosmetic_thread(edge_point: list[float], size: str, diameter: float, end_type: str = 'blind', depth: float | None = None, standard: str = 'iso') -> AdapterResult[dict[str, Any]]

Add a cosmetic thread on a circular edge.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def add_cosmetic_thread(
    self,
    edge_point: list[float],
    size: str,
    diameter: float,
    end_type: str = "blind",
    depth: float | None = None,
    standard: str = "iso",
) -> AdapterResult[dict[str, Any]]:
    """Add a cosmetic thread on a circular edge.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_cosmetic_thread is not implemented by this adapter",
    )
add_datum_tag async
add_datum_tag(label: str, attach_at_mm: tuple[float, float], x_mm: float, y_mm: float) -> AdapterResult[dict[str, Any]]

Add a datum feature symbol on a drawing edge.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def add_datum_tag(
    self,
    label: str,
    attach_at_mm: tuple[float, float],
    x_mm: float,
    y_mm: float,
) -> AdapterResult[dict[str, Any]]:
    """Add a datum feature symbol on a drawing edge.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_datum_tag is not implemented by this adapter",
    )
add_dimension async
add_dimension(dimension_type: str, entity1_point: list[float], position: list[float], entity2_point: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Add one dimension between drawing entities picked at sheet points.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def add_dimension(
    self,
    dimension_type: str,
    entity1_point: list[float],
    position: list[float],
    entity2_point: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add one dimension between drawing entities picked at sheet points.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_dimension is not implemented by this adapter",
    )
add_draft async
add_draft(angle: float, faces: list[list[float]], neutral_face: list[float], reverse: bool = False) -> AdapterResult[dict[str, Any]]

Draft faces against a neutral face.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def add_draft(
    self,
    angle: float,
    faces: list[list[float]],
    neutral_face: list[float],
    reverse: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Draft faces against a neutral face.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_draft is not implemented by this adapter",
    )
add_drawing_view async
add_drawing_view(payload: Any = None) -> AdapterResult[dict[str, Any]]

Add a view of a model to the active drawing sheet.

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the model path, orientation, position in millimetres and optional view scale.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The new view's details, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def add_drawing_view(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Add a view of a model to the active drawing sheet.

    Args:
        payload (Any): Tool payload carrying the model path, orientation,
            position in millimetres and optional view scale.

    Returns:
        AdapterResult[dict[str, Any]]: The new view's details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_drawing_view is not implemented by this adapter",
    )
add_edge_flange async
add_edge_flange(edge_point: list[float], length: float, angle: float = 90.0, bend_radius: float | None = None, flip: bool = False) -> AdapterResult[dict[str, Any]]

A flange off the sheet edge nearest a point.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def add_edge_flange(
    self,
    edge_point: list[float],
    length: float,
    angle: float = 90.0,
    bend_radius: float | None = None,
    flip: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """A flange off the sheet edge nearest a point.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_edge_flange is not implemented by this adapter",
    )
add_ellipse async
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float, angle: float = 0.0) -> AdapterResult[str]

Add an ellipse to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
major_axis float

The major axis value.

required
minor_axis float

The minor axis value.

required
angle float

The major axis's turn from +x, in degrees.

0.0

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_ellipse(
    self,
    center_x: float,
    center_y: float,
    major_axis: float,
    minor_axis: float,
    angle: float = 0.0,
) -> AdapterResult[str]:
    """Add an ellipse to the current sketch.

    Args:
        center_x (float): The center x value.
        center_y (float): The center y value.
        major_axis (float): The major axis value.
        minor_axis (float): The minor axis value.
        angle (float): The major axis's turn from +x, in degrees.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_ellipse is not implemented by this adapter",
    )
add_fillet async
add_fillet(radius: float, edge_names: list[str]) -> AdapterResult[Any]

Add a fillet feature to selected edges.

Rounds the selected edges of the current solid body with the given radius.

Parameters:

Name Type Description Default
radius float

Fillet radius in millimeters.

required
edge_names list[str]

List of edge names to fillet.

required

Returns:

Name Type Description
AdapterResult AdapterResult[Any]

Feature result or error.

Source code in src/solidworks_mcp/adapters/base.py
async def add_fillet(
    self, radius: float, edge_names: list[str]
) -> AdapterResult[Any]:
    """Add a fillet feature to selected edges.

    Rounds the selected edges of the current solid body with the given radius.

    Args:
        radius (float): Fillet radius in millimeters.
        edge_names (list[str]): List of edge names to fillet.

    Returns:
        AdapterResult: Feature result or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_fillet is not implemented by this adapter",
    )
add_gtol async
add_gtol(characteristic: str, tolerance: float, x_mm: float, y_mm: float, diameter_zone: bool = False, material_condition: str = 'none', datums: list[str] | None = None, attach_at_mm: tuple[float, float] | None = None, dimension: tuple[str, str] | None = None) -> AdapterResult[dict[str, Any]]

Add a GD&T feature control frame to the active drawing.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def add_gtol(
    self,
    characteristic: str,
    tolerance: float,
    x_mm: float,
    y_mm: float,
    diameter_zone: bool = False,
    material_condition: str = "none",
    datums: list[str] | None = None,
    attach_at_mm: tuple[float, float] | None = None,
    dimension: tuple[str, str] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add a GD&T feature control frame to the active drawing.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_gtol is not implemented by this adapter",
    )
add_line abstractmethod async
add_line(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add a line to the current sketch.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def add_line(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add a line to the current sketch.

    Args:
        x1 (float): The x1 value.
        y1 (float): The y1 value.
        x2 (float): The x2 value.
        y2 (float): The y2 value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    pass
add_mate async
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0, face_a: list[float] | None = None, face_b: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Mate two components together in the active assembly.

Parameters:

Name Type Description Default
component_a str

First component instance name.

required
component_b str

Second component instance name.

required
entity_a str

Named feature on the first component. Defaults to "Front Plane".

'Front Plane'
entity_b str

Named feature on the second component. Defaults to "Front Plane".

'Front Plane'
mate_type str

Mate type, e.g. coincident. Defaults to "coincident".

'coincident'
alignment str

aligned, anti_aligned or closest. Defaults to "aligned".

'aligned'
distance float

Distance in millimetres, for a distance mate. Defaults to 0.0.

0.0
angle float

Angle in degrees, for an angle mate. Defaults to 0.0.

0.0
face_a list[float] | None

A point on a face of the first component, in its part coordinates (mm), used instead of entity_a.

None
face_b list[float] | None

The same for the second component.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Mate details, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def add_mate(
    self,
    component_a: str,
    component_b: str,
    entity_a: str = "Front Plane",
    entity_b: str = "Front Plane",
    mate_type: str = "coincident",
    alignment: str = "aligned",
    distance: float = 0.0,
    angle: float = 0.0,
    face_a: list[float] | None = None,
    face_b: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Mate two components together in the active assembly.

    Args:
        component_a (str): First component instance name.
        component_b (str): Second component instance name.
        entity_a (str): Named feature on the first component. Defaults to
            "Front Plane".
        entity_b (str): Named feature on the second component. Defaults to
            "Front Plane".
        mate_type (str): Mate type, e.g. ``coincident``. Defaults to
            "coincident".
        alignment (str): ``aligned``, ``anti_aligned`` or ``closest``.
            Defaults to "aligned".
        distance (float): Distance in millimetres, for a distance mate.
            Defaults to 0.0.
        angle (float): Angle in degrees, for an angle mate. Defaults to 0.0.
        face_a (list[float] | None): A point on a face of the first
            component, in its part coordinates (mm), used instead of
            ``entity_a``.
        face_b (list[float] | None): The same for the second component.

    Returns:
        AdapterResult[dict[str, Any]]: Mate details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_mate is not implemented by this adapter",
    )
add_note async
add_note(payload: Any = None) -> AdapterResult[dict[str, Any]]

Place a text note on the active drawing sheet.

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the note text, its position in millimetres and an optional font size in points.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The note's details, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def add_note(self, payload: Any = None) -> AdapterResult[dict[str, Any]]:
    """Place a text note on the active drawing sheet.

    Args:
        payload (Any): Tool payload carrying the note text, its position in
            millimetres and an optional font size in points.

    Returns:
        AdapterResult[dict[str, Any]]: The note's details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_note is not implemented by this adapter",
    )
add_polygon async
add_polygon(center_x: float, center_y: float, radius: float, sides: int, angle: float = 0.0) -> AdapterResult[str]

Add a regular polygon to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
radius float

The radius value.

required
sides int

The sides value.

required
angle float

Degrees the first vertex is turned from +x.

0.0

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_polygon(
    self,
    center_x: float,
    center_y: float,
    radius: float,
    sides: int,
    angle: float = 0.0,
) -> AdapterResult[str]:
    """Add a regular polygon to the current sketch.

    Args:
        center_x (float): The center x value.
        center_y (float): The center y value.
        radius (float): The radius value.
        sides (int): The sides value.
        angle (float): Degrees the first vertex is turned from +x.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_polygon is not implemented by this adapter",
    )
add_rectangle abstractmethod async
add_rectangle(x1: float, y1: float, x2: float, y2: float, from_center: bool = False) -> AdapterResult[str]

Add a rectangle to the current sketch.

Parameters:

Name Type Description Default
x1 float

The x1 value (the centre's, with from_center).

required
y1 float

The y1 value (the centre's, with from_center).

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required
from_center bool

x1/y1 is the centre, x2/y2 a corner.

False

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def add_rectangle(
    self, x1: float, y1: float, x2: float, y2: float, from_center: bool = False
) -> AdapterResult[str]:
    """Add a rectangle to the current sketch.

    Args:
        x1 (float): The x1 value (the centre's, with ``from_center``).
        y1 (float): The y1 value (the centre's, with ``from_center``).
        x2 (float): The x2 value.
        y2 (float): The y2 value.
        from_center (bool): ``x1``/``y1`` is the centre, ``x2``/``y2`` a corner.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    pass
add_sketch_chamfer async
add_sketch_chamfer(corners: list[list[float]], distance: float, distance2: float | None = None, angle: float | None = None) -> AdapterResult[dict[str, Any]]

Bevel sketch corners picked by point.

Parameters:

Name Type Description Default
corners list[list[float]]

[x, y] sketch mm, one per corner.

required
distance float

Distance along the first side, mm.

required
distance2 float | None

Distance along the second side, mm.

None
angle float | None

Angle from the first side, degrees.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: ids (one per corner) and corners.

Source code in src/solidworks_mcp/adapters/base.py
async def add_sketch_chamfer(
    self,
    corners: list[list[float]],
    distance: float,
    distance2: float | None = None,
    angle: float | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Bevel sketch corners picked by point.

    Args:
        corners (list[list[float]]): ``[x, y]`` sketch mm, one per corner.
        distance (float): Distance along the first side, mm.
        distance2 (float | None): Distance along the second side, mm.
        angle (float | None): Angle from the first side, degrees.

    Returns:
        AdapterResult[dict[str, Any]]: ``ids`` (one per corner) and ``corners``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_sketch_chamfer is not implemented by this adapter",
    )
add_sketch_circle async
add_sketch_circle(center_x: float, center_y: float, radius: float, construction: bool = False) -> AdapterResult[str]

Alias for add_circle used by some tool flows.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
radius float

The radius value.

required
construction bool

The construction value. Defaults to False.

False

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_sketch_circle(
    self,
    center_x: float,
    center_y: float,
    radius: float,
    construction: bool = False,
) -> AdapterResult[str]:
    """Alias for add_circle used by some tool flows.

    Args:
        center_x (float): The center x value.
        center_y (float): The center y value.
        radius (float): The radius value.
        construction (bool): The construction value. Defaults to False.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self.add_circle(center_x, center_y, radius)
add_sketch_constraint async
add_sketch_constraint(entity1: str, entity2: str | None, relation_type: str, entity3: str | None = None) -> AdapterResult[str]

Apply a geometric constraint between sketch entities.

Parameters:

Name Type Description Default
entity1 str

The entity1 value.

required
entity2 str | None

The entity2 value.

required
relation_type str

The relation type value.

required
entity3 str | None

Third entity ID — only used by the symmetric relation (the centerline of symmetry). All other relation types reject a non-null entity3.

None

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_sketch_constraint(
    self,
    entity1: str,
    entity2: str | None,
    relation_type: str,
    entity3: str | None = None,
) -> AdapterResult[str]:
    """Apply a geometric constraint between sketch entities.

    Args:
        entity1 (str): The entity1 value.
        entity2 (str | None): The entity2 value.
        relation_type (str): The relation type value.
        entity3 (str | None): Third entity ID — only used by the
            ``symmetric`` relation (the centerline of symmetry). All
            other relation types reject a non-null ``entity3``.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_sketch_constraint is not implemented by this adapter",
    )
add_sketch_dimension async
add_sketch_dimension(entity1: str, entity2: str | None, dimension_type: str, value: float) -> AdapterResult[str]

Add a sketch dimension.

Parameters:

Name Type Description Default
entity1 str

The entity1 value.

required
entity2 str | None

The entity2 value.

required
dimension_type str

The dimension type value.

required
value float

The value value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_sketch_dimension(
    self,
    entity1: str,
    entity2: str | None,
    dimension_type: str,
    value: float,
) -> AdapterResult[str]:
    """Add a sketch dimension.

    Args:
        entity1 (str): The entity1 value.
        entity2 (str | None): The entity2 value.
        dimension_type (str): The dimension type value.
        value (float): The value value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_sketch_dimension is not implemented by this adapter",
    )
add_sketch_fillet async
add_sketch_fillet(corners: list[list[float]], radius: float) -> AdapterResult[dict[str, Any]]

Round sketch corners picked by point.

Parameters:

Name Type Description Default
corners list[list[float]]

[x, y] sketch mm, one per corner.

required
radius float

Fillet radius in mm.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: ids (one per corner) and corners.

Source code in src/solidworks_mcp/adapters/base.py
async def add_sketch_fillet(
    self, corners: list[list[float]], radius: float
) -> AdapterResult[dict[str, Any]]:
    """Round sketch corners picked by point.

    Args:
        corners (list[list[float]]): ``[x, y]`` sketch mm, one per corner.
        radius (float): Fillet radius in mm.

    Returns:
        AdapterResult[dict[str, Any]]: ``ids`` (one per corner) and ``corners``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_sketch_fillet is not implemented by this adapter",
    )
add_sketch_text async
add_sketch_text(text: str, x: float = 0.0, y: float = 0.0, height: float = 3.5, center_at: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Add text to the current sketch.

Parameters:

Name Type Description Default
text str

The text; $PRP:"name" shows a custom property.

required
x float

Start x in mm (sketch coordinates).

0.0
y float

Start y in mm (the baseline).

0.0
height float

Letter height in mm.

3.5
center_at list[float] | None

A model point [x, y, z] in mm for the text's middle.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: id, text and height.

Source code in src/solidworks_mcp/adapters/base.py
async def add_sketch_text(
    self,
    text: str,
    x: float = 0.0,
    y: float = 0.0,
    height: float = 3.5,
    center_at: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add text to the current sketch.

    Args:
        text (str): The text; ``$PRP:"name"`` shows a custom property.
        x (float): Start x in mm (sketch coordinates).
        y (float): Start y in mm (the baseline).
        height (float): Letter height in mm.
        center_at (list[float] | None): A model point [x, y, z] in mm for
            the text's middle.

    Returns:
        AdapterResult[dict[str, Any]]: ``id``, ``text`` and ``height``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_sketch_text is not implemented by this adapter",
    )
add_slot async
add_slot(kind: str, width: float, start: list[float], end: list[float], center: list[float] | None = None) -> AdapterResult[str]

Draw a straight or arc slot.

Parameters:

Name Type Description Default
kind str

straight or arc.

required
width float

Slot width, mm.

required
start list[float]

Straight: first arc centre; arc: start on the arc.

required
end list[float]

Straight: second arc centre; arc: end on the arc.

required
center list[float] | None

Arc slot: the arc's centre.

None

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The slot's id.

Source code in src/solidworks_mcp/adapters/base.py
async def add_slot(
    self,
    kind: str,
    width: float,
    start: list[float],
    end: list[float],
    center: list[float] | None = None,
) -> AdapterResult[str]:
    """Draw a straight or arc slot.

    Args:
        kind (str): ``straight`` or ``arc``.
        width (float): Slot width, mm.
        start (list[float]): Straight: first arc centre; arc: start on the arc.
        end (list[float]): Straight: second arc centre; arc: end on the arc.
        center (list[float] | None): Arc slot: the arc's centre.

    Returns:
        AdapterResult[str]: The slot's id.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_slot is not implemented by this adapter",
    )
add_spline async
add_spline(points: list[dict[str, float]]) -> AdapterResult[str]

Add a spline through the provided points.

Parameters:

Name Type Description Default
points list[dict[str, float]]

The points value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def add_spline(self, points: list[dict[str, float]]) -> AdapterResult[str]:
    """Add a spline through the provided points.

    Args:
        points (list[dict[str, float]]): The points value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_spline is not implemented by this adapter",
    )
arrange_dimensions async
arrange_dimensions(view_name: str | None = None) -> AdapterResult[dict[str, Any]]

Move drawing dimensions so none overlaps, then verify.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def arrange_dimensions(
    self,
    view_name: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Move drawing dimensions so none overlaps, then verify.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="arrange_dimensions is not implemented by this adapter",
    )
auto_center_marks async
auto_center_marks(view_name: str, mark_holes: bool = True, mark_fillets: bool = False, mark_slots: bool = True) -> AdapterResult[dict[str, Any]]

Auto-insert centre marks on circular features in a drawing view.

Parameters:

Name Type Description Default
view_name str

Name of a view on the active drawing.

required
mark_holes bool

Mark holes / bores.

True
mark_fillets bool

Mark fillets.

False
mark_slots bool

Mark slots.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The view and before/after centre-mark

AdapterResult[dict[str, Any]]

counts, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def auto_center_marks(
    self,
    view_name: str,
    mark_holes: bool = True,
    mark_fillets: bool = False,
    mark_slots: bool = True,
) -> AdapterResult[dict[str, Any]]:
    """Auto-insert centre marks on circular features in a drawing view.

    Args:
        view_name (str): Name of a view on the active drawing.
        mark_holes (bool): Mark holes / bores.
        mark_fillets (bool): Mark fillets.
        mark_slots (bool): Mark slots.

    Returns:
        AdapterResult[dict[str, Any]]: The view and before/after centre-mark
        counts, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="auto_center_marks is not implemented by this adapter",
    )
auto_dimension_view async
auto_dimension_view(view: str, scheme: str = 'baseline') -> AdapterResult[dict[str, Any]]

Auto-dimension one drawing view.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def auto_dimension_view(
    self,
    view: str,
    scheme: str = "baseline",
) -> AdapterResult[dict[str, Any]]:
    """Auto-dimension one drawing view.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="auto_dimension_view is not implemented by this adapter",
    )
check_interference async
check_interference(params: Any = None) -> AdapterResult[dict[str, Any]]

Check the active assembly for interfering components.

Parameters:

Name Type Description Default
params Any

Optional settings; coincident, components.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Interference details, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def check_interference(
    self, params: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Check the active assembly for interfering components.

    Args:
        params (Any): Optional settings; ``coincident``, ``components``.

    Returns:
        AdapterResult[dict[str, Any]]: Interference details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="check_interference is not implemented by this adapter",
    )
check_sketch_fully_defined async
check_sketch_fully_defined(sketch_name: str | None = None) -> AdapterResult[dict[str, Any]]

Check whether a sketch is fully defined.

Parameters:

Name Type Description Default
sketch_name str | None

Optional sketch name to inspect. Defaults to None.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Definition status payload.

Source code in src/solidworks_mcp/adapters/base.py
async def check_sketch_fully_defined(
    self, sketch_name: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Check whether a sketch is fully defined.

    Args:
        sketch_name (str | None): Optional sketch name to inspect. Defaults to None.

    Returns:
        AdapterResult[dict[str, Any]]: Definition status payload.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="check_sketch_fully_defined is not implemented by this adapter",
    )
close_model abstractmethod async
close_model(save: bool = False) -> AdapterResult[None]

Close the current model.

Parameters:

Name Type Description Default
save bool

The save value. Defaults to False.

False

Returns:

Type Description
AdapterResult[None]

AdapterResult[None]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def close_model(self, save: bool = False) -> AdapterResult[None]:
    """Close the current model.

    Args:
        save (bool): The save value. Defaults to False.

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    pass
connect abstractmethod async
connect() -> None

Connect to SolidWorks application.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def connect(self) -> None:
    """Connect to SolidWorks application.

    Returns:
        None: None.
    """
    pass
create_assembly abstractmethod async
create_assembly(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create a new assembly document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

AdapterResult[SolidWorksModel]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_assembly(
    self, name: str | None = None, template: str | None = None
) -> AdapterResult[SolidWorksModel]:
    """Create a new assembly document.

    Args:
        name (str | None): The name value. Defaults to None.
        template (str | None): Template file path. Defaults to None.

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    pass
create_axis async
create_axis(reference: str) -> AdapterResult[dict[str, Any]]

Create a reference axis along a principal direction.

Parameters:

Name Type Description Default
reference str

"x", "y" or "z" (case-insensitive, leading ± stripped).

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The plane pair used and feature counts, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def create_axis(self, reference: str) -> AdapterResult[dict[str, Any]]:
    """Create a reference axis along a principal direction.

    Args:
        reference (str): "x", "y" or "z" (case-insensitive, leading +/- stripped).

    Returns:
        AdapterResult[dict[str, Any]]: The plane pair used and feature counts, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_axis is not implemented by this adapter",
    )
create_base_flange async
create_base_flange(thickness: float, bend_radius: float, k_factor: float = 0.5, depth: float | None = None, sketch: str | None = None, reverse: bool = False) -> AdapterResult[dict[str, Any]]

A sheet-metal base flange from a sketch.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def create_base_flange(
    self,
    thickness: float,
    bend_radius: float,
    k_factor: float = 0.5,
    depth: float | None = None,
    sketch: str | None = None,
    reverse: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """A sheet-metal base flange from a sketch.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_base_flange is not implemented by this adapter",
    )
create_configuration async
create_configuration(name: str, parent: str | None = None, description: str = '', activate: bool = False) -> AdapterResult[dict[str, Any]]

Add a configuration to the active model.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def create_configuration(
    self,
    name: str,
    parent: str | None = None,
    description: str = "",
    activate: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Add a configuration to the active model.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_configuration is not implemented by this adapter",
    )
create_cut async
create_cut(sketch_name: str, depth: float) -> AdapterResult[str]

Create a cut feature from an existing sketch.

Parameters:

Name Type Description Default
sketch_name str

The sketch name value.

required
depth float

The depth value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def create_cut(self, sketch_name: str, depth: float) -> AdapterResult[str]:
    """Create a cut feature from an existing sketch.

    Args:
        sketch_name (str): The sketch name value.
        depth (float): The depth value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_cut is not implemented by this adapter",
    )
create_cut_extrude async
create_cut_extrude(params: ExtrusionParameters) -> AdapterResult[Any]

Create a cut-extrude feature from the active sketch.

Cuts material from the current solid body using the active sketch profile. Equivalent to SolidWorks Insert > Cut > Extrude.

Parameters:

Name Type Description Default
params ExtrusionParameters

Depth and direction parameters.

required

Returns:

Name Type Description
AdapterResult AdapterResult[Any]

Feature result or error.

Source code in src/solidworks_mcp/adapters/base.py
async def create_cut_extrude(
    self, params: ExtrusionParameters
) -> AdapterResult[Any]:
    """Create a cut-extrude feature from the active sketch.

    Cuts material from the current solid body using the active sketch profile.
    Equivalent to SolidWorks Insert > Cut > Extrude.

    Args:
        params (ExtrusionParameters): Depth and direction parameters.

    Returns:
        AdapterResult: Feature result or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_cut_extrude is not implemented by this adapter",
    )
create_detail_view async
create_detail_view(view: str, center: list[float], radius: float, position: list[float], scale: str = '2:1', label: str | None = None) -> AdapterResult[dict[str, Any]]

Add a detail view of a circle in a drawing view.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def create_detail_view(
    self,
    view: str,
    center: list[float],
    radius: float,
    position: list[float],
    scale: str = "2:1",
    label: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add a detail view of a circle in a drawing view.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_detail_view is not implemented by this adapter",
    )
create_drawing abstractmethod async
create_drawing(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create a new drawing document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

AdapterResult[SolidWorksModel]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_drawing(
    self, name: str | None = None, template: str | None = None
) -> AdapterResult[SolidWorksModel]:
    """Create a new drawing document.

    Args:
        name (str | None): The name value. Defaults to None.
        template (str | None): Template file path. Defaults to None.

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    pass
create_drawing_view async
create_drawing_view(payload: Any = None) -> AdapterResult[dict[str, Any]]

Place a view of a model on the active drawing sheet.

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the model path, orientation, position in millimetres and optional view scale.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The new view's details, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def create_drawing_view(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Place a view of a model on the active drawing sheet.

    Args:
        payload (Any): Tool payload carrying the model path, orientation,
            position in millimetres and optional view scale.

    Returns:
        AdapterResult[dict[str, Any]]: The new view's details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_drawing_view is not implemented by this adapter",
    )
create_exploded_view async
create_exploded_view(steps: list[dict[str, Any]] | None = None) -> AdapterResult[dict[str, Any]]

Explode the active assembly, automatically or step by step, and show it.

Parameters:

Name Type Description Default
steps list[dict[str, Any]] | None

components, direction, distance, reverse; none explodes it automatically.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def create_exploded_view(
    self, steps: list[dict[str, Any]] | None = None
) -> AdapterResult[dict[str, Any]]:
    """Explode the active assembly, automatically or step by step, and show it.

    Args:
        steps (list[dict[str, Any]] | None): ``components``, ``direction``, ``distance``, ``reverse``; none explodes it automatically.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_exploded_view is not implemented by this adapter",
    )
create_extrusion abstractmethod async
create_extrusion(params: ExtrusionParameters) -> AdapterResult[SolidWorksFeature]

Create an extrusion feature.

Parameters:

Name Type Description Default
params ExtrusionParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

AdapterResult[SolidWorksFeature]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_extrusion(
    self, params: ExtrusionParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create an extrusion feature.

    Args:
        params (ExtrusionParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    pass
create_hole async
create_hole(face_point: list[float], hole_type: str, standard: str, size: str, end_condition: str = 'through_all', depth: float | None = None, positions: list[list[float]] | None = None, fastener: str | None = None) -> AdapterResult[dict[str, Any]]

Add a Hole Wizard hole at a point on a flat face.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def create_hole(
    self,
    face_point: list[float],
    hole_type: str,
    standard: str,
    size: str,
    end_condition: str = "through_all",
    depth: float | None = None,
    positions: list[list[float]] | None = None,
    fastener: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add a Hole Wizard hole at a point on a flat face.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_hole is not implemented by this adapter",
    )
create_loft abstractmethod async
create_loft(params: LoftParameters) -> AdapterResult[SolidWorksFeature]

Create a loft feature.

Parameters:

Name Type Description Default
params LoftParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

AdapterResult[SolidWorksFeature]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_loft(
    self, params: LoftParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create a loft feature.

    Args:
        params (LoftParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    pass
create_part abstractmethod async
create_part(name: str | None = None, units: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create a new part document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
units str | None

The units value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

AdapterResult[SolidWorksModel]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_part(
    self,
    name: str | None = None,
    units: str | None = None,
    template: str | None = None,
) -> AdapterResult[SolidWorksModel]:
    """Create a new part document.

    Args:
        name (str | None): The name value. Defaults to None.
        units (str | None): The units value. Defaults to None.
        template (str | None): Template file path. Defaults to None.

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    pass
create_reference_plane async
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False, axis: str | None = None, face_point: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Create a reference plane offset from, angled to, or on a plane or face.

Parameters:

Name Type Description Default
reference str

Name of the reference plane.

required
offset float

Offset distance in millimetres. Defaults to 0.0.

0.0
angle float

Angle in degrees about axis. Defaults to 0.0.

0.0
flip bool

Reverse the offset or angle direction. Defaults to False.

False
axis str | None

Named axis to rotate about; needed with angle.

None
face_point list[float] | None

[x, y, z] mm on a flat face to use as the reference instead of reference.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The new plane's name and parameters, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def create_reference_plane(
    self,
    reference: str,
    offset: float = 0.0,
    angle: float = 0.0,
    flip: bool = False,
    axis: str | None = None,
    face_point: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Create a reference plane offset from, angled to, or on a plane or face.

    Args:
        reference (str): Name of the reference plane.
        offset (float): Offset distance in millimetres. Defaults to 0.0.
        angle (float): Angle in degrees about ``axis``. Defaults to 0.0.
        flip (bool): Reverse the offset or angle direction. Defaults to False.
        axis (str | None): Named axis to rotate about; needed with ``angle``.
        face_point (list[float] | None): ``[x, y, z]`` mm on a flat face to
            use as the reference instead of ``reference``.

    Returns:
        AdapterResult[dict[str, Any]]: The new plane's name and parameters, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_reference_plane is not implemented by this adapter",
    )
create_reference_point async
create_reference_point(mode: str, x: float, y: float, z: float, distance: float | None = None, percent: float | None = None) -> AdapterResult[dict[str, Any]]

Create a reference point on the active part.

Parameters:

Name Type Description Default
mode str

"along_curve" or "face_center".

required
x float

X of a point on the target edge/face, in millimetres.

required
y float

Y of a point on the target edge/face, in millimetres.

required
z float

Z of a point on the target edge/face, in millimetres.

required
distance float | None

For "along_curve", offset from the edge start in millimetres.

None
percent float | None

For "along_curve", position as 0-100 of the edge length.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The mode and feature counts, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def create_reference_point(
    self,
    mode: str,
    x: float,
    y: float,
    z: float,
    distance: float | None = None,
    percent: float | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Create a reference point on the active part.

    Args:
        mode (str): "along_curve" or "face_center".
        x (float): X of a point on the target edge/face, in millimetres.
        y (float): Y of a point on the target edge/face, in millimetres.
        z (float): Z of a point on the target edge/face, in millimetres.
        distance (float | None): For "along_curve", offset from the edge
            start in millimetres.
        percent (float | None): For "along_curve", position as 0-100 of
            the edge length.

    Returns:
        AdapterResult[dict[str, Any]]: The mode and feature counts, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_reference_point is not implemented by this adapter",
    )
create_revolve abstractmethod async
create_revolve(params: RevolveParameters) -> AdapterResult[SolidWorksFeature]

Create a revolve feature.

Parameters:

Name Type Description Default
params RevolveParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

AdapterResult[SolidWorksFeature]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_revolve(
    self, params: RevolveParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create a revolve feature.

    Args:
        params (RevolveParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    pass
create_rib async
create_rib(sketch: str, thickness: float, both_sides: bool = True, flip_material: bool = False, normal_to_sketch: bool = False) -> AdapterResult[dict[str, Any]]

Add a rib from an open sketch.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def create_rib(
    self,
    sketch: str,
    thickness: float,
    both_sides: bool = True,
    flip_material: bool = False,
    normal_to_sketch: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Add a rib from an open sketch.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_rib is not implemented by this adapter",
    )
create_section_view async
create_section_view(view: str, line_start: list[float], line_end: list[float], position: list[float], label: str | None = None) -> AdapterResult[dict[str, Any]]

Add a section view cut along a line across a drawing view.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def create_section_view(
    self,
    view: str,
    line_start: list[float],
    line_end: list[float],
    position: list[float],
    label: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add a section view cut along a line across a drawing view.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_section_view is not implemented by this adapter",
    )
create_shell async
create_shell(thickness: float, faces: list[list[float]], outward: bool = False) -> AdapterResult[dict[str, Any]]

Hollow the body to a wall thickness.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def create_shell(
    self,
    thickness: float,
    faces: list[list[float]],
    outward: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Hollow the body to a wall thickness.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_shell is not implemented by this adapter",
    )
create_sketch abstractmethod async
create_sketch(plane: str | None, face_point: tuple[float, float, float] | None = None) -> AdapterResult[str]

Create a new sketch on a plane, or on the flat face at a point.

Parameters:

Name Type Description Default
plane str | None

The plane's name; None when face_point is given.

required
face_point tuple[float, float, float] | None

(x, y, z) in mm on a flat face of the active part, in place of plane.

None

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_sketch(
    self,
    plane: str | None,
    face_point: tuple[float, float, float] | None = None,
) -> AdapterResult[str]:
    """Create a new sketch on a plane, or on the flat face at a point.

    Args:
        plane (str | None): The plane's name; None when ``face_point`` is given.
        face_point (tuple[float, float, float] | None): ``(x, y, z)`` in mm on
            a flat face of the active part, in place of ``plane``.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    pass
create_sketched_bend async
create_sketched_bend(angle: float = 90.0, bend_radius: float | None = None, sketch: str | None = None, reverse: bool = False) -> AdapterResult[dict[str, Any]]

Bend the sheet along a sketched line.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def create_sketched_bend(
    self,
    angle: float = 90.0,
    bend_radius: float | None = None,
    sketch: str | None = None,
    reverse: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Bend the sheet along a sketched line.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_sketched_bend is not implemented by this adapter",
    )
create_standard_drawing async
create_standard_drawing(model_path: str, output_dir: str | None = None, title: str | None = None, subtitle: str | None = None, drawing_number: str | None = None, author: str = '', revision: str = 'A', company: str = '', drawn_date: str | None = None, notes: list[str] | None = None, include_isometric: bool = True, write_model_properties: bool = True, title_block_text_height_mm: float | None = None, include_bom: bool = False) -> AdapterResult[dict[str, Any]]

Create a complete standard A3 drawing.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def create_standard_drawing(
    self,
    model_path: str,
    output_dir: str | None = None,
    title: str | None = None,
    subtitle: str | None = None,
    drawing_number: str | None = None,
    author: str = "",
    revision: str = "A",
    company: str = "",
    drawn_date: str | None = None,
    notes: list[str] | None = None,
    include_isometric: bool = True,
    write_model_properties: bool = True,
    title_block_text_height_mm: float | None = None,
    include_bom: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Create a complete standard A3 drawing.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_standard_drawing is not implemented by this adapter",
    )
create_sweep abstractmethod async
create_sweep(params: SweepParameters) -> AdapterResult[SolidWorksFeature]

Create a sweep feature.

Parameters:

Name Type Description Default
params SweepParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

AdapterResult[SolidWorksFeature]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_sweep(
    self, params: SweepParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create a sweep feature.

    Args:
        params (SweepParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    pass
create_technical_drawing async
create_technical_drawing(payload: Any = None) -> AdapterResult[dict[str, Any]]

Lay out the standard views of a model on the active sheet.

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the model path and the projection angle.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The view names created, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def create_technical_drawing(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Lay out the standard views of a model on the active sheet.

    Args:
        payload (Any): Tool payload carrying the model path and the
            projection angle.

    Returns:
        AdapterResult[dict[str, Any]]: The view names created, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_technical_drawing is not implemented by this adapter",
    )
delete_configuration async
delete_configuration(name: str) -> AdapterResult[dict[str, Any]]

Delete a configuration.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def delete_configuration(
    self,
    name: str,
) -> AdapterResult[dict[str, Any]]:
    """Delete a configuration.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="delete_configuration is not implemented by this adapter",
    )
delete_equation async
delete_equation(name: str) -> AdapterResult[dict[str, Any]]

Delete the equation for name.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def delete_equation(self, name: str) -> AdapterResult[dict[str, Any]]:
    """Delete the equation for ``name``.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="delete_equation is not implemented by this adapter",
    )
delete_feature async
delete_feature(name: str) -> AdapterResult[dict[str, Any]]

Delete a named feature or sketch from the active model.

Parameters:

Name Type Description Default
name str

Feature or sketch name.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: What was deleted, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def delete_feature(self, name: str) -> AdapterResult[dict[str, Any]]:
    """Delete a named feature or sketch from the active model.

    Args:
        name (str): Feature or sketch name.

    Returns:
        AdapterResult[dict[str, Any]]: What was deleted, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="delete_feature is not implemented by this adapter",
    )
disconnect abstractmethod async
disconnect() -> None

Disconnect from SolidWorks application.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def disconnect(self) -> None:
    """Disconnect from SolidWorks application.

    Returns:
        None: None.
    """
    pass
drawing_report async
drawing_report() -> AdapterResult[dict[str, Any]]

Read what check_drawing judges on the active drawing.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def drawing_report(self) -> AdapterResult[dict[str, Any]]:
    """Read what check_drawing judges on the active drawing.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="drawing_report is not implemented by this adapter",
    )
exit_sketch abstractmethod async
exit_sketch() -> AdapterResult[None]

Exit sketch editing mode.

Returns:

Type Description
AdapterResult[None]

AdapterResult[None]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def exit_sketch(self) -> AdapterResult[None]:
    """Exit sketch editing mode.

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    pass
export_file abstractmethod async
export_file(file_path: str, format_type: str) -> AdapterResult[None]

Export the current model to a file.

Parameters:

Name Type Description Default
file_path str

Path to the target file.

required
format_type str

The format type value.

required

Returns:

Type Description
AdapterResult[None]

AdapterResult[None]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def export_file(
    self, file_path: str, format_type: str
) -> AdapterResult[None]:
    """Export the current model to a file.

    Args:
        file_path (str): Path to the target file.
        format_type (str): The format type value.

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    pass
export_flat_pattern async
export_flat_pattern(file_path: str) -> AdapterResult[dict[str, Any]]

Export the active sheet-metal part's flat pattern.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def export_flat_pattern(
    self,
    file_path: str,
) -> AdapterResult[dict[str, Any]]:
    """Export the active sheet-metal part's flat pattern.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="export_flat_pattern is not implemented by this adapter",
    )
export_image abstractmethod async
export_image(payload: dict) -> AdapterResult[dict]

Export a viewport screenshot (PNG/JPG) of the current model.

Payload keys: file_path (str): Absolute output path. width (int): Image width in pixels. height (int): Image height in pixels. view_orientation (str): One of "isometric", "front", "top", "right", "back", "bottom", "current".

Parameters:

Name Type Description Default
payload dict

The payload value.

required

Returns:

Type Description
AdapterResult[dict]

AdapterResult[dict]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def export_image(self, payload: dict) -> AdapterResult[dict]:
    """Export a viewport screenshot (PNG/JPG) of the current model.

    Payload keys: file_path (str): Absolute output path. width (int): Image width in pixels.
    height (int): Image height in pixels. view_orientation (str): One of "isometric",
    "front", "top", "right", "back", "bottom", "current".

    Args:
        payload (dict): The payload value.

    Returns:
        AdapterResult[dict]: The result produced by the operation.
    """
    pass
get_application_info async
get_application_info() -> AdapterResult[dict[str, Any]]

Describe the connected SolidWorks without changing anything.

Only file names leave the adapter, never full paths, so the result can be pasted into a public report. A value that cannot be read is None, never guessed.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: revision (e.g. "34.4.0"),

AdapterResult[dict[str, Any]]

language (e.g. "english") and templates: for each of

AdapterResult[dict[str, Any]]

part, assembly and drawing, the default template's

AdapterResult[dict[str, Any]]

file_name and whether the file exists.

Source code in src/solidworks_mcp/adapters/base.py
async def get_application_info(self) -> AdapterResult[dict[str, Any]]:
    """Describe the connected SolidWorks without changing anything.

    Only file names leave the adapter, never full paths, so the result
    can be pasted into a public report. A value that cannot be read is
    ``None``, never guessed.

    Returns:
        AdapterResult[dict[str, Any]]: ``revision`` (e.g. ``"34.4.0"``),
        ``language`` (e.g. ``"english"``) and ``templates``: for each of
        ``part``, ``assembly`` and ``drawing``, the default template's
        ``file_name`` and whether the file ``exists``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="get_application_info is not implemented by this adapter",
    )
get_custom_properties async
get_custom_properties(configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Read the custom properties of the active document.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def get_custom_properties(
    self,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Read the custom properties of the active document.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="get_custom_properties is not implemented by this adapter",
    )
get_dimension abstractmethod async
get_dimension(name: str) -> AdapterResult[dict[str, Any]]

Get the value of a dimension.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: value and units (mm, deg or None).

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def get_dimension(self, name: str) -> AdapterResult[dict[str, Any]]:
    """Get the value of a dimension.

    Args:
        name (str): The name value.

    Returns:
        AdapterResult[dict[str, Any]]: ``value`` and ``units`` (mm, deg or None).
    """
    pass
get_mass_properties abstractmethod async
get_mass_properties() -> AdapterResult[MassProperties]

Get mass properties of the current model.

Returns:

Type Description
AdapterResult[MassProperties]

AdapterResult[MassProperties]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def get_mass_properties(self) -> AdapterResult[MassProperties]:
    """Get mass properties of the current model.

    Returns:
        AdapterResult[MassProperties]: The result produced by the operation.
    """
    pass
get_material async
get_material(configuration: str | None = None, material: str | None = None, database: str | None = None) -> AdapterResult[dict[str, Any]]

Read the active part's material and its properties, or a library material's.

Parameters:

Name Type Description Default
configuration str | None

Configuration name; the active one when omitted.

None
material str | None

A library material to read instead of the part's.

None
database str | None

The library to look in first for material.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def get_material(
    self,
    configuration: str | None = None,
    material: str | None = None,
    database: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Read the active part's material and its properties, or a library material's.

    Args:
        configuration: Configuration name; the active one when omitted.
        material: A library material to read instead of the part's.
        database: The library to look in first for ``material``.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="get_material is not implemented by this adapter",
    )
get_metrics
get_metrics() -> dict[str, Any]

Get adapter metrics.

Returns:

Type Description
dict[str, Any]

dict[str, Any]: A dictionary containing the resulting values.

Source code in src/solidworks_mcp/adapters/base.py
def get_metrics(self) -> dict[str, Any]:
    """Get adapter metrics.

    Returns:
        dict[str, Any]: A dictionary containing the resulting values.
    """
    return self._metrics.copy()
get_model_geometry_summary async
get_model_geometry_summary() -> AdapterResult[dict[str, Any]]

Summarise the active part or assembly without changing it.

Must not rebuild the model, modify it, or clear the selection, so callers can read it around a feature call. Values the adapter cannot determine are None, never guessed.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: document_type ("part" or

AdapterResult[dict[str, Any]]

"assembly"), volume_mm3, bounding_box_mm (min,

AdapterResult[dict[str, Any]]

max and size as [x, y, z]), bounding_box_method,

AdapterResult[dict[str, Any]]

solid_body_count, and for assemblies component_count and

AdapterResult[dict[str, Any]]

mate_count. Error when there is no active part or assembly.

Source code in src/solidworks_mcp/adapters/base.py
async def get_model_geometry_summary(self) -> AdapterResult[dict[str, Any]]:
    """Summarise the active part or assembly without changing it.

    Must not rebuild the model, modify it, or clear the selection, so
    callers can read it around a feature call. Values the adapter cannot
    determine are ``None``, never guessed.

    Returns:
        AdapterResult[dict[str, Any]]: ``document_type`` (``"part"`` or
        ``"assembly"``), ``volume_mm3``, ``bounding_box_mm`` (``min``,
        ``max`` and ``size`` as ``[x, y, z]``), ``bounding_box_method``,
        ``solid_body_count``, and for assemblies ``component_count`` and
        ``mate_count``. Error when there is no active part or assembly.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="get_model_geometry_summary is not implemented by this adapter",
    )
get_model_info abstractmethod async
get_model_info() -> AdapterResult[dict[str, Any]]

Get metadata for the active model.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def get_model_info(self) -> AdapterResult[dict[str, Any]]:
    """Get metadata for the active model.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    pass
get_selected_entities async
get_selected_entities() -> AdapterResult[list[dict[str, Any]]]

Report the faces/edges/vertices currently selected in the live UI.

Lets an agent see exactly what the user has clicked on in SolidWorks (e.g. "chamfer THIS face") instead of inferring it from a screenshot.

Returns:

Type Description
AdapterResult[list[dict[str, Any]]]

AdapterResult[list[dict[str, Any]]]: One descriptor per selected

AdapterResult[list[dict[str, Any]]]

entity. See the PyWin32 adapter's implementation for the field

AdapterResult[list[dict[str, Any]]]

set (varies by entity type).

Source code in src/solidworks_mcp/adapters/base.py
async def get_selected_entities(self) -> AdapterResult[list[dict[str, Any]]]:
    """Report the faces/edges/vertices currently selected in the live UI.

    Lets an agent see exactly what the user has clicked on in SolidWorks
    (e.g. "chamfer THIS face") instead of inferring it from a screenshot.

    Returns:
        AdapterResult[list[dict[str, Any]]]: One descriptor per selected
        entity. See the PyWin32 adapter's implementation for the field
        set (varies by entity type).
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="get_selected_entities is not implemented by this adapter",
    )
get_template_folders async
get_template_folders() -> AdapterResult[dict[str, Any]]

SolidWorks' document template folders and the active document's template extension.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def get_template_folders(self) -> AdapterResult[dict[str, Any]]:
    """SolidWorks' document template folders and the active document's template extension.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="get_template_folders is not implemented by this adapter",
    )
health_check abstractmethod async
health_check() -> AdapterHealth

Get adapter health status.

Returns:

Name Type Description
AdapterHealth AdapterHealth

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def health_check(self) -> AdapterHealth:
    """Get adapter health status.

    Returns:
        AdapterHealth: The result produced by the operation.
    """
    pass
insert_bom_table async
insert_bom_table(view_name: str, template_path: str | None = None, bom_type: str = 'top_level_only', x_mm: float | None = None, y_mm: float | None = None) -> AdapterResult[dict[str, Any]]

Insert a BOM table anchored to an assembly drawing view.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def insert_bom_table(
    self,
    view_name: str,
    template_path: str | None = None,
    bom_type: str = "top_level_only",
    x_mm: float | None = None,
    y_mm: float | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Insert a BOM table anchored to an assembly drawing view.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="insert_bom_table is not implemented by this adapter",
    )
insert_component async
insert_component(file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> AdapterResult[dict[str, Any]]

Insert a part or sub-assembly into the active assembly.

Parameters:

Name Type Description Default
file_path str

Absolute path to the .sldprt or .sldasm.

required
x float

X position in millimetres. Defaults to 0.0.

0.0
y float

Y position in millimetres. Defaults to 0.0.

0.0
z float

Z position in millimetres. Defaults to 0.0.

0.0

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Component name and counts, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def insert_component(
    self, file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0
) -> AdapterResult[dict[str, Any]]:
    """Insert a part or sub-assembly into the active assembly.

    Args:
        file_path (str): Absolute path to the ``.sldprt`` or ``.sldasm``.
        x (float): X position in millimetres. Defaults to 0.0.
        y (float): Y position in millimetres. Defaults to 0.0.
        z (float): Z position in millimetres. Defaults to 0.0.

    Returns:
        AdapterResult[dict[str, Any]]: Component name and counts, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="insert_component is not implemented by this adapter",
    )
insert_model_dimensions async
insert_model_dimensions(view_name: str | None = None, include_hole_wizard: bool = True) -> AdapterResult[dict[str, Any]]

Bring model dimensions into drawing views.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def insert_model_dimensions(
    self,
    view_name: str | None = None,
    include_hole_wizard: bool = True,
) -> AdapterResult[dict[str, Any]]:
    """Bring model dimensions into drawing views.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="insert_model_dimensions is not implemented by this adapter",
    )
is_connected abstractmethod
is_connected() -> bool

Check if connected to SolidWorks.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
def is_connected(self) -> bool:
    """Check if connected to SolidWorks.

    Returns:
        bool: True if connected, otherwise False.
    """
    pass
list_available_materials async
list_available_materials(search: str | None = None) -> AdapterResult[list[dict[str, str]]]

List materials from the configured material libraries.

Returns:

Type Description
AdapterResult[list[dict[str, str]]]

AdapterResult[list[dict[str, str]]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def list_available_materials(
    self,
    search: str | None = None,
) -> AdapterResult[list[dict[str, str]]]:
    """List materials from the configured material libraries.

    Returns:
        AdapterResult[list[dict[str, str]]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="list_available_materials is not implemented by this adapter",
    )
list_components async
list_components() -> AdapterResult[list[str]]

List the top-level components of the active assembly.

Returns:

Type Description
AdapterResult[list[str]]

AdapterResult[list[str]]: Component instance names, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def list_components(self) -> AdapterResult[list[str]]:
    """List the top-level components of the active assembly.

    Returns:
        AdapterResult[list[str]]: Component instance names, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="list_components is not implemented by this adapter",
    )
list_configurations abstractmethod async
list_configurations() -> AdapterResult[list[str]]

List configuration names for the active model.

Returns:

Type Description
AdapterResult[list[str]]

AdapterResult[list[str]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def list_configurations(self) -> AdapterResult[list[str]]:
    """List configuration names for the active model.

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    pass
list_drawing_views async
list_drawing_views() -> AdapterResult[list[str]]

List the views on the active drawing.

Returns:

Type Description
AdapterResult[list[str]]

AdapterResult[list[str]]: View names, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def list_drawing_views(self) -> AdapterResult[list[str]]:
    """List the views on the active drawing.

    Returns:
        AdapterResult[list[str]]: View names, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="list_drawing_views is not implemented by this adapter",
    )
list_equations async
list_equations() -> AdapterResult[list[dict[str, Any]]]

List the active model's equations and global variables.

Returns:

Type Description
AdapterResult[list[dict[str, Any]]]

AdapterResult[list[dict[str, Any]]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def list_equations(self) -> AdapterResult[list[dict[str, Any]]]:
    """List the active model's equations and global variables.

    Returns:
        AdapterResult[list[dict[str, Any]]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="list_equations is not implemented by this adapter",
    )
list_features abstractmethod async
list_features(include_suppressed: bool = False, max_assembly_depth: int = 2) -> AdapterResult[list[dict[str, Any]]]

List model features from the feature tree.

For a Part document, returns that document's own feature list, unchanged from prior behavior. For an Assembly document, returns a single flat list containing the assembly's own top-level features plus every resolved component's features, recursing into sub-assemblies up to max_assembly_depth. Every descriptor gains component, component_path, and component_parent keys: None for a document's own features (Part features, or an Assembly's top-level features), or the owning component's name/path for a component-derived feature. component_parent is the immediate parent component name when the component is nested inside a sub-assembly, otherwise None. A component that cannot be resolved (suppressed, lightweight-and-unloaded, missing file) is represented by one descriptor with type: "UnresolvedComponent" instead of being silently dropped.

Parameters:

Name Type Description Default
include_suppressed bool

The include suppressed value. Defaults to False. Applied independently to the assembly's own features and to each component's features.

False
max_assembly_depth int

How many levels of sub-assembly to recurse into. Defaults to 2. Ignored for Part documents. A component beyond the configured depth still appears in the result as a single descriptor (name + path), not expanded.

2

Returns:

Type Description
AdapterResult[list[dict[str, Any]]]

AdapterResult[list[dict[str, Any]]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def list_features(
    self, include_suppressed: bool = False, max_assembly_depth: int = 2
) -> AdapterResult[list[dict[str, Any]]]:
    """List model features from the feature tree.

    For a Part document, returns that document's own feature list,
    unchanged from prior behavior. For an Assembly document, returns a
    single flat list containing the assembly's own top-level features
    plus every resolved component's features, recursing into
    sub-assemblies up to ``max_assembly_depth``. Every descriptor gains
    ``component``, ``component_path``, and ``component_parent`` keys:
    ``None`` for a document's own features (Part features, or an Assembly's
    top-level features), or the owning component's name/path for a
    component-derived feature. ``component_parent`` is the immediate parent
    component name when the component is nested inside a sub-assembly,
    otherwise ``None``. A component that cannot be resolved (suppressed,
    lightweight-and-unloaded, missing file) is represented by one descriptor
    with ``type: "UnresolvedComponent"`` instead of being silently dropped.

    Args:
        include_suppressed (bool): The include suppressed value. Defaults to False.
            Applied independently to the assembly's own features and to
            each component's features.
        max_assembly_depth (int): How many levels of sub-assembly to
            recurse into. Defaults to 2. Ignored for Part documents. A
            component beyond the configured depth still appears in the
            result as a single descriptor (name + path), not expanded.

    Returns:
        AdapterResult[list[dict[str, Any]]]: The result produced by the operation.
    """
    pass
list_hole_sizes async
list_hole_sizes(standard: str, hole_type: str, fastener: str | None = None, size: str | None = None) -> AdapterResult[dict[str, Any]]

List the Hole Wizard hole types and sizes of a standard.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def list_hole_sizes(
    self,
    standard: str,
    hole_type: str,
    fastener: str | None = None,
    size: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """List the Hole Wizard hole types and sizes of a standard.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="list_hole_sizes is not implemented by this adapter",
    )
list_model_dimensions async
list_model_dimensions(feature_name: str | None = None) -> AdapterResult[list[dict[str, Any]]]

List every dimension in the active part or assembly.

Returns:

Type Description
AdapterResult[list[dict[str, Any]]]

AdapterResult[list[dict[str, Any]]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def list_model_dimensions(
    self,
    feature_name: str | None = None,
) -> AdapterResult[list[dict[str, Any]]]:
    """List every dimension in the active part or assembly.

    Returns:
        AdapterResult[list[dict[str, Any]]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="list_model_dimensions is not implemented by this adapter",
    )
list_open_documents async
list_open_documents() -> AdapterResult[list[dict[str, Any]]]

Enumerate every document currently open in SolidWorks.

Returns:

Type Description
AdapterResult[list[dict[str, Any]]]

AdapterResult[list[dict[str, Any]]]: One entry per open document

AdapterResult[list[dict[str, Any]]]

(title, path, type, is_active), or error.

Source code in src/solidworks_mcp/adapters/base.py
async def list_open_documents(self) -> AdapterResult[list[dict[str, Any]]]:
    """Enumerate every document currently open in SolidWorks.

    Returns:
        AdapterResult[list[dict[str, Any]]]: One entry per open document
        (``title``, ``path``, ``type``, ``is_active``), or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="list_open_documents is not implemented by this adapter",
    )
measure_entities async
measure_entities(entities: list[str]) -> AdapterResult[dict[str, Any]]

Measure one or two selected entities.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def measure_entities(
    self,
    entities: list[str],
) -> AdapterResult[dict[str, Any]]:
    """Measure one or two selected entities.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="measure_entities is not implemented by this adapter",
    )
mirror_components async
mirror_components(components: list[str], plane: str) -> AdapterResult[dict[str, Any]]

Mirror components about a plane, as instances of the same parts.

Parameters:

Name Type Description Default
components list[str]

Instance names.

required
plane str

The plane's name.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def mirror_components(
    self, components: list[str], plane: str
) -> AdapterResult[dict[str, Any]]:
    """Mirror components about a plane, as instances of the same parts.

    Args:
        components (list[str]): Instance names.
        plane (str): The plane's name.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="mirror_components is not implemented by this adapter",
    )
mirror_feature async
mirror_feature(features: list[str], mirror_plane: str, merge: bool = True, mirror_bodies: bool = True) -> AdapterResult[dict[str, Any]]

Mirror solid bodies or features about a plane.

Parameters:

Name Type Description Default
features list[str]

Body or feature names to mirror.

required
mirror_plane str

Plane name to mirror about.

required
merge bool

Merge the mirrored result with the original. Defaults to True.

True
mirror_bodies bool

Mirror whole bodies rather than features. Defaults to True.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The mirror feature's name, inputs and volume

AdapterResult[dict[str, Any]]

before/after, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def mirror_feature(
    self,
    features: list[str],
    mirror_plane: str,
    merge: bool = True,
    mirror_bodies: bool = True,
) -> AdapterResult[dict[str, Any]]:
    """Mirror solid bodies or features about a plane.

    Args:
        features (list[str]): Body or feature names to mirror.
        mirror_plane (str): Plane name to mirror about.
        merge (bool): Merge the mirrored result with the original. Defaults to True.
        mirror_bodies (bool): Mirror whole bodies rather than features. Defaults to True.

    Returns:
        AdapterResult[dict[str, Any]]: The mirror feature's name, inputs and volume
        before/after, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="mirror_feature is not implemented by this adapter",
    )
open_model abstractmethod async
open_model(file_path: str) -> AdapterResult[SolidWorksModel]

Open a SolidWorks model (part, assembly, or drawing).

Parameters:

Name Type Description Default
file_path str

Path to the target file.

required

Returns:

Type Description
AdapterResult[SolidWorksModel]

AdapterResult[SolidWorksModel]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def open_model(self, file_path: str) -> AdapterResult[SolidWorksModel]:
    """Open a SolidWorks model (part, assembly, or drawing).

    Args:
        file_path (str): Path to the target file.

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    pass
pack_and_go_assembly async
pack_and_go_assembly(source_path: str, target_dir: str) -> AdapterResult[dict[str, Any]]

Copy an assembly and every file it uses into one folder.

Parameters:

Name Type Description Default
source_path str

The .sldasm file.

required
target_dir str

The folder to copy into.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def pack_and_go_assembly(
    self, source_path: str, target_dir: str
) -> AdapterResult[dict[str, Any]]:
    """Copy an assembly and every file it uses into one folder.

    Args:
        source_path (str): The ``.sldasm`` file.
        target_dir (str): The folder to copy into.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="pack_and_go_assembly is not implemented by this adapter",
    )
pattern_circular async
pattern_circular(features: list[str], axis: str, count: int, angle: float = 360.0, equal_spacing: bool = True) -> AdapterResult[dict[str, Any]]

Pattern features around an axis.

Parameters:

Name Type Description Default
features list[str]

Names of the features to pattern.

required
axis str

Name of the axis to rotate about.

required
count int

Total number of instances including the original.

required
angle float

Total angle in degrees to spread them over. Defaults to 360.0.

360.0
equal_spacing bool

Space instances evenly across angle. Defaults to True.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: What was patterned and the volume

AdapterResult[dict[str, Any]]

before/after, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def pattern_circular(
    self,
    features: list[str],
    axis: str,
    count: int,
    angle: float = 360.0,
    equal_spacing: bool = True,
) -> AdapterResult[dict[str, Any]]:
    """Pattern features around an axis.

    Args:
        features (list[str]): Names of the features to pattern.
        axis (str): Name of the axis to rotate about.
        count (int): Total number of instances including the original.
        angle (float): Total angle in degrees to spread them over. Defaults to 360.0.
        equal_spacing (bool): Space instances evenly across ``angle``. Defaults to True.

    Returns:
        AdapterResult[dict[str, Any]]: What was patterned and the volume
        before/after, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="pattern_circular is not implemented by this adapter",
    )
pattern_components async
pattern_components(components: list[str], axis: str, count: int, kind: str = 'linear', spacing: float | None = None, angle: float | None = None) -> AdapterResult[dict[str, Any]]

Repeat components along or around a reference axis.

Parameters:

Name Type Description Default
components list[str]

The seed components' instance names.

required
axis str

A reference axis's name.

required
count int

Instances, the seeds included.

required
kind str

linear or circular.

'linear'
spacing float | None

Linear spacing, mm.

None
angle float | None

Circular angle, degrees.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def pattern_components(
    self,
    components: list[str],
    axis: str,
    count: int,
    kind: str = "linear",
    spacing: float | None = None,
    angle: float | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Repeat components along or around a reference axis.

    Args:
        components (list[str]): The seed components' instance names.
        axis (str): A reference axis's name.
        count (int): Instances, the seeds included.
        kind (str): ``linear`` or ``circular``.
        spacing (float | None): Linear spacing, mm.
        angle (float | None): Circular angle, degrees.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="pattern_components is not implemented by this adapter",
    )
pattern_linear async
pattern_linear(features: list[str], direction: list[float] | str, count: int, spacing: float, direction2: list[float] | str | None = None, count2: int = 1, spacing2: float = 0.0, reverse: bool = False, reverse2: bool = False) -> AdapterResult[dict[str, Any]]

Repeat features along one or two directions.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def pattern_linear(
    self,
    features: list[str],
    direction: list[float] | str,
    count: int,
    spacing: float,
    direction2: list[float] | str | None = None,
    count2: int = 1,
    spacing2: float = 0.0,
    reverse: bool = False,
    reverse2: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Repeat features along one or two directions.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="pattern_linear is not implemented by this adapter",
    )
rebuild_model async
rebuild_model(top_level_only: bool = False) -> AdapterResult[dict[str, Any]]

Force a rebuild and report per-feature rebuild errors.

Parameters:

Name Type Description Default
top_level_only bool

Rebuild only the top level of an assembly. Defaults to False (full rebuild).

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: rebuilt, top_level_only,

AdapterResult[dict[str, Any]]

errors (one entry per failing feature with feature,

AdapterResult[dict[str, Any]]

type, code, code_name, severity, description,

AdapterResult[dict[str, Any]]

parents, hint), error_count and warning_count.

AdapterResult[dict[str, Any]]

ERROR (still carrying data) when any error-severity entry

AdapterResult[dict[str, Any]]

remains.

Source code in src/solidworks_mcp/adapters/base.py
async def rebuild_model(
    self, top_level_only: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Force a rebuild and report per-feature rebuild errors.

    Args:
        top_level_only (bool): Rebuild only the top level of an assembly.
            Defaults to False (full rebuild).

    Returns:
        AdapterResult[dict[str, Any]]: ``rebuilt``, ``top_level_only``,
        ``errors`` (one entry per failing feature with ``feature``,
        ``type``, ``code``, ``code_name``, ``severity``, ``description``,
        ``parents``, ``hint``), ``error_count`` and ``warning_count``.
        ERROR (still carrying ``data``) when any error-severity entry
        remains.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="rebuild_model is not implemented by this adapter",
    )
rename_feature async
rename_feature(old_name: str, new_name: str) -> AdapterResult[dict[str, Any]]

Rename an existing feature on the feature tree.

Parameters:

Name Type Description Default
old_name str

Current feature name.

required
new_name str

New feature name.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The old and new names, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def rename_feature(
    self, old_name: str, new_name: str
) -> AdapterResult[dict[str, Any]]:
    """Rename an existing feature on the feature tree.

    Args:
        old_name (str): Current feature name.
        new_name (str): New feature name.

    Returns:
        AdapterResult[dict[str, Any]]: The old and new names, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="rename_feature is not implemented by this adapter",
    )
replace_component async
replace_component(component: str, file_path: str, all_instances: bool = False) -> AdapterResult[dict[str, Any]]

Swap a component for another part or assembly file.

Parameters:

Name Type Description Default
component str

The instance name.

required
file_path str

The part or assembly to put in its place.

required
all_instances bool

Replace every instance of the same file.

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def replace_component(
    self, component: str, file_path: str, all_instances: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Swap a component for another part or assembly file.

    Args:
        component (str): The instance name.
        file_path (str): The part or assembly to put in its place.
        all_instances (bool): Replace every instance of the same file.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="replace_component is not implemented by this adapter",
    )
reset_circuit_breakers async
reset_circuit_breakers(operation: str | None = None) -> AdapterResult[dict[str, list[str]]]

Re-open operations a circuit breaker paused.

An adapter without a circuit breaker has nothing paused; the breaker and the connection pool override this.

Parameters:

Name Type Description Default
operation str | None

The operation to reset; None resets every one.

None

Returns:

Type Description
AdapterResult[dict[str, list[str]]]

AdapterResult[dict[str, list[str]]]: reset, the operations that were paused.

Source code in src/solidworks_mcp/adapters/base.py
async def reset_circuit_breakers(
    self, operation: str | None = None
) -> AdapterResult[dict[str, list[str]]]:
    """Re-open operations a circuit breaker paused.

    An adapter without a circuit breaker has nothing paused; the breaker
    and the connection pool override this.

    Args:
        operation: The operation to reset; ``None`` resets every one.

    Returns:
        AdapterResult[dict[str, list[str]]]: ``reset``, the operations that were paused.
    """
    return AdapterResult(status=AdapterResultStatus.SUCCESS, data={"reset": []})
save_as_template async
save_as_template(file_path: str) -> AdapterResult[dict[str, Any]]

Save a copy of the active document as a template.

Parameters:

Name Type Description Default
file_path str

The template's full path, with the document's template extension (.prtdot, .asmdot or .drwdot).

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def save_as_template(self, file_path: str) -> AdapterResult[dict[str, Any]]:
    """Save a copy of the active document as a template.

    Args:
        file_path: The template's full path, with the document's template
            extension (.prtdot, .asmdot or .drwdot).

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="save_as_template is not implemented by this adapter",
    )
save_body_as_part async
save_body_as_part(body_name: str, file_path: str) -> AdapterResult[dict[str, Any]]

Extract one solid body from the active multibody part to a new file.

Parameters:

Name Type Description Default
body_name str

Name of a solid body in the active part.

required
file_path str

Absolute path for the new .sldprt.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The body, the written path, and the

AdapterResult[dict[str, Any]]

solid-body names found, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def save_body_as_part(
    self, body_name: str, file_path: str
) -> AdapterResult[dict[str, Any]]:
    """Extract one solid body from the active multibody part to a new file.

    Args:
        body_name (str): Name of a solid body in the active part.
        file_path (str): Absolute path for the new ``.sldprt``.

    Returns:
        AdapterResult[dict[str, Any]]: The body, the written path, and the
        solid-body names found, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="save_body_as_part is not implemented by this adapter",
    )
save_copy async
save_copy(file_path: str) -> AdapterResult[dict[str, Any]]

Write a copy of the active document and keep the original open.

Parameters:

Name Type Description Default
file_path str

Where to write the copy.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def save_copy(self, file_path: str) -> AdapterResult[dict[str, Any]]:
    """Write a copy of the active document and keep the original open.

    Args:
        file_path (str): Where to write the copy.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="save_copy is not implemented by this adapter",
    )
save_file async
save_file(file_path: str | None = None) -> AdapterResult[Any]

Save the active model to the existing path or the provided path.

Parameters:

Name Type Description Default
file_path str | None

Path to the target file. Defaults to None.

None

Returns:

Type Description
AdapterResult[Any]

AdapterResult[Any]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def save_file(self, file_path: str | None = None) -> AdapterResult[Any]:
    """Save the active model to the existing path or the provided path.

    Args:
        file_path (str | None): Path to the target file. Defaults to None.

    Returns:
        AdapterResult[Any]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="save_file is not implemented by this adapter",
    )
select_face_edges async
select_face_edges(point: list[float] | None = None, side: str | None = None, plane: str | None = None, edge_type: str = 'all', append: bool = False) -> AdapterResult[dict[str, Any]]

Multi-select every edge bounding one face of the active part.

Exactly one of point/side/plane identifies the face.

Parameters:

Name Type Description Default
point list[float] | None

[x, y, z] in mm on the face.

None
side str | None

+X..-Z or top/bottom/front/back/ right/left; the furthest planar face facing that way.

None
plane str | None

Reference plane name; the body face(s) lying on it.

None
edge_type str

all, linear or circular.

'all'
append bool

Add to the current selection. Defaults to False.

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: face (or faces), edges

AdapterResult[dict[str, Any]]

(one descriptor per selected edge) and selection_count.

Source code in src/solidworks_mcp/adapters/base.py
async def select_face_edges(
    self,
    point: list[float] | None = None,
    side: str | None = None,
    plane: str | None = None,
    edge_type: str = "all",
    append: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Multi-select every edge bounding one face of the active part.

    Exactly one of ``point``/``side``/``plane`` identifies the face.

    Args:
        point (list[float] | None): ``[x, y, z]`` in mm on the face.
        side (str | None): ``+X``..``-Z`` or ``top/bottom/front/back/
            right/left``; the furthest planar face facing that way.
        plane (str | None): Reference plane name; the body face(s) lying
            on it.
        edge_type (str): ``all``, ``linear`` or ``circular``.
        append (bool): Add to the current selection. Defaults to False.

    Returns:
        AdapterResult[dict[str, Any]]: ``face`` (or ``faces``), ``edges``
        (one descriptor per selected edge) and ``selection_count``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="select_face_edges is not implemented by this adapter",
    )
select_feature async
select_feature(feature_name: str, append: bool = False) -> AdapterResult[dict[str, Any]]

Select a named feature, sketch, plane or component.

Parameters:

Name Type Description Default
feature_name str

The feature name, optionally @document qualified.

required
append bool

Add to the current selection instead of replacing it. Defaults to False.

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: On success selected (True),

AdapterResult[dict[str, Any]]

feature_name, selected_name, entity_type and

AdapterResult[dict[str, Any]]

selection_count. ERROR when nothing could be selected - never

AdapterResult[dict[str, Any]]

SUCCESS with selected: False.

Source code in src/solidworks_mcp/adapters/base.py
async def select_feature(
    self, feature_name: str, append: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Select a named feature, sketch, plane or component.

    Args:
        feature_name (str): The feature name, optionally ``@document``
            qualified.
        append (bool): Add to the current selection instead of replacing
            it. Defaults to False.

    Returns:
        AdapterResult[dict[str, Any]]: On success ``selected`` (True),
        ``feature_name``, ``selected_name``, ``entity_type`` and
        ``selection_count``. ERROR when nothing could be selected - never
        SUCCESS with ``selected: False``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="select_feature is not implemented by this adapter",
    )
set_component_appearance async
set_component_appearance(component: str, visible: bool | None = None, transparent: bool | None = None) -> AdapterResult[dict[str, Any]]

Hide or show a component, and make it transparent or opaque.

Parameters:

Name Type Description Default
component str

The instance name.

required
visible bool | None

Show (True) or hide (False).

None
transparent bool | None

Transparent or opaque.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def set_component_appearance(
    self,
    component: str,
    visible: bool | None = None,
    transparent: bool | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Hide or show a component, and make it transparent or opaque.

    Args:
        component (str): The instance name.
        visible (bool | None): Show (``True``) or hide (``False``).
        transparent (bool | None): Transparent or opaque.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_component_appearance is not implemented by this adapter",
    )
set_component_state async
set_component_state(component: str, fixed: bool | None = None, flexible: bool | None = None) -> AdapterResult[dict[str, Any]]

Fix or float a component, and make a sub-assembly rigid or flexible.

Parameters:

Name Type Description Default
component str

Instance name, as list_components reports it.

required
fixed bool | None

True fixes it, False floats it.

None
flexible bool | None

True flexible, False rigid.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The state before and after, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def set_component_state(
    self,
    component: str,
    fixed: bool | None = None,
    flexible: bool | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Fix or float a component, and make a sub-assembly rigid or flexible.

    Args:
        component (str): Instance name, as ``list_components`` reports it.
        fixed (bool | None): True fixes it, False floats it.
        flexible (bool | None): True flexible, False rigid.

    Returns:
        AdapterResult[dict[str, Any]]: The state before and after, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_component_state is not implemented by this adapter",
    )
set_construction_geometry async
set_construction_geometry(entities: list[str], construction: bool = True) -> AdapterResult[dict[str, Any]]

Make sketch entities construction geometry, or normal again.

Parameters:

Name Type Description Default
entities list[str]

Sketch entity ids.

required
construction bool

True for construction, False for normal.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: entities (id to state) and

AdapterResult[dict[str, Any]]

construction.

Source code in src/solidworks_mcp/adapters/base.py
async def set_construction_geometry(
    self, entities: list[str], construction: bool = True
) -> AdapterResult[dict[str, Any]]:
    """Make sketch entities construction geometry, or normal again.

    Args:
        entities (list[str]): Sketch entity ids.
        construction (bool): ``True`` for construction, ``False`` for normal.

    Returns:
        AdapterResult[dict[str, Any]]: ``entities`` (id to state) and
        ``construction``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_construction_geometry is not implemented by this adapter",
    )
set_custom_property async
set_custom_property(name: str, value: str, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Create or overwrite one custom property.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def set_custom_property(
    self,
    name: str,
    value: str,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Create or overwrite one custom property.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_custom_property is not implemented by this adapter",
    )
set_dimension abstractmethod async
set_dimension(name: str, value: float, configurations: str | list[str] = 'this') -> AdapterResult[dict[str, Any]]

Set the value of a dimension.

Parameters:

Name Type Description Default
name str

The name value.

required
value float

The value value.

required
configurations str | list[str]

"this", "all" or names.

'this'

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: configurations, the names set in.

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def set_dimension(
    self, name: str, value: float, configurations: str | list[str] = "this"
) -> AdapterResult[dict[str, Any]]:
    """Set the value of a dimension.

    Args:
        name (str): The name value.
        value (float): The value value.
        configurations (str | list[str]): "this", "all" or names.

    Returns:
        AdapterResult[dict[str, Any]]: ``configurations``, the names set in.
    """
    pass
set_equation async
set_equation(name: str, expression: str, configurations: str | list[str] = 'all') -> AdapterResult[dict[str, Any]]

Add an equation, or change the one name has.

Parameters:

Name Type Description Default
name str

A global variable or a dimension (D1@Sketch1).

required
expression str

The right-hand side.

required
configurations str | list[str]

"all", "this" or names.

'all'

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def set_equation(
    self,
    name: str,
    expression: str,
    configurations: str | list[str] = "all",
) -> AdapterResult[dict[str, Any]]:
    """Add an equation, or change the one ``name`` has.

    Args:
        name (str): A global variable or a dimension (``D1@Sketch1``).
        expression (str): The right-hand side.
        configurations (str | list[str]): "all", "this" or names.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_equation is not implemented by this adapter",
    )
set_exploded_view async
set_exploded_view(exploded: bool) -> AdapterResult[dict[str, Any]]

Show the assembly's exploded view, or collapse it.

Parameters:

Name Type Description Default
exploded bool

True explodes, False collapses.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def set_exploded_view(self, exploded: bool) -> AdapterResult[dict[str, Any]]:
    """Show the assembly's exploded view, or collapse it.

    Args:
        exploded (bool): ``True`` explodes, ``False`` collapses.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_exploded_view is not implemented by this adapter",
    )
set_flat_pattern async
set_flat_pattern(flat: bool) -> AdapterResult[dict[str, Any]]

Flatten the sheet-metal part, or fold it back.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def set_flat_pattern(self, flat: bool) -> AdapterResult[dict[str, Any]]:
    """Flatten the sheet-metal part, or fold it back.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_flat_pattern is not implemented by this adapter",
    )
set_material async
set_material(material_name: str, database: str | None = None, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Assign a material to the active part.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def set_material(
    self,
    material_name: str,
    database: str | None = None,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Assign a material to the active part.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_material is not implemented by this adapter",
    )
set_sheet_scale async
set_sheet_scale(numerator: float, denominator: float) -> AdapterResult[dict[str, Any]]

Set the active drawing sheet's scale.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Error unless the adapter implements it.

Source code in src/solidworks_mcp/adapters/base.py
async def set_sheet_scale(
    self,
    numerator: float,
    denominator: float,
) -> AdapterResult[dict[str, Any]]:
    """Set the active drawing sheet's scale.

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_sheet_scale is not implemented by this adapter",
    )
set_sketch_text async
set_sketch_text(sketch_name: str, text: str) -> AdapterResult[dict[str, Any]]

Rewrite the text in a sketch, with the sketch open, then rebuild.

Parameters:

Name Type Description Default
sketch_name str

The sketch, e.g. Sketch12.

required
text str

The new text.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: sketch, before and after.

Source code in src/solidworks_mcp/adapters/base.py
async def set_sketch_text(
    self, sketch_name: str, text: str
) -> AdapterResult[dict[str, Any]]:
    """Rewrite the text in a sketch, with the sketch open, then rebuild.

    Args:
        sketch_name (str): The sketch, e.g. ``Sketch12``.
        text (str): The new text.

    Returns:
        AdapterResult[dict[str, Any]]: ``sketch``, ``before`` and ``after``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_sketch_text is not implemented by this adapter",
    )
set_units async
set_units(unit_system: str) -> AdapterResult[dict[str, Any]]

Set the active document's linear unit system.

Parameters:

Name Type Description Default
unit_system str

One of mm, cm, m, in, ft.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: What was applied, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def set_units(self, unit_system: str) -> AdapterResult[dict[str, Any]]:
    """Set the active document's linear unit system.

    Args:
        unit_system (str): One of ``mm``, ``cm``, ``m``, ``in``, ``ft``.

    Returns:
        AdapterResult[dict[str, Any]]: What was applied, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_units is not implemented by this adapter",
    )
sketch_circular_pattern async
sketch_circular_pattern(entities: list[str], angle: float, count: int) -> AdapterResult[str]

Create a circular pattern of sketch entities around the sketch origin.

The rotation axis is always the sketch origin — SW's CreateCircularSketchStepAndRepeat has no pattern-centre parameter and derives the axis from the seed's geometry. Place the seed entity at the desired radius from the origin.

Parameters:

Name Type Description Default
entities list[str]

The entities value.

required
angle float

The angle value.

required
count int

The count value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def sketch_circular_pattern(
    self,
    entities: list[str],
    angle: float,
    count: int,
) -> AdapterResult[str]:
    """Create a circular pattern of sketch entities around the sketch origin.

    The rotation axis is always the sketch origin — SW's
    ``CreateCircularSketchStepAndRepeat`` has no pattern-centre
    parameter and derives the axis from the seed's geometry. Place
    the seed entity at the desired radius from the origin.

    Args:
        entities (list[str]): The entities value.
        angle (float): The angle value.
        count (int): The count value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="sketch_circular_pattern is not implemented by this adapter",
    )
sketch_convert_entities async
sketch_convert_entities(edge_points: list[list[float]] | None = None, face_point: list[float] | None = None, construction: bool = False) -> AdapterResult[dict[str, Any]]

Copy model edges or a face outline into the open sketch.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def sketch_convert_entities(
    self,
    edge_points: list[list[float]] | None = None,
    face_point: list[float] | None = None,
    construction: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Copy model edges or a face outline into the open sketch.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="sketch_convert_entities is not implemented by this adapter",
    )
sketch_extend async
sketch_extend(point: list[float]) -> AdapterResult[dict[str, Any]]

Extend a sketch entity from its end nearest a point.

Parameters:

Name Type Description Default
point list[float]

[x, y] sketch mm near the end to extend.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: point, segments_before and

AdapterResult[dict[str, Any]]

segments_after.

Source code in src/solidworks_mcp/adapters/base.py
async def sketch_extend(self, point: list[float]) -> AdapterResult[dict[str, Any]]:
    """Extend a sketch entity from its end nearest a point.

    Args:
        point (list[float]): ``[x, y]`` sketch mm near the end to extend.

    Returns:
        AdapterResult[dict[str, Any]]: ``point``, ``segments_before`` and
        ``segments_after``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="sketch_extend is not implemented by this adapter",
    )
sketch_linear_pattern async
sketch_linear_pattern(entities: list[str], direction_x: float, direction_y: float, spacing: float, count: int) -> AdapterResult[str]

Create a linear pattern of sketch entities.

Parameters:

Name Type Description Default
entities list[str]

The entities value.

required
direction_x float

The direction x value.

required
direction_y float

The direction y value.

required
spacing float

The spacing value.

required
count int

The count value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def sketch_linear_pattern(
    self,
    entities: list[str],
    direction_x: float,
    direction_y: float,
    spacing: float,
    count: int,
) -> AdapterResult[str]:
    """Create a linear pattern of sketch entities.

    Args:
        entities (list[str]): The entities value.
        direction_x (float): The direction x value.
        direction_y (float): The direction y value.
        spacing (float): The spacing value.
        count (int): The count value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="sketch_linear_pattern is not implemented by this adapter",
    )
sketch_mirror async
sketch_mirror(entities: list[str], mirror_line: str) -> AdapterResult[str]

Mirror sketch entities about a mirror line.

Parameters:

Name Type Description Default
entities list[str]

The entities value.

required
mirror_line str

The mirror line value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def sketch_mirror(
    self, entities: list[str], mirror_line: str
) -> AdapterResult[str]:
    """Mirror sketch entities about a mirror line.

    Args:
        entities (list[str]): The entities value.
        mirror_line (str): The mirror line value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="sketch_mirror is not implemented by this adapter",
    )
sketch_offset async
sketch_offset(entities: list[str], offset_distance: float, reverse_direction: bool) -> AdapterResult[str]

Offset sketch entities.

Parameters:

Name Type Description Default
entities list[str]

The entities value.

required
offset_distance float

The offset distance value.

required
reverse_direction bool

The reverse direction value.

required

Returns:

Type Description
AdapterResult[str]

AdapterResult[str]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
async def sketch_offset(
    self,
    entities: list[str],
    offset_distance: float,
    reverse_direction: bool,
) -> AdapterResult[str]:
    """Offset sketch entities.

    Args:
        entities (list[str]): The entities value.
        offset_distance (float): The offset distance value.
        reverse_direction (bool): The reverse direction value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="sketch_offset is not implemented by this adapter",
    )
sketch_trim async
sketch_trim(point: list[float]) -> AdapterResult[dict[str, Any]]

Trim the piece of a sketch entity nearest a point.

Parameters:

Name Type Description Default
point list[float]

[x, y] sketch mm on the piece to remove.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: point, segments_before and

AdapterResult[dict[str, Any]]

segments_after.

Source code in src/solidworks_mcp/adapters/base.py
async def sketch_trim(self, point: list[float]) -> AdapterResult[dict[str, Any]]:
    """Trim the piece of a sketch entity nearest a point.

    Args:
        point (list[float]): ``[x, y]`` sketch mm on the piece to remove.

    Returns:
        AdapterResult[dict[str, Any]]: ``point``, ``segments_before`` and
        ``segments_after``.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="sketch_trim is not implemented by this adapter",
    )
suppress_feature async
suppress_feature(name: str, suppress: bool = True, configurations: str | list[str] = 'this') -> AdapterResult[dict[str, Any]]

Suppress or unsuppress a named feature.

Parameters:

Name Type Description Default
name str

Feature name.

required
suppress bool

True to suppress, False to unsuppress.

True
configurations str | list[str]

"this", "all" or names.

'this'

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The resulting state, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def suppress_feature(
    self, name: str, suppress: bool = True, configurations: str | list[str] = "this"
) -> AdapterResult[dict[str, Any]]:
    """Suppress or unsuppress a named feature.

    Args:
        name (str): Feature name.
        suppress (bool): True to suppress, False to unsuppress.
        configurations (str | list[str]): "this", "all" or names.

    Returns:
        AdapterResult[dict[str, Any]]: The resulting state, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="suppress_feature is not implemented by this adapter",
    )
undo async
undo(count: int = 1) -> AdapterResult[dict[str, Any]]

Undo the last operations in the active model.

Parameters:

Name Type Description Default
count int

Number of steps to undo.

1

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Whether the tree changed, or error.

Source code in src/solidworks_mcp/adapters/base.py
async def undo(self, count: int = 1) -> AdapterResult[dict[str, Any]]:
    """Undo the last operations in the active model.

    Args:
        count (int): Number of steps to undo.

    Returns:
        AdapterResult[dict[str, Any]]: Whether the tree changed, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="undo is not implemented by this adapter",
    )
update_metrics
update_metrics(operation_time: float, success: bool) -> None

Update adapter metrics.

Parameters:

Name Type Description Default
operation_time float

The operation time value.

required
success bool

The success value.

required

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/base.py
def update_metrics(self, operation_time: float, success: bool) -> None:
    """Update adapter metrics.

    Args:
        operation_time (float): The operation time value.
        success (bool): The success value.

    Returns:
        None: None.
    """
    self._metrics["operations_count"] += 1
    if not success:
        self._metrics["errors_count"] += 1

    # Update average response time
    current_avg = self._metrics["average_response_time"]
    count = self._metrics["operations_count"]
    self._metrics["average_response_time"] = (
        current_avg * (count - 1) + operation_time
    ) / count
update_sheet_format async
update_sheet_format(sheet_format: str, paper_size: str | None = None) -> AdapterResult[dict[str, Any]]

Change the active sheet's format and paper size, keeping its views.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def update_sheet_format(
    self,
    sheet_format: str,
    paper_size: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Change the active sheet's format and paper size, keeping its views.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="update_sheet_format is not implemented by this adapter",
    )
update_title_block async
update_title_block(fields: dict[str, str]) -> AdapterResult[dict[str, Any]]

Write title-block fields on the active drawing.

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: Not implemented by this adapter.

Source code in src/solidworks_mcp/adapters/base.py
async def update_title_block(
    self,
    fields: dict[str, str],
) -> AdapterResult[dict[str, Any]]:
    """Write title-block fields on the active drawing.

    Returns:
        AdapterResult[dict[str, Any]]: Not implemented by this adapter.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="update_title_block is not implemented by this adapter",
    )

Functions:

normalize_input

normalize_input(input_data: Any, model_type: type[TModel]) -> TModel

Validate input_data as model_type.

Parameters:

Name Type Description Default
input_data Any

A model_type instance, a mapping of its fields, another pydantic model (converted through model_dump), or None for a tool whose fields all have defaults.

required
model_type type[TModel]

The tool's pydantic input model.

required

Returns:

Name Type Description
TModel TModel

The validated model.

Raises:

Type Description
InvalidInputError

Naming the offending field(s).

Source code in src/solidworks_mcp/tools/tool_boundary.py
def normalize_input[TModel: BaseModel](
    input_data: Any, model_type: type[TModel]
) -> TModel:
    """Validate ``input_data`` as ``model_type``.

    Args:
        input_data: A ``model_type`` instance, a mapping of its fields, another
            pydantic model (converted through ``model_dump``), or ``None`` for
            a tool whose fields all have defaults.
        model_type: The tool's pydantic input model.

    Returns:
        TModel: The validated model.

    Raises:
        InvalidInputError: Naming the offending field(s).
    """
    if isinstance(input_data, model_type):
        return input_data
    if input_data is None:
        input_data = {}
    elif not isinstance(input_data, dict) and hasattr(input_data, "model_dump"):
        input_data = input_data.model_dump()
    try:
        return model_type.model_validate(input_data)
    except ValidationError as exc:  # also wraps ValueErrors from validators
        raise InvalidInputError(describe_validation_error(exc)) from exc

register_sketching_tools async

register_sketching_tools(mcp: FastMCP, adapter: SolidWorksAdapter, config: dict[str, Any]) -> int

Register sketching tools with FastMCP.

Registers comprehensive sketching tools for SolidWorks automation including geometry creation, constraints, dimensions, and pattern operations.

Parameters:

Name Type Description Default
mcp FastMCP

The mcp value.

required
adapter SolidWorksAdapter

Adapter instance used for the operation.

required
config dict[str, Any]

Configuration values for the operation.

required

Returns:

Name Type Description
int int

The computed numeric result.

Example
from solidworks_mcp.tools.sketching import register_sketching_tools

tool_count = await register_sketching_tools(mcp, adapter, config)
print(f"Registered {tool_count} sketching tools")
Source code in src/solidworks_mcp/tools/sketching.py
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
async def register_sketching_tools(
    mcp: FastMCP, adapter: SolidWorksAdapter, config: dict[str, Any]
) -> int:
    """Register sketching tools with FastMCP.

    Registers comprehensive sketching tools for SolidWorks automation including geometry
    creation, constraints, dimensions, and pattern operations.

    Args:
        mcp (FastMCP): The mcp value.
        adapter (SolidWorksAdapter): Adapter instance used for the operation.
        config (dict[str, Any]): Configuration values for the operation.

    Returns:
        int: The computed numeric result.

    Example:
                        ```python
                        from solidworks_mcp.tools.sketching import register_sketching_tools

                        tool_count = await register_sketching_tools(mcp, adapter, config)
                        print(f"Registered {tool_count} sketching tools")
                        ```
    """
    mcp = with_tool_boundary(mcp)
    tool_count = 0
    # SolidWorks won't rename a sketch while it is open for editing (it
    # accepts the name, but the tree keeps the old one), so the name
    # create_sketch was asked for is given when exit_sketch closes it:
    # SolidWorks' name -> the name asked for.
    names_on_exit: dict[str, str] = {}

    async def _honour_construction(entity_id: Any, construction: bool) -> None:
        """Make a new entity construction geometry when ``construction`` asks.

        The drawing calls themselves draw normal geometry on SolidWorks, so a
        tool's ``construction`` flag is applied afterwards, by id.
        """
        if not construction or not entity_id:
            return
        made = await adapter.set_construction_geometry([str(entity_id)], True)
        require_success(made, context="Failed to make it construction geometry")

    @mcp.tool()
    async def create_sketch(input_data: CreateSketchInput) -> dict[str, Any]:
        """Open a new sketch on a plane or a flat face of the active part, ready for lines, circles and other sketch entities.

        Use it first in every feature: sketch, draw, `exit_sketch`, then
        `create_extrusion` or `create_cut_extrude`. Planes: Front, Top, Right (or XY,
        XZ, YZ), or a plane made by `create_reference_plane`. Or give `face_point`, a
        point in mm on a flat face of the body: the sketch opens on that face and moves
        with it when the model changes. Coordinates in the sketch are mm from the
        origin. Needs: an open part. Changes: adds a sketch and opens it for editing;
        give `sketch_name` and `exit_sketch` names it that when it closes it (SolidWorks
        won't rename an open sketch). Returns: `sketch` with `name` (the name in the
        feature tree now) and `plane` (or `face_point`), plus `name_on_exit` when you
        gave `sketch_name`. A `face_point` not on a flat face fails with
        `invalid_input`.

        Args:
            input_data: The sketch. Exactly one of `plane` and `face_point`;
                `sketch_name` names it.

        Returns:
            dict[str, Any]: The new sketch.
        """
        input_data = normalize_input(input_data, CreateSketchInput)
        face_point = (
            (
                float(input_data.face_point[0]),
                float(input_data.face_point[1]),
                float(input_data.face_point[2]),
            )
            if input_data.face_point is not None
            else None
        )
        if face_point is None:
            result = await adapter.create_sketch(input_data.plane)
            where = f"{input_data.plane} plane"
        else:
            result = await adapter.create_sketch(None, face_point)
            where = f"the face at {list(face_point)} mm"

        require_success(result, context="Failed to create sketch")
        sketch_name = (
            result.data.get("sketch_name")
            if isinstance(result.data, dict)
            else result.data
        )
        sketch: dict[str, Any] = {"name": sketch_name, "plane": input_data.plane}
        if face_point is not None:
            sketch["face_point"] = list(face_point)
        reply: dict[str, Any] = {
            "status": "success",
            "message": f"Created sketch '{sketch_name}' on {where}",
            "sketch": sketch,
            "execution_time": result.execution_time,
        }
        names_on_exit.clear()  # a sketch left open is abandoned with its name
        wanted = (input_data.sketch_name or "").strip()
        if wanted and wanted != sketch_name:
            names_on_exit[str(sketch_name)] = wanted
            reply["sketch"]["name_on_exit"] = wanted
            reply["message"] += f"; exit_sketch names it '{wanted}'"
        return reply

    @mcp.tool()
    async def add_line(input_data: AddLineInput) -> dict[str, Any]:
        """Draw a straight line between two points in the open sketch, in mm.

        Use it for profiles made of straight edges; for a closed box, use
        `add_rectangle`, and for a revolve axis, `add_centerline`. Needs: an open sketch
        (`create_sketch`). Changes: adds a line (a construction line with
        `construction`). Returns: `line` with `id`, `start`, `end` and `length`. Its
        `id` is what `add_sketch_constraint` and `add_sketch_dimension` take.

        Args:
            input_data: The line. Give `x1`, `y1`, `x2`, `y2` (mm; or `start_x`,
                `start_y`, `end_x`, `end_y`); `construction` is off.

        Returns:
            dict[str, Any]: The line added.
        """
        input_data = normalize_input(input_data, AddLineInput)
        if hasattr(adapter, "add_sketch_line"):
            result = await adapter.add_sketch_line(
                input_data.x1,
                input_data.y1,
                input_data.x2,
                input_data.y2,
                input_data.construction,
            )
        else:
            result = await adapter.add_line(
                input_data.x1,  # type: ignore[arg-type]
                input_data.y1,  # type: ignore[arg-type]
                input_data.x2,  # type: ignore[arg-type]
                input_data.y2,  # type: ignore[arg-type]
            )

        require_success(result, context="Failed to add line")
        line_id = (
            result.data.get("entity_id") or result.data.get("id")
            if isinstance(result.data, dict)
            else result.data
        )
        await _honour_construction(line_id, input_data.construction)
        x1, y1 = input_data.x1 or 0.0, input_data.y1 or 0.0
        x2, y2 = input_data.x2 or 0.0, input_data.y2 or 0.0
        return {
            "status": "success",
            "message": f"Added line from ({x1}, {y1}) to ({x2}, {y2})",
            "line": {
                "id": line_id,
                "start": {"x": x1, "y": y1},
                "end": {"x": x2, "y": y2},
                "construction": input_data.construction,
                "length": ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_circle(input_data: AddCircleInput) -> dict[str, Any]:
        """Draw a circle in the open sketch from its centre and radius, in mm.

        Use it for holes and round bosses. Needs: an open sketch (`create_sketch`).
        Changes: adds a circle (a construction circle with `construction`). Returns:
        `circle` with `id`, `center`, `radius` and `diameter`. Its `id` is what
        `add_sketch_constraint` and `add_sketch_dimension` take.

        Args:
            input_data: The circle. `center_x`, `center_y` and `radius` (mm) are
                required; `construction` is off.

        Returns:
            dict[str, Any]: The circle added.
        """
        input_data = normalize_input(input_data, AddCircleInput)
        if hasattr(adapter, "add_sketch_circle"):
            result = await adapter.add_sketch_circle(
                input_data.center_x,
                input_data.center_y,
                input_data.radius,
                input_data.construction,
            )
        else:
            result = await adapter.add_circle(
                input_data.center_x, input_data.center_y, input_data.radius
            )

        require_success(result, context="Failed to add circle")
        circle_id = (
            result.data.get("entity_id")
            if isinstance(result.data, dict)
            else result.data
        )
        await _honour_construction(circle_id, input_data.construction)
        return {
            "status": "success",
            "message": f"Added circle at ({input_data.center_x}, {input_data.center_y}) with radius {input_data.radius}mm",
            "circle": {
                "id": circle_id,
                "center": {"x": input_data.center_x, "y": input_data.center_y},
                "radius": input_data.radius,
                "construction": input_data.construction,
                "diameter": input_data.radius * 2,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_rectangle(input_data: AddRectangleInput) -> dict[str, Any]:
        """Draw a closed, axis-aligned rectangle in the open sketch from two opposite corners, in mm.

        Use it for blocks, plates and rectangular cut-outs. Needs: an open sketch
        (`create_sketch`). Changes: adds four connected lines. Returns: `rectangle` with
        `id`, `corner1`, `corner2`, `width`, `height` and `area`. Its `id` is what
        `add_sketch_constraint` and `add_sketch_dimension` take.

        Args:
            input_data: The rectangle. Give `x1`, `y1`, `x2`, `y2` (mm; or
                `corner1_x` ... `corner2_y`); `construction` is off.

        Returns:
            dict[str, Any]: The rectangle added.
        """
        input_data = normalize_input(input_data, AddRectangleInput)
        if input_data.from_center:
            result = await adapter.add_rectangle(
                input_data.x1,  # type: ignore[arg-type]
                input_data.y1,  # type: ignore[arg-type]
                input_data.x2,  # type: ignore[arg-type]
                input_data.y2,  # type: ignore[arg-type]
                True,
            )
        elif hasattr(adapter, "add_sketch_rectangle"):
            result = await adapter.add_sketch_rectangle(
                input_data.x1,
                input_data.y1,
                input_data.x2,
                input_data.y2,
                input_data.construction,
            )
        else:
            result = await adapter.add_rectangle(
                input_data.x1,  # type: ignore[arg-type]
                input_data.y1,  # type: ignore[arg-type]
                input_data.x2,  # type: ignore[arg-type]
                input_data.y2,  # type: ignore[arg-type]
            )

        require_success(result, context="Failed to add rectangle")
        rect_id = (
            result.data.get("entity_id")
            if isinstance(result.data, dict)
            else result.data
        )
        await _honour_construction(rect_id, input_data.construction)
        rx1, ry1 = input_data.x1 or 0.0, input_data.y1 or 0.0
        rx2, ry2 = input_data.x2 or 0.0, input_data.y2 or 0.0
        if input_data.from_center:
            # x1, y1 is the centre: the real corners mirror x2, y2 through it.
            rx1, ry1 = 2 * rx1 - rx2, 2 * ry1 - ry2
        width = abs(rx2 - rx1)
        height = abs(ry2 - ry1)

        return {
            "status": "success",
            "message": f"Added rectangle from ({rx1}, {ry1}) to ({rx2}, {ry2})",
            "rectangle": {
                "id": rect_id,
                "from_center": input_data.from_center,
                "corner1": {"x": rx1, "y": ry1},
                "corner2": {"x": rx2, "y": ry2},
                "construction": input_data.construction,
                "width": width,
                "height": height,
                "area": width * height,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def exit_sketch() -> dict[str, Any]:
        """Close the open sketch so a feature can use it.

        Call it after drawing and before `create_extrusion`, `create_revolve` or
        `create_cut_extrude`; those use the sketch closed last. Needs: an open sketch.
        Changes: leaves sketch editing; the sketch stays in the feature tree, renamed
        to the `sketch_name` `create_sketch` was given. Returns: a message, plus, after
        a `sketch_name`, `sketch` with `name` (the name in the feature tree, which later
        tools take as `sketch_name`) and a `warning` when the name couldn't be given
        (another feature has it).
        """
        result = await adapter.exit_sketch()

        require_success(result, context="Failed to exit sketch")
        reply: dict[str, Any] = {
            "status": "success",
            "message": "Exited sketch editing mode",
            "execution_time": result.execution_time,
        }
        if names_on_exit:
            current, wanted = names_on_exit.popitem()
            renamed = await adapter.rename_feature(current, wanted)
            name = current
            if renamed.is_success:
                name = (renamed.data or {}).get("new_name") or wanted
            else:
                reply["warning"] = (
                    f"The sketch keeps SolidWorks' name '{current}': it could "
                    f"not be named '{wanted}' ({renamed.error})."
                )
            reply["sketch"] = {"name": name}
        return reply

    @mcp.tool()
    async def check_sketch_fully_defined(
        input_data: CheckSketchDefinitionInput | None = None,
    ) -> dict[str, Any]:
        """Check whether a sketch is fully defined, under-defined or over-defined.

        Use it after adding relations and dimensions, to see if the sketch still has
        free geometry. Needs: an open part with the sketch. Read-only. Returns: `sketch`
        with `sketch_name`, `is_fully_defined` (null when unknown), `definition_state`
        and where the answer came from (`source`).

        Args:
            input_data: Nothing is required: give `sketch_name`, or omit it for the
                open or last sketch.

        Returns:
            dict[str, Any]: The definition state.
        """
        normalized = normalize_input(
            input_data or {},
            CheckSketchDefinitionInput,
        )
        result = await adapter.check_sketch_fully_defined(normalized.sketch_name)

        require_success(result, context="Failed to inspect sketch definition")

        payload = result.data or {}
        state = payload.get("definition_state", "unknown")
        return {
            "status": "success",
            "message": f"Sketch definition state: {state}",
            "sketch": payload,
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_arc(input_data: AddArcInput) -> dict[str, Any]:
        """Draw a circular arc in the open sketch: from its centre, through three points, or tangent.

        Use it for rounded ends and curved edges of a profile. `kind` `center` (the
        default) takes the centre, start and end, counter-clockwise; `three_point`
        takes start, end and a point the arc passes through (`through_x`,
        `through_y`); `tangent` starts at the end of an existing entity (`start`) and
        leaves tangent to it. Needs: an open sketch (`create_sketch`). Changes: adds an
        arc. Returns: `arc` with `id`, `kind`, `center`, `start_point` and
        `end_point`. Its `id` is what `add_sketch_constraint` and
        `add_sketch_dimension` take.

        Args:
            input_data: The arc. `start_x`, `start_y`, `end_x` and `end_y` (mm) are
                required; `center_x`, `center_y` for `center`; `through_x`,
                `through_y` for `three_point`.

        Returns:
            dict[str, Any]: The arc added.
        """
        input_data = normalize_input(input_data, AddArcInput)
        through = (
            (input_data.through_x, input_data.through_y)
            if input_data.through_x is not None and input_data.through_y is not None
            else None
        )
        result = await adapter.add_arc(
            input_data.center_x or 0.0,
            input_data.center_y or 0.0,
            input_data.start_x,
            input_data.start_y,
            input_data.end_x,
            input_data.end_y,
            input_data.kind,
            through,
        )

        require_success(result, context="Failed to add arc")
        arc_id = result.data
        center = (
            {"x": input_data.center_x, "y": input_data.center_y}
            if input_data.kind == "center"
            else None
        )
        return {
            "status": "success",
            "message": f"Added a {input_data.kind} arc from "
            f"({input_data.start_x}, {input_data.start_y}) to "
            f"({input_data.end_x}, {input_data.end_y})",
            "arc": {
                "id": arc_id,
                "kind": input_data.kind,
                "center": center,
                "through": (
                    {"x": through[0], "y": through[1]} if through is not None else None
                ),
                "start_point": {
                    "x": input_data.start_x,
                    "y": input_data.start_y,
                },
                "end_point": {"x": input_data.end_x, "y": input_data.end_y},
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_spline(input_data: AddSplineInput) -> dict[str, Any]:
        """Draw a smooth spline through a list of points in the open sketch, in mm.

        Use it for free-form curves such as an aerofoil or a handle profile. Needs: an
        open sketch (`create_sketch`). Changes: adds a spline. Returns: `spline` with
        `id`, `control_points` and `point_count`.

        Args:
            input_data: The spline. `points` (a list of {"x", "y"} in mm) is
                required.

        Returns:
            dict[str, Any]: The spline added.
        """
        result = await adapter.add_spline(input_data.points)

        require_success(result, context="Failed to add spline")
        spline_id = result.data
        return {
            "status": "success",
            "message": f"Added spline with {len(input_data.points)} control points",
            "spline": {
                "id": spline_id,
                "control_points": input_data.points,
                "point_count": len(input_data.points),
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_centerline(input_data: AddLineInput) -> dict[str, Any]:
        """Draw a centreline (construction line) in the open sketch, in mm.

        Use it as the axis for `create_revolve`, or as the line for `sketch_mirror` and
        symmetric relations. It is never part of the profile. Needs: an open sketch
        (`create_sketch`). Changes: adds a centreline. Returns: `centerline` with `id`,
        `start_point` and `end_point`.

        Args:
            input_data: The line. Give `x1`, `y1`, `x2`, `y2` (mm; or `start_x`,
                `start_y`, `end_x`, `end_y`); `construction` is not used.

        Returns:
            dict[str, Any]: The centreline added.
        """
        input_data = normalize_input(input_data, AddLineInput)

        result = await adapter.add_centerline(
            input_data.x1,  # type: ignore[arg-type]
            input_data.y1,  # type: ignore[arg-type]
            input_data.x2,  # type: ignore[arg-type]
            input_data.y2,  # type: ignore[arg-type]
        )

        require_success(result, context="Failed to add centerline")
        centerline_id = result.data
        return {
            "status": "success",
            "message": f"Added centerline from ({input_data.x1}, {input_data.y1}) to ({input_data.x2}, {input_data.y2})",
            "centerline": {
                "id": centerline_id,
                "start_point": {"x": input_data.x1, "y": input_data.y1},
                "end_point": {"x": input_data.x2, "y": input_data.y2},
                "type": "construction",
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_polygon(input_data: dict[str, Any]) -> dict[str, Any]:
        """Draw a regular polygon (e.g. a hexagon) in the open sketch from its centre, radius and number of sides.

        Use it for nuts, hex bosses and pockets. Needs: an open sketch
        (`create_sketch`). Changes: adds the polygon's sides. Returns: `polygon` with
        `id`, `center`, `radius`, `sides` and `angle`. A `diameter` dimension
        (`add_sketch_dimension`) on its `id` sizes it by the circle drawn inside it.

        Args:
            input_data: A mapping: `center_x`, `center_y` (mm, default 0), `radius`
                (mm, circumscribed, default 10), `sides` (default 6) and `angle`
                (degrees the first corner is turned from +x, default 0).

        Returns:
            dict[str, Any]: The polygon added.
        """
        center_x = input_data.get("center_x", 0.0)
        center_y = input_data.get("center_y", 0.0)
        radius = input_data.get("radius", 10.0)
        sides = input_data.get("sides", 6)
        angle = float(input_data.get("angle", 0.0))

        result = await adapter.add_polygon(center_x, center_y, radius, sides, angle)

        require_success(result, context="Failed to add polygon")
        polygon_id = result.data
        return {
            "status": "success",
            "message": f"Added {sides}-sided polygon at ({center_x}, {center_y}) with radius {radius}mm",
            "polygon": {
                "id": polygon_id,
                "center": {"x": center_x, "y": center_y},
                "radius": radius,
                "sides": sides,
                "angle": angle,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_ellipse(input_data: dict[str, Any]) -> dict[str, Any]:
        """Draw an ellipse in the open sketch from its centre and axis lengths, in mm.

        Use it for oval holes and bosses. Needs: an open sketch (`create_sketch`).
        Changes: adds an ellipse. Returns: `ellipse` with `id`, `center`, `major_axis`,
        `minor_axis` and `angle`.

        Args:
            input_data: A mapping: `center_x`, `center_y` (mm, default 0),
                `major_axis` (default 20) and `minor_axis` (default 10), in mm, and
                `angle`, the major axis's turn from +x in degrees (default 0).

        Returns:
            dict[str, Any]: The ellipse added.
        """
        center_x = input_data.get("center_x", 0.0)
        center_y = input_data.get("center_y", 0.0)
        major_axis = input_data.get("major_axis", 20.0)
        minor_axis = input_data.get("minor_axis", 10.0)
        angle = input_data.get("angle", 0.0)

        result = await adapter.add_ellipse(
            center_x, center_y, major_axis, minor_axis, angle
        )

        require_success(result, context="Failed to add ellipse")
        ellipse_id = result.data
        return {
            "status": "success",
            "message": f"Added ellipse at ({center_x}, {center_y}) with axes {major_axis}x{minor_axis}mm",
            "ellipse": {
                "id": ellipse_id,
                "center": {"x": center_x, "y": center_y},
                "major_axis": major_axis,
                "minor_axis": minor_axis,
                "angle": angle,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_sketch_text(input_data: AddSketchTextInput) -> dict[str, Any]:
        """Write text in the open sketch, at a point or centred on one, to deboss or emboss it.

        Use it for lettering, then cut (`create_cut_extrude`) or extrude the sketch.
        `center_at` (a model point in mm) puts the text's middle there; otherwise it
        starts at `x`, `y`. `$PRP:"name"` in the text shows a custom property;
        one holding a dimension's name (`"D1@Sketch3"`, set with `set_custom_property`)
        makes the text follow that dimension. To read from a face's own side, such as
        an underside, open the sketch on that face (`create_sketch` `face_point`).
        Needs: an open sketch (`create_sketch`). Changes: adds text. Returns: the
        text's `id`, the `text` as SolidWorks shows it (links resolved) and its
        `height`.

        Args:
            input_data: The text. `text` is required; `x`, `y` (mm), `height` (3.5
                mm) and `center_at` have defaults.

        Returns:
            dict[str, Any]: The text added.
        """
        input_data = normalize_input(input_data, AddSketchTextInput)
        result = await adapter.add_sketch_text(
            input_data.text,
            input_data.x,
            input_data.y,
            input_data.height,
            input_data.center_at,
        )
        require_success(result, context="Failed to add sketch text")
        added: dict[str, Any] = result.data or {}
        return {
            "status": "success",
            "message": f"Added text {added['text']!r}, {added['height']} mm high",
            "sketch_text": {
                **added,
                "center_at": input_data.center_at,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def set_sketch_text(input_data: SetSketchTextInput) -> dict[str, Any]:
        """Rewrite the text in a sketch and rebuild, so debossed lettering shows it.

        Use it after a change the text should follow: SolidWorks doesn't redraw sketch
        text on rebuild, not even a `$PRP:` link to a dimension an equation changed.
        Give the same `$PRP:"name"` text to re-read the link, or new text. The sketch
        is opened, its text rewritten, closed, and the model rebuilt, so a cut made
        from it changes too. Needs: a part with that sketch, holding text from
        `add_sketch_text`. Changes: the sketch's text. Returns: the `sketch`, each
        text `before` and `after` (links resolved).

        Args:
            input_data: `sketch_name` and `text`, both required.

        Returns:
            dict[str, Any]: The text before and after.
        """
        input_data = normalize_input(input_data, SetSketchTextInput)
        result = await adapter.set_sketch_text(input_data.sketch_name, input_data.text)
        require_success(result, context="Failed to rewrite the sketch text")
        changed: dict[str, Any] = result.data or {}
        return {
            "status": "success",
            "message": f"{input_data.sketch_name} now reads {changed.get('after')}",
            "sketch_text": changed,
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_sketch_constraint(input_data: AddRelationInput) -> dict[str, Any]:
        """Add a geometric relation between sketch entities: horizontal, vertical, parallel, perpendicular, tangent, coincident, concentric, equal, symmetric, collinear or fix.

        Use it to hold design intent, then check with `check_sketch_fully_defined`.
        Entities are the `id`s the add_* tools returned. Needs: an open sketch
        (`create_sketch`). Changes: adds the relation. Returns: `constraint` with `id`,
        `type` and the entities.

        Args:
            input_data: The relation. `entity1` and `relation_type` are required;
                `entity2` when the relation needs two, and `entity3` (the
                centreline) only for symmetric.

        Returns:
            dict[str, Any]: The relation added.
        """
        input_data = normalize_input(input_data, AddRelationInput)
        result = await adapter.add_sketch_constraint(
            input_data.entity1,
            input_data.entity2,
            input_data.relation_type,
            input_data.entity3,
        )

        require_success(result, context="Failed to add constraint")
        constraint_id = result.data
        return {
            "status": "success",
            "message": f"Added {input_data.relation_type} constraint between {input_data.entity1} and {input_data.entity2}",
            "constraint": {
                "id": constraint_id,
                "type": input_data.relation_type,
                "entity1": input_data.entity1,
                "entity2": input_data.entity2,
                "entity3": input_data.entity3,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_sketch_dimension(input_data: AddDimensionInput) -> dict[str, Any]:
        """Add a driving dimension to sketch entities: linear, angular, radial, diameter or an ellipse axis.

        Use it to fix a size so the sketch is fully defined and can be changed later
        with `set_dimension`. Entities are the `id`s the add_* tools returned; two
        connected lines for angular, a circle or arc for radial or diameter, an
        ellipse for `major_axis` or `minor_axis` (`value` is the whole axis; the
        dimension runs from the centre, so it shows half). No dialog opens. Needs: an open sketch (`create_sketch`). Changes: adds the dimension and
        resizes the geometry to `value`. Returns: `dimension` with `id`, `type`, `value`
        and the entities.

        Args:
            input_data: The dimension. `entity1` and `value` (mm, or degrees for
                angular) are required; `entity2` and `dimension_type` (linear) have
                defaults.

        Returns:
            dict[str, Any]: The dimension added.
        """
        input_data = normalize_input(input_data, AddDimensionInput)
        result = await adapter.add_sketch_dimension(
            input_data.entity1,
            input_data.entity2,
            input_data.dimension_type,
            input_data.value,
        )

        require_success(result, context="Failed to add dimension")
        dimension_id = result.data
        return {
            "status": "success",
            "message": f"Added {input_data.dimension_type} dimension of {input_data.value}mm to {input_data.entity1}",
            "dimension": {
                "id": dimension_id,
                "type": input_data.dimension_type,
                "value": input_data.value,
                "entity1": input_data.entity1,
                "entity2": input_data.entity2,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def sketch_linear_pattern(input_data: dict[str, Any]) -> dict[str, Any]:
        """Repeat sketch entities in a straight line at a fixed spacing.

        Use it for rows of holes or slots before one cut. Needs: an open sketch
        (`create_sketch`). Changes: adds copies of the entities. Returns: `pattern` with
        `id`, `entities`, `count`, `spacing` and `direction`.

        Args:
            input_data: A mapping: `entities` (ids to repeat), `direction_x`/
                `direction_y` (default 1, 0), `spacing` (mm, default 10) and
                `count` (instances, default 3).

        Returns:
            dict[str, Any]: The pattern added.
        """
        entities = input_data.get("entities", [])
        direction_x = input_data.get("direction_x", 1.0)
        direction_y = input_data.get("direction_y", 0.0)
        spacing = input_data.get("spacing", 10.0)
        count = input_data.get("count", 3)

        result = await adapter.sketch_linear_pattern(
            entities, direction_x, direction_y, spacing, count
        )

        require_success(result, context="Failed to create linear pattern")
        pattern_id = result.data
        return {
            "status": "success",
            "message": f"Created linear pattern with {count} instances, spacing {spacing}mm",
            "pattern": {
                "id": pattern_id,
                "type": "linear",
                "entities": entities,
                "count": count,
                "spacing": spacing,
                "direction": {"x": direction_x, "y": direction_y},
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def sketch_circular_pattern(input_data: dict[str, Any]) -> dict[str, Any]:
        """Repeat sketch entities around the sketch origin, e.g. a bolt circle.

        The centre is always the sketch origin, so draw the first entity at the radius
        you want from it. Then cut once with `create_cut_extrude`. Needs: an open sketch
        (`create_sketch`). Changes: adds copies of the entities. Returns: `pattern` with
        `id`, `entities`, `count` and `angle`.

        Args:
            input_data: A mapping: `entities` (ids to repeat), `count` (instances,
                default 6) and `angle` (degrees spread over, default 360).

        Returns:
            dict[str, Any]: The pattern added.
        """
        entities = input_data.get("entities", [])
        angle = input_data.get("angle", 360.0)
        count = input_data.get("count", 6)

        result = await adapter.sketch_circular_pattern(entities, angle, count)

        require_success(result, context="Failed to create circular pattern")
        pattern_id = result.data
        return {
            "status": "success",
            "message": (
                f"Created circular pattern with {count} instances "
                "around the sketch origin"
            ),
            "pattern": {
                "id": pattern_id,
                "type": "circular",
                "entities": entities,
                "count": count,
                "center": {"x": 0.0, "y": 0.0},
                "angle": angle,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def sketch_mirror(input_data: dict[str, Any]) -> dict[str, Any]:
        """Mirror sketch entities about a centreline in the open sketch.

        Use it for symmetric profiles: draw one half, add a centreline with
        `add_centerline`, then mirror. Needs: an open sketch (`create_sketch`). Changes:
        adds mirrored copies. Returns: `mirror` with `id`, `entities` and `mirror_line`.

        Args:
            input_data: A mapping: `entities` (ids to mirror) and `mirror_line`
                (the centreline's id).

        Returns:
            dict[str, Any]: The mirror added.
        """
        entities = input_data.get("entities", [])
        mirror_line = input_data.get("mirror_line", "")

        result = await adapter.sketch_mirror(entities, mirror_line)

        require_success(result, context="Failed to mirror entities")
        mirror_id = result.data
        return {
            "status": "success",
            "message": f"Mirrored {len(entities)} entities about {mirror_line}",
            "mirror": {
                "id": mirror_id,
                "entities": entities,
                "mirror_line": mirror_line,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def sketch_offset(input_data: dict[str, Any]) -> dict[str, Any]:
        """Offset sketch entities by a distance in mm, outward or inward, e.g. for a wall or a clearance.

        Needs: an open sketch (`create_sketch`). Changes: adds the offset entities.
        Returns: `offset` with `id`, `entities`, `distance` and `direction` (outward or
        inward).

        Args:
            input_data: A mapping: `entities` (ids to offset), `offset_distance`
                (mm, default 5) and `reverse_direction` (inward; default off).

        Returns:
            dict[str, Any]: The offset added.
        """
        entities = input_data.get("entities", [])
        offset_distance = input_data.get("offset_distance", 5.0)
        reverse_direction = input_data.get("reverse_direction", False)

        result = await adapter.sketch_offset(
            entities, offset_distance, reverse_direction
        )

        require_success(result, context="Failed to create offset")
        offset_id = result.data
        direction = "outward" if not reverse_direction else "inward"
        return {
            "status": "success",
            "message": f"Created offset of {len(entities)} entities by {offset_distance}mm ({direction})",
            "offset": {
                "id": offset_id,
                "entities": entities,
                "distance": offset_distance,
                "direction": direction,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def sketch_convert_entities(
        input_data: SketchConvertEntitiesInput,
    ) -> dict[str, Any]:
        """Copy model edges, or a face's whole outline, into the open sketch (Convert Entities).

        Use it to sketch on an existing edge exactly, e.g. to cut a pocket that
        follows a face, instead of re-drawing it at guessed coordinates. Pick edges
        or a face with a point on each (mm). Needs: an open sketch
        (`create_sketch`) and a part with those edges. Changes: adds the copied
        entities, tied to the edges. Returns: `converted` with `entities` (ids for
        the other sketch tools), `count` and `construction`.

        Args:
            input_data: The edges. Give `edge_points`, `face_point`, or both;
                `construction` makes the copies construction geometry.

        Returns:
            dict[str, Any]: The entities added.
        """
        input_data = normalize_input(input_data, SketchConvertEntitiesInput)
        result = await adapter.sketch_convert_entities(
            input_data.edge_points or None,
            input_data.face_point,
            input_data.construction,
        )
        require_success(result, context="Failed to convert entities")
        data = result.data if isinstance(result.data, dict) else {}
        return {
            "status": "success",
            "message": f"Copied {data.get('count', 0)} edge(s) into the sketch",
            "converted": data,
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_sketch_fillet(input_data: AddSketchFilletInput) -> dict[str, Any]:
        """Round corners of the open sketch to a radius, picking each corner by its point.

        Use it for rounded corners of a 2D profile, such as a cut's outline; round a
        solid's edges with `add_fillet` instead, last in the feature tree. Give
        each corner's `[x, y]` in sketch mm, where two entities meet (for a rectangle,
        its corners). Needs: an open sketch (`create_sketch`) with entities meeting at
        each corner. Changes: each corner becomes an arc and the entities either side
        are trimmed back to it. Returns: `fillet` with one `id` per corner, the
        `corners` and the `radius`. A corner with no sketch point fails as
        `invalid_input` and nothing changes.

        Args:
            input_data: `corners` (a list of `[x, y]` mm) and `radius` (mm).

        Returns:
            dict[str, Any]: The fillets added.
        """
        input_data = normalize_input(input_data, AddSketchFilletInput)
        result = await adapter.add_sketch_fillet(input_data.corners, input_data.radius)
        require_success(result, context="Failed to round the sketch corners")
        made: dict[str, Any] = result.data or {}
        return {
            "status": "success",
            "message": f"Rounded {len(input_data.corners)} corner(s) to "
            f"R{input_data.radius:g} mm",
            "fillet": {**made, "radius": input_data.radius},
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_sketch_chamfer(input_data: AddSketchChamferInput) -> dict[str, Any]:
        """Bevel corners of the open sketch, picking each corner by its point.

        Use it for bevelled corners of a 2D profile; bevel a solid's edges with
        `add_chamfer` instead, last in the feature tree. `distance` alone cuts the same
        distance along both sides; add `distance2` for a different second side, or
        `angle` (degrees) for a distance and an angle. Needs: an open sketch with
        entities meeting at each corner (`[x, y]` in sketch mm). Changes: each corner
        becomes a line and the entities either side are trimmed back to it. Returns:
        `chamfer` with one `id` per corner, the `corners` and the sizes. A corner
        with no sketch point fails as `invalid_input` and nothing changes.

        Args:
            input_data: `corners` and `distance` (mm) are required; `distance2` (mm)
                or `angle` (degrees), not both.

        Returns:
            dict[str, Any]: The chamfers added.
        """
        input_data = normalize_input(input_data, AddSketchChamferInput)
        result = await adapter.add_sketch_chamfer(
            input_data.corners,
            input_data.distance,
            input_data.distance2,
            input_data.angle,
        )
        require_success(result, context="Failed to bevel the sketch corners")
        made: dict[str, Any] = result.data or {}
        return {
            "status": "success",
            "message": f"Bevelled {len(input_data.corners)} corner(s)",
            "chamfer": {
                **made,
                "distance": input_data.distance,
                "distance2": input_data.distance2,
                "angle": input_data.angle,
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def add_slot(input_data: AddSlotInput) -> dict[str, Any]:
        """Draw a slot in the open sketch: straight between two centres, or along an arc.

        Use it for adjustment slots and keyways, then cut it (`create_cut_extrude`).
        A straight slot takes its two end centres, `start` and `end`. An arc slot
        (`kind` `arc`) takes the `center` of the arc it follows and `start` and `end`
        on that arc, counter-clockwise. Needs: an open sketch (`create_sketch`).
        Changes: adds one closed slot. Returns: `slot` with its `id`, the points, the
        `width` and its `area` (mm²).

        Args:
            input_data: `width` (mm), `start` and `end` (`[x, y]` mm) are required;
                `kind` is `straight`; `center` for an arc slot.

        Returns:
            dict[str, Any]: The slot added.
        """
        input_data = normalize_input(input_data, AddSlotInput)
        result = await adapter.add_slot(
            input_data.kind,
            input_data.width,
            input_data.start,
            input_data.end,
            input_data.center,
        )
        require_success(result, context="Failed to draw the slot")
        area = slot_area(
            input_data.kind,
            input_data.width,
            input_data.start,
            input_data.end,
            input_data.center,
        )
        return {
            "status": "success",
            "message": f"Drew a {input_data.kind} slot {input_data.width:g} mm wide",
            "slot": {
                "id": result.data,
                "kind": input_data.kind,
                "start": input_data.start,
                "end": input_data.end,
                "center": input_data.center,
                "width": input_data.width,
                "area": round(area, 4),
            },
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def sketch_trim(input_data: SketchPointInput) -> dict[str, Any]:
        """Trim away the piece of a sketch entity at a point, back to where it meets others.

        Use it to clean up overlapping shapes into one profile, such as the arc inside
        a keyhole. `point` (`[x, y]` sketch mm) is on the piece to remove; an entity
        that meets nothing is removed whole. Needs: an open sketch with an entity at
        the point. Changes: removes that piece. Returns: `trim` with the `point` and
        the sketch's `segments_before` and `segments_after`. A trimmed entity's id may
        no longer name a whole segment. Nothing at the point fails as `invalid_input`.

        Args:
            input_data: `point`, `[x, y]` in sketch mm.

        Returns:
            dict[str, Any]: The trim.
        """
        input_data = normalize_input(input_data, SketchPointInput)
        result = await adapter.sketch_trim(input_data.point)
        require_success(result, context="Failed to trim the sketch")
        return {
            "status": "success",
            "message": f"Trimmed at {input_data.point} mm",
            "trim": result.data,
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def sketch_extend(input_data: SketchPointInput) -> dict[str, Any]:
        """Lengthen a sketch entity from its end nearest a point until it meets the next entity.

        Use it to close a gap, such as lines that stop short of a circle. `point`
        (`[x, y]` sketch mm) is on the entity, near the end to lengthen. Needs: an
        open sketch with an entity at the point and another in its way. Changes: that
        end moves to the next entity. Returns: `extend` with the `point` and the
        segment counts. Nothing at the point, or nothing to reach, fails as
        `invalid_input`.

        Args:
            input_data: `point`, `[x, y]` in sketch mm.

        Returns:
            dict[str, Any]: The extension.
        """
        input_data = normalize_input(input_data, SketchPointInput)
        result = await adapter.sketch_extend(input_data.point)
        require_success(result, context="Failed to extend the sketch entity")
        return {
            "status": "success",
            "message": f"Extended the entity at {input_data.point} mm",
            "extend": result.data,
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def set_construction_geometry(
        input_data: SetConstructionGeometryInput,
    ) -> dict[str, Any]:
        """Make sketch entities construction geometry, or normal again, by id.

        Use it for reference lines and circles a feature should ignore, such as a
        line to dimension from or a bolt circle. Needs: an open sketch and ids the
        sketch tools returned. Changes: each entity's construction setting (setting it
        to what it already is changes nothing). Returns: `construction_geometry` with
        each id's state. An unknown id fails as `invalid_input` and nothing changes.

        Args:
            input_data: `entities` (ids) is required; `construction` is on.

        Returns:
            dict[str, Any]: The entities' states.
        """
        input_data = normalize_input(input_data, SetConstructionGeometryInput)
        result = await adapter.set_construction_geometry(
            input_data.entities, input_data.construction
        )
        require_success(result, context="Failed to set construction geometry")
        kind = "construction" if input_data.construction else "normal"
        return {
            "status": "success",
            "message": f"{len(input_data.entities)} entity(ies) now {kind} geometry",
            "construction_geometry": result.data,
            "execution_time": result.execution_time,
        }

    @mcp.tool()
    async def sketch_tutorial_simple_hole() -> dict[str, Any]:
        """Demonstrate the sketch steps: draw a 5 mm circle at the origin on the Top plane and close the sketch.

        It is a fixed example; for a real hole, use `create_sketch`, `add_circle`,
        `exit_sketch` and `create_cut_extrude`. Needs: an open part. Changes: adds a
        sketch with one circle. Returns: `steps_completed`, `next_step` (cut the hole
        with `create_cut_extrude`) and `suggested_cut`, that call's input.
        """
        steps_completed = []

        # Step 1: Create sketch
        sketch_result = await adapter.create_sketch("Top")
        require_success(sketch_result, context="Failed to create sketch")
        sketch_name = (
            sketch_result.data.get("sketch_name")
            if isinstance(sketch_result.data, dict)
            else sketch_result.data
        )
        steps_completed.append(f"Created sketch: {sketch_name}")

        # Step 2: Add circle
        circle_result = await adapter.add_circle(0, 0, 2.5)
        require_success(circle_result, context="Failed to add circle")
        steps_completed.append(f"Added 5mm diameter circle: {circle_result.data}")

        # Step 3: Exit sketch
        exit_result = await adapter.exit_sketch()
        require_success(exit_result, context="Failed to exit sketch")
        steps_completed.append("Exited sketch")

        return {
            "status": "success",
            "message": "Tutorial completed: Simple hole sketch created",
            "steps_completed": steps_completed,
            "next_step": (
                "Cut the hole through the part with create_cut_extrude, using "
                "suggested_cut as its input"
            ),
            "suggested_cut": {
                "sketch_name": sketch_name,
                "depth": 10.0,
                "end_condition": "ThroughAll",
            },
        }

    tool_count = 6  # Legacy count expected by tests
    return tool_count

require_success

require_success(result: AdapterResult[TResult], failure_message: str = 'Operation failed', *, context: str | None = None, with_data: bool = False) -> AdapterResult[TResult]

Return result when it succeeded; raise otherwise.

Mirrors the if result.is_success: ... else: error the tools used before the boundary, so anything that is not a success - including a warning - is reported as a failure. Tools that treat a warning as success check result.status themselves before calling this.

Parameters:

Name Type Description Default
result AdapterResult[TResult]

The adapter result to check.

required
failure_message str

Message used when the adapter gave none.

'Operation failed'
context str | None

Prefix naming what failed, e.g. "Failed to create part", giving "<context>: <adapter error>".

None
with_data bool

Return the adapter's data with the error, for tools whose failure data is the diagnosis (e.g. rebuild_model).

False

Raises:

Type Description
ToolOperationError

Carrying the adapter's message and timing.

Source code in src/solidworks_mcp/tools/tool_boundary.py
def require_success[TResult](
    result: AdapterResult[TResult],
    failure_message: str = "Operation failed",
    *,
    context: str | None = None,
    with_data: bool = False,
) -> AdapterResult[TResult]:
    """Return ``result`` when it succeeded; raise otherwise.

    Mirrors the ``if result.is_success: ... else: error`` the tools used before
    the boundary, so anything that is not a success - including a warning - is
    reported as a failure. Tools that treat a warning as success check
    ``result.status`` themselves before calling this.

    Args:
        result: The adapter result to check.
        failure_message: Message used when the adapter gave none.
        context: Prefix naming what failed, e.g. ``"Failed to create part"``,
            giving ``"<context>: <adapter error>"``.
        with_data: Return the adapter's ``data`` with the error, for tools whose
            failure data is the diagnosis (e.g. ``rebuild_model``).

    Raises:
        ToolOperationError: Carrying the adapter's message and timing.
    """
    if not result.is_success:
        message = str(result.error or failure_message)
        raise ToolOperationError(
            f"{context}: {message}" if context else message,
            result.execution_time,
            result.data if with_data else None,
        )
    return result

slot_area

slot_area(kind: str, width: float, start: list[float], end: list[float], center: list[float] | None) -> float

A slot's area in mm²: its centreline's length times its width, plus the two half-circle ends (one circle of the width's diameter).

An arc slot's centreline runs counter-clockwise about center from start to end.

Source code in src/solidworks_mcp/tools/sketching.py
def slot_area(
    kind: str,
    width: float,
    start: list[float],
    end: list[float],
    center: list[float] | None,
) -> float:
    """A slot's area in mm²: its centreline's length times its width, plus
    the two half-circle ends (one circle of the width's diameter).

    An arc slot's centreline runs counter-clockwise about ``center`` from
    ``start`` to ``end``.
    """
    ends = math.pi * (width / 2.0) ** 2
    if kind == "arc" and center is not None:
        radius = math.dist(center, start)
        turn = math.atan2(end[1] - center[1], end[0] - center[0]) - math.atan2(
            start[1] - center[1], start[0] - center[0]
        )
        length = radius * (turn % (2 * math.pi))
    else:
        length = math.dist(start, end)
    return length * width + ends

with_tool_boundary

with_tool_boundary(mcp: TServer) -> TServer

Return mcp wrapped in a :class:ToolRegistrar (typed as mcp).

The registrar duck-types the FastMCP surface the tool modules use (tool() plus attribute forwarding), so modules keep their annotations.

Source code in src/solidworks_mcp/tools/tool_boundary.py
def with_tool_boundary[TServer](mcp: TServer) -> TServer:
    """Return ``mcp`` wrapped in a :class:`ToolRegistrar` (typed as ``mcp``).

    The registrar duck-types the FastMCP surface the tool modules use
    (``tool()`` plus attribute forwarding), so modules keep their annotations.
    """
    return cast(TServer, ToolRegistrar.of(mcp))