Skip to content

solidworks_mcp.tools.modeling

solidworks_mcp.tools.modeling

Modeling tools for SolidWorks MCP Server.

Provides tools for creating and manipulating SolidWorks models, including parts, assemblies, drawings, and features like extrusions, revolves, etc.

Attributes

TInput module-attribute

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

Classes

AddChamferInput

Bases: CompatInput

Input schema for adding an equal-distance chamfer feature.

Attributes:

Name Type Description
distance float

Chamfer distance in millimeters.

edge_names list[str]

Edge names to chamfer.

AddFilletInput

Bases: CompatInput

Input schema for adding a fillet feature.

Attributes:

Name Type Description
edge_names list[str]

Edge names to fillet.

radius float

Fillet radius in millimeters.

AddMateInput

Bases: CompatInput

Input schema for mating two assembly components.

Attributes:

Name Type Description
component_a str

First component instance name.

component_b str

Second component instance name.

entity_a str

Named feature on the first component.

entity_b str

Named feature on the second component.

mate_type str

Mate type.

alignment str

Mate alignment.

distance float

Distance in millimetres for a distance mate.

angle float

Angle in degrees for an angle mate.

CloseModelInput

Bases: BaseModel

Input schema for closing a model.

Attributes:

Name Type Description
save bool

The save value.

CompatInput

Bases: BaseModel

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

Attributes:

Name Type Description
model_config Any

The model config value.

CreateAssemblyInput

Bases: CompatInput

Input schema for creating a new assembly.

Attributes:

Name Type Description
components list[str]

The components value.

name str

The name value.

template str | None

The template value.

CreateAxisInput

Bases: CompatInput

Input schema for creating a reference axis.

Attributes:

Name Type Description
reference str

Principal axis direction.

CreateCutExtrudeInput

Bases: CompatInput

Input schema for creating a cut-extrude feature.

Attributes:

Name Type Description
depth float

Cut depth in millimeters.

draft_angle float

Draft angle in degrees.

end_condition str

End condition type.

reverse_direction bool

Reverse cut direction.

sketch_name str | None

Sketch to cut from.

CreateDrawingInput

Bases: CompatInput

Input schema for creating a new drawing.

Attributes:

Name Type Description
model_path str | None

The model path value.

name str

The name value.

sheet_format str | None

The sheet format value.

template str | None

The template value.

CreateExtrusionInput

Bases: CompatInput

Input schema for creating an extrusion feature.

Attributes:

Name Type Description
both_directions bool

The both directions value.

depth float

The depth value.

direction str

The direction value.

draft_angle float

The draft angle value.

end_condition str

The end condition value.

merge_result bool

The merge result value.

reverse bool | None

The reverse value.

reverse_direction bool

The reverse direction value.

sketch_name str

The sketch name value.

thin_feature bool

The thin feature value.

thin_thickness float | None

The thin thickness value.

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

Provide model post init support for the create extrusion input.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Returns:

Name Type Description
None None

None.

Raises:

Type Description
ValueError

Sketch_name is required.

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

    Args:
        __context (Any): The context value.

    Returns:
        None: None.

    Raises:
        ValueError: Sketch_name is required.
    """
    if self.depth <= 0:
        raise ValueError("depth must be positive")
    if not self.sketch_name.strip():
        raise ValueError("sketch_name is required")
    if self.reverse is not None:
        self.reverse_direction = self.reverse

CreateLoftInput

Bases: BaseModel

Input schema for creating a loft feature.

Attributes:

Name Type Description
end_tangent str | None

The end tangent value.

guide_curves list[str] | None

The guide curves value.

merge_result bool

The merge result value.

profiles list[str]

The profiles value.

start_tangent str | None

The start tangent value.

CreatePartInput

Bases: CompatInput

Input schema for creating a new SolidWorks part.

Attributes:

Name Type Description
material str | None

The material value.

name str

The name value.

template str | None

The template value.

units str | None

The units value.

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

Provide model post init support for the create part input.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Returns:

Name Type Description
None None

None.

Raises:

Type Description
ValueError

Name is required.

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

    Args:
        __context (Any): The context value.

    Returns:
        None: None.

    Raises:
        ValueError: Name is required.
    """
    if not self.name.strip():
        raise ValueError("name is required")

CreateReferencePlaneInput

Bases: CompatInput

Input schema for creating a reference plane.

Attributes:

Name Type Description
reference str

Name of the reference plane or planar face.

offset float

Offset distance in millimetres.

angle float

Angle in degrees.

flip bool

Reverse the offset or angle direction.

CreateReferencePointInput

Bases: CompatInput

Input schema for creating a reference point.

Attributes:

Name Type Description
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.

CreateRevolveInput

Bases: CompatInput

Input schema for creating a revolve feature.

Attributes:

Name Type Description
angle float

The angle value.

axis_entity str

The axis entity value.

both_directions bool

The both directions value.

direction str

The direction value.

merge_result bool

The merge result value.

reverse_direction bool

The reverse direction value.

sketch_name str

The sketch name value.

thin_feature bool

The thin feature value.

thin_thickness float | None

The thin thickness value.

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

Provide model post init support for the create revolve input.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Returns:

Name Type Description
None None

None.

Raises:

Type Description
ValueError

Angle must be positive.

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

    Args:
        __context (Any): The context value.

    Returns:
        None: None.

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

CreateSweepInput

Bases: BaseModel

Input schema for creating a sweep feature.

Attributes:

Name Type Description
merge_result bool

The merge result value.

path str

The path value.

twist_along_path bool

The twist along path value.

twist_angle float

The twist angle value.

DeleteFeatureInput

Bases: CompatInput

Input schema for deleting a feature.

Attributes:

Name Type Description
name str

Feature or sketch name to delete.

ExtrusionParameters

Bases: BaseModel

Parameters for extrusion operations.

Attributes:

Name Type Description
auto_select bool

The auto select value.

both_directions bool

The both directions value.

depth float

The depth value.

draft_angle float

The draft angle value.

end_condition str

The end condition value.

feature_scope bool

The feature scope value.

merge_result bool

The merge result value.

reverse_direction bool

The reverse direction value.

sketch_name str | None

Explicit sketch to operate on. When set, callers (e.g. create_cut_extrude) must select exactly this sketch and fail with a clear error if it doesn't exist rather than silently falling back to some other sketch.

thin_feature bool

The thin feature value.

thin_thickness float | None

The thin thickness value.

up_to_surface str | None

The up to surface value.

GetDimensionInput

Bases: CompatInput

Input schema for getting a dimension value.

Attributes:

Name Type Description
dimension_name str | None

The dimension name value.

name str | None

The name value.

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

Provide model post init support for the get dimension input.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Returns:

Name Type Description
None None

None.

Raises:

Type Description
ValueError

Name is required.

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

    Args:
        __context (Any): The context value.

    Returns:
        None: None.

    Raises:
        ValueError: Name is required.
    """
    if self.name is None:
        self.name = self.dimension_name
    if not self.name:
        raise ValueError("name is required")

InsertComponentInput

Bases: CompatInput

Input schema for inserting a component into an assembly.

Attributes:

Name Type Description
file_path str

Path to the part or sub-assembly.

x float

X position in millimetres.

y float

Y position in millimetres.

z float

Z position in millimetres.

LoftParameters

Bases: BaseModel

Parameters for loft operations.

Attributes:

Name Type Description
end_tangent str | None

The end tangent value.

guide_curves list[str] | None

The guide curves value.

merge_result bool

The merge result value.

profiles list[str]

The profiles value.

start_tangent str | None

The start tangent value.

MirrorFeatureInput

Bases: CompatInput

Input schema for mirroring solid bodies or features.

Attributes:

Name Type Description
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.

mirror_bodies bool

Mirror whole bodies rather than features.

OpenModelInput

Bases: BaseModel

Input schema for opening a SolidWorks model.

Attributes:

Name Type Description
file_path str

The file path value.

PatternCircularInput

Bases: CompatInput

Input schema for patterning features around an axis.

Attributes:

Name Type Description
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 instances over.

equal_spacing bool

Space instances evenly across angle.

RenameFeatureInput

Bases: CompatInput

Input schema for renaming a feature.

Attributes:

Name Type Description
old_name str

Current feature name.

new_name str

New feature name.

RevolveParameters

Bases: BaseModel

Parameters for revolve operations.

Attributes:

Name Type Description
angle float

The angle value.

both_directions bool

The both directions value.

merge_result bool

The merge result value.

reverse_direction bool

The reverse direction value.

thin_feature bool

The thin feature value.

thin_thickness float | None

The thin thickness value.

SetDimensionInput

Bases: CompatInput

Input schema for setting a dimension value.

Attributes:

Name Type Description
dimension_name str | None

The dimension name value.

name str | None

The name value.

units str | None

The units value.

value float

The value value.

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

Provide model post init support for the set dimension input.

Parameters:

Name Type Description Default
__context Any

The context value.

required

Returns:

Name Type Description
None None

None.

Raises:

Type Description
ValueError

Name is required.

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

    Args:
        __context (Any): The context value.

    Returns:
        None: None.

    Raises:
        ValueError: Name is required.
    """
    if self.name is None:
        self.name = self.dimension_name
    if not self.name:
        raise ValueError("name is required")

SetUnitsInput

Bases: CompatInput

Input schema for setting the active document's unit system.

Attributes:

Name Type Description
unit_system str

Target linear unit - mm, cm, m, in or ft (aliases such as inch / millimeters accepted).

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_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",
    )
add_arc async
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float) -> 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

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,
) -> 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.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_arc 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]) -> AdapterResult[Any]

Add an equal-distance chamfer feature to selected edges.

Chamfers the selected edges of the current solid body by the given distance.

Parameters:

Name Type Description Default
distance float

Chamfer distance in millimeters.

required
edge_names list[str]

List of edge names to chamfer.

required

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]
) -> AdapterResult[Any]:
    """Add an equal-distance chamfer feature to selected edges.

    Chamfers the selected edges of the current solid body by the given
    distance.

    Args:
        distance (float): Chamfer distance in millimeters.
        edge_names (list[str]): List of edge names to chamfer.

    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_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_ellipse async
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float) -> 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

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,
) -> 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.

    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_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) -> 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

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,
) -> 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.

    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) -> 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

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
) -> 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.

    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) -> AdapterResult[str]

Add a rectangle 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_rectangle(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add a rectangle 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_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_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",
    )
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",
    )
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) -> AdapterResult[SolidWorksModel]

Create a new assembly document.

Parameters:

Name Type Description Default
name str | None

The name value. 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
) -> AdapterResult[SolidWorksModel]:
    """Create a new assembly document.

    Args:
        name (str | None): The name value. 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_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_drawing abstractmethod async
create_drawing(name: 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

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
) -> AdapterResult[SolidWorksModel]:
    """Create a new drawing document.

    Args:
        name (str | None): The name value. 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_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_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) -> 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

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
) -> 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.

    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) -> AdapterResult[dict[str, Any]]

Create a reference plane offset from, or angled to, an existing plane.

Parameters:

Name Type Description Default
reference str

Name of the reference plane or planar face.

required
offset float

Offset distance in millimetres. Defaults to 0.0.

0.0
angle float

Angle in degrees. Defaults to 0.0.

0.0
flip bool

Reverse the offset or angle direction. Defaults to False.

False

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,
) -> AdapterResult[dict[str, Any]]:
    """Create a reference plane offset from, or angled to, an existing plane.

    Args:
        reference (str): Name of the reference plane or planar face.
        offset (float): Offset distance in millimetres. Defaults to 0.0.
        angle (float): Angle in degrees. Defaults to 0.0.
        flip (bool): Reverse the offset or angle direction. Defaults to False.

    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_sketch abstractmethod async
create_sketch(plane: str) -> AdapterResult[str]

Create a new sketch on the specified plane.

Parameters:

Name Type Description Default
plane str

The plane 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 create_sketch(self, plane: str) -> AdapterResult[str]:
    """Create a new sketch on the specified plane.

    Args:
        plane (str): The plane value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    pass
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_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
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_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_dimension abstractmethod async
get_dimension(name: str) -> AdapterResult[float]

Get the value of a dimension.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Type Description
AdapterResult[float]

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

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

    Args:
        name (str): The name value.

    Returns:
        AdapterResult[float]: The result produced by the operation.
    """
    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_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_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
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_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",
    )
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_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_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_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",
    )
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
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",
    )
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",
    )
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_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",
    )
set_dimension abstractmethod async
set_dimension(name: str, value: float) -> AdapterResult[None]

Set the value of a dimension.

Parameters:

Name Type Description Default
name str

The name value.

required
value float

The value 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 set_dimension(self, name: str, value: float) -> AdapterResult[None]:
    """Set the value of a dimension.

    Args:
        name (str): The name value.
        value (float): The value value.

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    pass
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_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",
    )
suppress_feature async
suppress_feature(name: str, suppress: bool = True) -> 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

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
) -> AdapterResult[dict[str, Any]]:
    """Suppress or unsuppress a named feature.

    Args:
        name (str): Feature name.
        suppress (bool): True to suppress, False to unsuppress.

    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

SuppressFeatureInput

Bases: CompatInput

Input schema for suppressing or unsuppressing a feature.

Attributes:

Name Type Description
name str

Feature name to toggle.

suppress bool

True to suppress, False to unsuppress.

SweepParameters

Bases: BaseModel

Parameters for sweep operations.

Attributes:

Name Type Description
merge_result bool

The merge result value.

path str

The path value.

twist_along_path bool

The twist along path value.

twist_angle float

The twist angle value.

UndoInput

Bases: CompatInput

Input schema for undoing model operations.

Attributes:

Name Type Description
count int

Number of operations to undo.

Functions:

_normalize_input

_normalize_input(input_data: Any, model_type: type[TInput]) -> TInput

Build internal normalize input.

Parameters:

Name Type Description Default
input_data Any

The input data value.

required
model_type type[TInput]

The model type value.

required

Returns:

Name Type Description
TInput TInput

The result produced by the operation.

Source code in src/solidworks_mcp/tools/modeling.py
def _normalize_input(input_data: Any, model_type: type[TInput]) -> TInput:
    """Build internal normalize input.

    Args:
        input_data (Any): The input data value.
        model_type (type[TInput]): The model type value.

    Returns:
        TInput: The result produced by the operation.
    """
    if isinstance(input_data, model_type):
        return input_data
    return model_type.model_validate(input_data)

_result_value

_result_value(data: Any, *keys: str, default: Any = None) -> Any

Build internal result value.

Parameters:

Name Type Description Default
data Any

The data value.

required
*keys str

Additional positional arguments forwarded to the call.

()
default Any

Fallback value returned when the operation fails. Defaults to None.

None

Returns:

Name Type Description
Any Any

The result produced by the operation.

Source code in src/solidworks_mcp/tools/modeling.py
def _result_value(data: Any, *keys: str, default: Any = None) -> Any:
    """Build internal result value.

    Args:
        data (Any): The data value.
        *keys (str): Additional positional arguments forwarded to the call.
        default (Any): Fallback value returned when the operation fails. Defaults to None.

    Returns:
        Any: The result produced by the operation.
    """
    if isinstance(data, dict):
        for key in keys:
            if key in data and data[key] is not None:
                return data[key]
        return default

    for key in keys:
        if hasattr(data, key):
            value = getattr(data, key)
            if value is not None:
                return value
    return default

register_modeling_tools async

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

Register modeling tools with FastMCP.

Registers comprehensive modeling tools for SolidWorks automation including model creation, feature creation, and model management 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.modeling import register_modeling_tools

tool_count = await register_modeling_tools(mcp, adapter, config)
print(f"Registered {tool_count} modeling tools")
Source code in src/solidworks_mcp/tools/modeling.py
 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
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
async def register_modeling_tools(
    mcp: FastMCP, adapter: SolidWorksAdapter, config: dict[str, Any]
) -> int:
    """Register modeling tools with FastMCP.

    Registers comprehensive modeling tools for SolidWorks automation including model
    creation, feature creation, and model management 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.modeling import register_modeling_tools

                        tool_count = await register_modeling_tools(mcp, adapter, config)
                        print(f"Registered {tool_count} modeling tools")
                        ```
    """
    tool_count = 0

    @mcp.tool()
    async def open_model(input_data: OpenModelInput) -> dict[str, Any]:
        """Open a SolidWorks model (part, assembly, or drawing).

        Opens an existing SolidWorks file and makes it the active document for further
        operations. Supports all standard SolidWorks file formats and provides detailed model
        information upon successful opening.

        Args:
            input_data (OpenModelInput): The input data value.

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

        Example:
                            ```python
                            result = await open_model({
                                "file_path": "C:/Models/bracket.sldprt"
                            })

                            if result["status"] == "success":
                                model = result["model"]
                                print(f"Opened {model['type']}: {model['name']}")
                                print(f"Configuration: {model['configuration']}")
                            ```

                        Note:
                            File path must be absolute and accessible to SolidWorks.
                            Model becomes the active document for subsequent operations.
        """
        try:
            input_data = _normalize_input(input_data, OpenModelInput)
            result = await adapter.open_model(input_data.file_path)

            if result.is_success:
                model = result.data
                title = _result_value(
                    model, "title", "name", default=input_data.file_path
                )
                model_type = _result_value(model, "type", default="Part")
                path = _result_value(
                    model, "path", "file_path", default=input_data.file_path
                )
                configuration = _result_value(model, "configuration", default="Default")
                return {
                    "status": "success",
                    "message": f"Opened {model_type}: {title}",
                    "model": {
                        "title": title,
                        "name": title,
                        "type": model_type,
                        "path": path,
                        "configuration": configuration,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to open model: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in open_model tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def create_part(input_data: CreatePartInput) -> dict[str, Any]:
        """Create a new SolidWorks part document.

        Creates a new SolidWorks part document using the default part template. The new part
        becomes the active document and is ready for modeling operations such as sketch creation
        and feature addition.

        Args:
            input_data (CreatePartInput): The input data value.

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

        Example:
                            ```python
                            result = await create_part()

                            if result["status"] == "success":
                                part = result["model"]
                                print(f"Created new part: {part['name']}")
                                # Ready for sketching and feature creation
                            ```

                        Note:
                            - Uses default SolidWorks part template
                            - Part document is created in memory (not saved)
                            - Use save operations to persist to disk
                            - Subsequent modeling operations will apply to this part
        """
        try:
            input_data = _normalize_input(input_data, CreatePartInput)
            result = await adapter.create_part(input_data.name, input_data.units)

            if result.is_success:
                model = result.data
                part_name = _result_value(model, "name", default=input_data.name)
                units = _result_value(model, "units", default=input_data.units or "mm")
                return {
                    "status": "success",
                    "message": f"Created new part: {part_name}",
                    "part": {
                        "name": part_name,
                        "units": units,
                        "material": input_data.material,
                        "template": input_data.template,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to create part: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in create_part tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def create_assembly(input_data: CreateAssemblyInput) -> dict[str, Any]:
        """Create a new SolidWorks assembly document.

        Creates a new SolidWorks assembly document using the default assembly template. The new
        assembly becomes the active document and is ready for component insertion, mating, and
        assembly-level operations.

        Args:
            input_data (CreateAssemblyInput): The input data value.

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

        Example:
                            ```python
                            result = await create_assembly()

                            if result["status"] == "success":
                                assembly = result["model"]
                                print(f"Created new assembly: {assembly['name']}")
                                # Ready for component insertion and mating
                            ```

                        Note:
                            - Uses default SolidWorks assembly template
                            - Assembly document is created in memory (not saved)
                            - Use save operations to persist to disk
                            - Ready for component insertion and mate creation
                            - Assembly tree will initially be empty

                        This tool creates a new assembly document using the default assembly template.
                        The new assembly will become the active document.
        """
        try:
            input_data = _normalize_input(input_data, CreateAssemblyInput)
            result = await adapter.create_assembly(input_data.name)

            if result.is_success:
                model = result.data
                assembly_name = _result_value(model, "name", default=input_data.name)
                return {
                    "status": "success",
                    "message": f"Created new assembly: {assembly_name}",
                    "assembly": {
                        "name": assembly_name,
                        "components": input_data.components,
                        "template": input_data.template,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to create assembly: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in create_assembly tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def create_drawing(input_data: CreateDrawingInput) -> dict[str, Any]:
        """Create a new SolidWorks drawing document.

        This tool creates a new drawing document using the default drawing template. The new
        drawing will become the active document.

        Args:
            input_data (CreateDrawingInput): The input data value.

        Returns:
            dict[str, Any]: A dictionary containing the resulting values.
        """
        try:
            input_data = _normalize_input(input_data, CreateDrawingInput)
            result = await adapter.create_drawing(input_data.name)

            if result.is_success:
                model = result.data
                drawing_name = _result_value(model, "name", default=input_data.name)
                sheet_format = _result_value(
                    model, "sheet_format", default=input_data.sheet_format
                )
                return {
                    "status": "success",
                    "message": f"Created new drawing: {drawing_name}",
                    "drawing": {
                        "name": drawing_name,
                        "model_path": input_data.model_path,
                        "sheet_format": sheet_format,
                        "template": input_data.template,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to create drawing: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in create_drawing tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def close_model(input_data: CloseModelInput) -> dict[str, Any]:
        """Close the current SolidWorks model.

        Closes the currently active SolidWorks document with an option to save changes before
        closing. This is essential for proper model lifecycle management and preventing data
        loss.

        Args:
            input_data (CloseModelInput): The input data value.

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

        Example:
                            ```python
                            # Close without saving
                            result = await close_model({"save": False})

                            # Save and close
                            result = await close_model({"save": True})

                            if result["status"] == "success":
                                print(f"Model closed, saved: {result['saved']}")
                            ```

                        Note:
                            - Unsaved changes will be lost if save=False
                            - Always save important work before closing
                            - Model must be open to close it
        """
        try:
            input_data = _normalize_input(input_data, CloseModelInput)
            result = await adapter.close_model(input_data.save)

            if result.is_success:
                return {
                    "status": "success",
                    "message": "Model closed successfully",
                    "saved": input_data.save,
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to close model: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in close_model tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def create_extrusion(input_data: CreateExtrusionInput) -> dict[str, Any]:
        """Create an extrusion feature from the active sketch.

        Creates a 3D extrusion feature (boss or cut) from the currently active 2D sketch.
        Supports advanced options like draft angles, thin features, bidirectional extrusion, and
        various end conditions for professional modeling workflows.

        Args:
            input_data (CreateExtrusionInput): The input data value.

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

        Example:
                            ```python
                            # Simple boss extrusion
                            result = await create_extrusion({
                                "depth": 25.0,
                                "merge_result": True
                            })

                            # Cut with draft angle
                            result = await create_extrusion({
                                "depth": 10.0,
                                "reverse_direction": True,
                                "draft_angle": 2.0
                            })

                            # Thin wall feature
                            result = await create_extrusion({
                                "depth": 50.0,
                                "thin_feature": True,
                                "thin_thickness": 2.0
                            })
                            ```
        """
        try:
            input_data = _normalize_input(input_data, CreateExtrusionInput)
            # Convert input to ExtrusionParameters
            params = ExtrusionParameters(
                depth=input_data.depth,
                draft_angle=input_data.draft_angle,
                reverse_direction=input_data.reverse_direction,
                both_directions=input_data.both_directions,
                thin_feature=input_data.thin_feature,
                thin_thickness=input_data.thin_thickness,
                end_condition=input_data.end_condition,
                merge_result=input_data.merge_result,
                feature_scope=False,
                auto_select=True,
            )

            result = await adapter.create_extrusion(params)

            if result.is_success:
                feature = result.data
                return {
                    "status": "success",
                    "message": f"Created extrusion: {_result_value(feature, 'feature_name', 'name', default='Extrusion')}",
                    "extrusion": {
                        "name": _result_value(
                            feature, "feature_name", "name", default="Extrusion"
                        ),
                        "sketch": input_data.sketch_name,
                        "depth": input_data.depth,
                        "direction": input_data.direction,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to create extrusion: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in create_extrusion tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def create_revolve(input_data: CreateRevolveInput) -> dict[str, Any]:
        """Create a revolve feature from the active sketch.

        Creates a 3D revolve feature by rotating the active 2D sketch profile around a specified
        axis of revolution. Supports full and partial revolves, thin features, and bidirectional
        revolution for comprehensive rotational modeling.

        Args:
            input_data (CreateRevolveInput): The input data value.

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

        Example:
                            ```python
                            # Full revolution (cylinder)
                            result = await create_revolve({
                                "angle": 360.0,
                                "merge_result": True
                            })

                            # Partial revolution (arc section)
                            result = await create_revolve({
                                "angle": 120.0,
                                "both_directions": True
                            })

                            # Thin wall revolution (pipe)
                            result = await create_revolve({
                                "angle": 360.0,
                                "thin_feature": True,
                                "thin_thickness": 3.0
                            })
                            ```
        """
        try:
            input_data = _normalize_input(input_data, CreateRevolveInput)
            # Convert input to RevolveParameters
            params = RevolveParameters(
                angle=input_data.angle,
                reverse_direction=input_data.reverse_direction,
                both_directions=input_data.both_directions,
                thin_feature=input_data.thin_feature,
                thin_thickness=input_data.thin_thickness,
                merge_result=input_data.merge_result,
            )

            result = await adapter.create_revolve(params)

            if result.is_success:
                feature = result.data
                return {
                    "status": "success",
                    "message": f"Created revolve: {_result_value(feature, 'feature_name', 'name', default='Revolve')}",
                    "revolve": {
                        "name": _result_value(
                            feature, "feature_name", "name", default="Revolve"
                        ),
                        "sketch": input_data.sketch_name,
                        "axis_entity": input_data.axis_entity,
                        "angle": input_data.angle,
                        "direction": input_data.direction,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to create revolve: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in create_revolve tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def get_dimension(input_data: GetDimensionInput) -> dict[str, Any]:
        """Get the value of a dimension from the current model.

        Retrieves the current value of a named dimension from the active SolidWorks model.
        Dimensions can be from sketches, features, or global dimensions. Useful for parametric
        modeling and design validation.

        Args:
            input_data (GetDimensionInput): The input data value.

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

        Example:
                            ```python
                            # Get sketch dimension
                            result = await get_dimension({
                                "name": "D1@Sketch1"
                            })

                            if result["status"] == "success":
                                dim = result["dimension"]
                                print(f"Dimension {dim['name']}: {dim['value']} {dim['units']}")

                            # Get feature dimension
                            result = await get_dimension({
                                "name": "D1@Boss-Extrude1"
                            })
                            ```
        """
        try:
            input_data = _normalize_input(input_data, GetDimensionInput)
            if not input_data.name:
                return {"status": "error", "message": "Dimension name is required"}
            result = await adapter.get_dimension(input_data.name)

            if result.is_success:
                value = result.data
                dimension_value = _result_value(value, "value", default=value)
                dimension_units = _result_value(value, "units", default="mm")
                return {
                    "status": "success",
                    "message": f"Dimension {input_data.name} = {dimension_value} {dimension_units}",
                    "dimension": {
                        "name": input_data.name,
                        "value": dimension_value,
                        "units": dimension_units,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to get dimension: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in get_dimension tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def set_dimension(input_data: SetDimensionInput) -> dict[str, Any]:
        """Set the value of a dimension in the current model.

        This tool modifies the value of a named dimension and rebuilds the model. Use this to
        parametrically modify your model dimensions.

        Args:
            input_data (SetDimensionInput): The input data value.

        Returns:
            dict[str, Any]: A dictionary containing the resulting values.
        """
        try:
            input_data = _normalize_input(input_data, SetDimensionInput)
            if not input_data.name:
                return {"status": "error", "message": "Dimension name is required"}
            result = await adapter.set_dimension(input_data.name, input_data.value)

            if result.is_success:
                payload = result.data
                return {
                    "status": "success",
                    "message": f"Set dimension {input_data.name} = {input_data.value} mm",
                    "dimension_update": {
                        "name": input_data.name,
                        "old_value": _result_value(payload, "old_value"),
                        "new_value": _result_value(
                            payload, "new_value", default=input_data.value
                        ),
                        "units": input_data.units or "mm",
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to set dimension: {result.error}",
                }

        except Exception as e:
            logger.error(f"Error in set_dimension tool: {e}")
            return {
                "status": "error",
                "message": f"Unexpected error: {str(e)}",
            }

    @mcp.tool()
    async def set_units(input_data: SetUnitsInput) -> dict[str, Any]:
        """Set the active document's linear unit system.

        Accepts ``mm``, ``cm``, ``m``, ``in`` or ``ft`` (plus common aliases
        such as ``inch`` or ``millimeters``). The setting is applied and then
        read back from the document; if the readback disagrees the tool
        reports an error rather than a false success.

        Args:
            input_data (SetUnitsInput): The target unit system.

        Returns:
            dict[str, Any]: Status and what was applied.

        Example:
            ```python
            await set_units({"unit_system": "in"})
            ```
        """
        try:
            input_data = _normalize_input(input_data, SetUnitsInput)
            result = await adapter.set_units(input_data.unit_system)
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                applied = data.get("unit_system", input_data.unit_system)
                message = f"Set document units to {applied}"
                if data.get("verified") is None:
                    message += " (could not be read back to confirm)"
                return {
                    "status": "success",
                    "message": message,
                    "data": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to set units: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in set_units tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def create_cut_extrude(input_data: CreateCutExtrudeInput) -> dict[str, Any]:
        """Cut material from a sketch profile in the active model.

        Creates a Cut-Extrude feature (Insert > Cut > Extrude). Use this after
        exit_sketch when you want to remove material — e.g. to create windows,
        holes, slots, or any through/blind cut in an existing solid body.

        Sketch selection is never a silent guess: pass ``sketch_name``
        explicitly whenever you're not certain which sketch this should act
        on (e.g. more than one sketch could be unconsumed, or other tool
        calls ran in between). If omitted, only the sketch most recently
        created/exited in this same session is used, and only when it still
        exists in the model — there is no further fallback. Any ambiguity or
        mismatch is reported back as an error naming the sketch(es) actually
        found in the model, rather than cutting the wrong profile.

        Args:
            input_data (CreateCutExtrudeInput): Depth, direction, draft, and
                optional sketch_name parameters.

        Returns:
            dict[str, Any]: Status and feature details. On error, ``message``
                identifies exactly which stage failed (sketch not found,
                sketch selection rejected by SolidWorks, or the specific
                FeatureCut COM error) rather than a generic failure string.

        Example:
            ```python
            # Cut a blind pocket 10 mm deep from a named sketch
            result = await create_cut_extrude({"depth": 10.0, "sketch_name": "Sketch3"})

            # Through-all cut using the most recently exited sketch
            result = await create_cut_extrude({"depth": 200.0})
            ```
        """
        try:
            input_data = _normalize_input(input_data, CreateCutExtrudeInput)
            params = ExtrusionParameters(
                depth=input_data.depth,
                draft_angle=input_data.draft_angle,
                reverse_direction=input_data.reverse_direction,
                both_directions=False,
                thin_feature=False,
                thin_thickness=None,
                end_condition=input_data.end_condition,
                merge_result=False,
                feature_scope=False,
                auto_select=True,
                sketch_name=input_data.sketch_name,
            )
            result = await adapter.create_cut_extrude(params)
            if result.is_success:
                feature = result.data
                feature_params = _result_value(feature, "parameters", default={})
                sketch_used = (
                    feature_params.get("sketch_name")
                    if isinstance(feature_params, dict)
                    else None
                ) or input_data.sketch_name
                return {
                    "status": "success",
                    "message": f"Created cut-extrude: {_result_value(feature, 'feature_name', 'name', default='Cut-Extrude')}",
                    "cut_extrude": {
                        "name": _result_value(
                            feature, "feature_name", "name", default="Cut-Extrude"
                        ),
                        "depth": input_data.depth,
                        "sketch_name": sketch_used,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to create cut-extrude: {result.error}",
                }
        except Exception as e:
            logger.error(f"Error in create_cut_extrude tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def add_fillet(input_data: AddFilletInput) -> dict[str, Any]:
        """Add a fillet (rounded edge) to selected edges of the current model.

        Rounds the specified named edges with the given radius. Edge names use the
        SolidWorks convention, e.g. 'Edge<1>', or you can leave edge_names empty to
        fillet all edges if the adapter supports it.

        Args:
            input_data (AddFilletInput): Radius and edge names.

        Returns:
            dict[str, Any]: Status and feature details.

        Example:
            ```python
            # Fillet two specific edges with 2 mm radius
            result = await add_fillet({"radius": 2.0, "edge_names": ["Edge<1>", "Edge<2>"]})
            ```
        """
        try:
            input_data = _normalize_input(input_data, AddFilletInput)
            result = await adapter.add_fillet(input_data.radius, input_data.edge_names)
            if result.is_success:
                feature = result.data
                return {
                    "status": "success",
                    "message": f"Created fillet: {_result_value(feature, 'feature_name', 'name', default='Fillet')}",
                    "fillet": {
                        "name": _result_value(
                            feature, "feature_name", "name", default="Fillet"
                        ),
                        "radius": input_data.radius,
                        "edges": input_data.edge_names,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to add fillet: {result.error}",
                }
        except Exception as e:
            logger.error(f"Error in add_fillet tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def add_chamfer(input_data: AddChamferInput) -> dict[str, Any]:
        """Add an equal-distance chamfer to selected edges of the current model.

        Chamfers the specified named edges with the given distance. Edge names use
        the SolidWorks convention, e.g. 'Edge<1>', or you can leave edge_names empty
        to chamfer all edges if the adapter supports it.

        Args:
            input_data (AddChamferInput): Distance and edge names.

        Returns:
            dict[str, Any]: Status and feature details.

        Example:
            ```python
            # Chamfer two specific edges with a 1.5 mm distance
            result = await add_chamfer({"distance": 1.5, "edge_names": ["Edge<1>", "Edge<2>"]})
            ```
        """
        try:
            input_data = _normalize_input(input_data, AddChamferInput)
            result = await adapter.add_chamfer(
                input_data.distance, input_data.edge_names
            )
            if result.is_success:
                feature = result.data
                return {
                    "status": "success",
                    "message": f"Created chamfer: {_result_value(feature, 'feature_name', 'name', default='Chamfer')}",
                    "chamfer": {
                        "name": _result_value(
                            feature, "feature_name", "name", default="Chamfer"
                        ),
                        "distance": input_data.distance,
                        "edges": input_data.edge_names,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to add chamfer: {result.error}",
                }
        except Exception as e:
            logger.error(f"Error in add_chamfer tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def create_sweep(input_data: CreateSweepInput) -> dict[str, Any]:
        """Sweep the active profile sketch along a named path sketch.

        Creates a swept boss/protrusion (Insert > Boss/Base > Sweep). Requires
        two sketches in the active part: a closed profile sketch and an open
        path sketch named by ``path``. The profile is inferred as the sketch
        that is not the path (in the usual "draw profile, draw path, sweep"
        flow this is unambiguous). Optionally applies a constant twist along
        the path.

        Args:
            input_data (CreateSweepInput): Path name and twist/merge options.

        Returns:
            dict[str, Any]: Status and feature details.

        Example:
            ```python
            # Sweep a circular profile along "Sketch2"
            result = await create_sweep({"path": "Sketch2"})

            # Sweep with a 90-degree twist along the path
            result = await create_sweep({
                "path": "Sketch2",
                "twist_along_path": True,
                "twist_angle": 90.0,
            })
            ```
        """
        try:
            input_data = _normalize_input(input_data, CreateSweepInput)
            params = SweepParameters(
                path=input_data.path,
                twist_along_path=input_data.twist_along_path,
                twist_angle=input_data.twist_angle,
                merge_result=input_data.merge_result,
            )
            result = await adapter.create_sweep(params)
            if result.is_success:
                feature = result.data
                return {
                    "status": "success",
                    "message": f"Created sweep: {_result_value(feature, 'feature_name', 'name', default='Sweep')}",
                    "sweep": {
                        "name": _result_value(
                            feature, "feature_name", "name", default="Sweep"
                        ),
                        "path": input_data.path,
                        "twist_along_path": input_data.twist_along_path,
                        "twist_angle": input_data.twist_angle,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to create sweep: {result.error}",
                }
        except Exception as e:
            logger.error(f"Error in create_sweep tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def create_loft(input_data: CreateLoftInput) -> dict[str, Any]:
        """Loft a solid between two or more profile sketches.

        Creates a lofted boss/protrusion (Insert > Boss/Base > Loft) blending
        the listed profile sketches in order. Each profile must be a closed
        contour. Optional guide curves shape the transition between profiles.

        Args:
            input_data (CreateLoftInput): Profile names, optional guide curves,
                and tangency/merge options.

        Returns:
            dict[str, Any]: Status and feature details.

        Example:
            ```python
            # Loft between two profiles (e.g. a tapered bevel)
            result = await create_loft({"profiles": ["Sketch1", "Sketch2"]})

            # Loft with guide curves
            result = await create_loft({
                "profiles": ["Sketch1", "Sketch2"],
                "guide_curves": ["Sketch3"],
            })
            ```
        """
        try:
            input_data = _normalize_input(input_data, CreateLoftInput)
            params = LoftParameters(
                profiles=input_data.profiles,
                guide_curves=input_data.guide_curves,
                start_tangent=input_data.start_tangent,
                end_tangent=input_data.end_tangent,
                merge_result=input_data.merge_result,
            )
            result = await adapter.create_loft(params)
            if result.is_success:
                feature = result.data
                return {
                    "status": "success",
                    "message": f"Created loft: {_result_value(feature, 'feature_name', 'name', default='Loft')}",
                    "loft": {
                        "name": _result_value(
                            feature, "feature_name", "name", default="Loft"
                        ),
                        "profiles": input_data.profiles,
                        "guide_curves": input_data.guide_curves,
                    },
                    "execution_time": result.execution_time,
                }
            else:
                return {
                    "status": "error",
                    "message": f"Failed to create loft: {result.error}",
                }
        except Exception as e:
            logger.error(f"Error in create_loft tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def insert_component(input_data: InsertComponentInput) -> dict[str, Any]:
        """Insert a part or sub-assembly into the active assembly.

        Call ``create_assembly`` first. Position is in millimetres from the
        assembly origin.

        **The component file must contain solid geometry** — SolidWorks
        silently refuses to insert an empty part, so a missing or empty
        component surfaces as an error rather than a fabricated success.

        Args:
            input_data (InsertComponentInput): File path and position.

        Returns:
            dict[str, Any]: Status, the component's instance name and counts.

        Example:
            ```python
            await create_assembly({"name": "bracket_asm"})
            await insert_component({"file_path": "C:/parts/plate.sldprt"})
            await insert_component({"file_path": "C:/parts/plate.sldprt", "x": 100.0})
            ```
        """
        try:
            input_data = _normalize_input(input_data, InsertComponentInput)
            result = await adapter.insert_component(
                input_data.file_path, input_data.x, input_data.y, input_data.z
            )
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                return {
                    "status": "success",
                    "message": f"Inserted {data.get('component', 'component')}",
                    "component": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to insert component: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in insert_component tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def add_mate(input_data: AddMateInput) -> dict[str, Any]:
        """Mate two components in the active assembly.

        Positions components relative to one another — coincident planes to
        stack or align them, concentric to line up axes, distance to hold a
        gap.

        Entities are selected by feature name, so only each component's
        reference planes and axes can be mated. Mating to a specific face or
        edge needs entity names this adapter cannot enumerate.

        Args:
            input_data (AddMateInput): Components, entities and mate type.

        Returns:
            dict[str, Any]: Status and mate details.

        Example:
            ```python
            components = await list_components()
            await add_mate({
                "component_a": components["components"][0],
                "component_b": components["components"][1],
                "mate_type": "coincident",
            })
            ```
        """
        try:
            input_data = _normalize_input(input_data, AddMateInput)
            result = await adapter.add_mate(
                input_data.component_a,
                input_data.component_b,
                input_data.entity_a,
                input_data.entity_b,
                input_data.mate_type,
                input_data.alignment,
                input_data.distance,
                input_data.angle,
            )
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                message = (
                    f"Added {input_data.mate_type} mate between "
                    f"{input_data.component_a} and {input_data.component_b}"
                )
                # SolidWorks accepts a mate whose constraint is already
                # satisfied and moves nothing. That is a real success, but
                # saying so plainly beats leaving the caller to infer it.
                if data.get("geometry_moved") is False:
                    message += (
                        " (no component moved - the constraint was already "
                        "satisfied)"
                    )
                return {
                    "status": "success",
                    "message": message,
                    "mate": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to add mate: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in add_mate tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def list_components() -> dict[str, Any]:
        """List the top-level components of the active assembly.

        Returns:
            dict[str, Any]: Status and the component instance names.
        """
        try:
            result = await adapter.list_components()
            if result.is_success:
                components = result.data if isinstance(result.data, list) else []
                return {
                    "status": "success",
                    "message": f"{len(components)} component(s) in the assembly",
                    "components": components,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to list components: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in list_components tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def delete_feature(input_data: DeleteFeatureInput) -> dict[str, Any]:
        """Delete a feature or sketch from the active model.

        Deleting a parent feature also removes everything that depends on it —
        SolidWorks' normal cascade — so the response lists every feature that
        went, not just the one named.

        Args:
            input_data (DeleteFeatureInput): The feature to delete.

        Returns:
            dict[str, Any]: Status and what was removed.

        Example:
            ```python
            await delete_feature({"name": "Boss-Extrude1"})
            ```
        """
        try:
            input_data = _normalize_input(input_data, DeleteFeatureInput)
            result = await adapter.delete_feature(input_data.name)
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                removed = data.get("removed_features") or [input_data.name]
                return {
                    "status": "success",
                    "message": (
                        f"Deleted {input_data.name}"
                        + (
                            f" and {len(removed) - 1} dependent feature(s)"
                            if len(removed) > 1
                            else ""
                        )
                    ),
                    "data": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to delete feature: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in delete_feature tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def suppress_feature(input_data: SuppressFeatureInput) -> dict[str, Any]:
        """Suppress or unsuppress a feature in the active model.

        Suppressing rolls a feature and its children out of the model without
        deleting it — the reversible way to turn off a feature that is causing
        trouble.

        Args:
            input_data (SuppressFeatureInput): The feature and desired state.

        Returns:
            dict[str, Any]: Status and the resulting suppression state.

        Example:
            ```python
            await suppress_feature({"name": "Fillet1"})
            await suppress_feature({"name": "Fillet1", "suppress": False})
            ```
        """
        try:
            input_data = _normalize_input(input_data, SuppressFeatureInput)
            result = await adapter.suppress_feature(
                input_data.name, input_data.suppress
            )
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                verb = "Suppressed" if input_data.suppress else "Unsuppressed"
                message = f"{verb} {input_data.name}"
                if data.get("suppressed") is None:
                    message += " (state could not be read back)"
                return {
                    "status": "success",
                    "message": message,
                    "data": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to suppress feature: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in suppress_feature tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def rename_feature(input_data: RenameFeatureInput) -> dict[str, Any]:
        """Rename a feature on the feature tree.

        SolidWorks silently refuses a rename onto a name another feature
        already uses, so the new name is read back and a mismatch is reported
        as an error rather than a quiet success. Renaming a feature to its
        current name is a no-op success.

        Args:
            input_data (RenameFeatureInput): The feature and its new name.

        Returns:
            dict[str, Any]: Status and the old and new names.

        Example:
            ```python
            await rename_feature({"old_name": "Fillet1", "new_name": "EdgeBreak"})
            ```
        """
        try:
            input_data = _normalize_input(input_data, RenameFeatureInput)
            result = await adapter.rename_feature(
                input_data.old_name, input_data.new_name
            )
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                if data.get("renamed") is False:
                    return {
                        "status": "success",
                        "message": (
                            f"{input_data.old_name} unchanged: "
                            + str(data.get("reason") or "no change")
                        ),
                        "data": data,
                        "execution_time": result.execution_time,
                    }
                return {
                    "status": "success",
                    "message": (
                        f"Renamed {data.get('old_name', input_data.old_name)} to "
                        f"{data.get('new_name', input_data.new_name)}"
                    ),
                    "data": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to rename feature: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in rename_feature tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def undo(input_data: UndoInput | None = None) -> dict[str, Any]:
        """Undo the last operations in the active model.

        SolidWorks accepts an undo with nothing left to undo without
        complaining, so the response reports whether the feature tree actually
        changed rather than assuming it did.

        Args:
            input_data (UndoInput | None): How many steps to undo.

        Returns:
            dict[str, Any]: Status and whether the tree changed.

        Example:
            ```python
            await undo({"count": 1})
            ```
        """
        try:
            input_data = _normalize_input(input_data or UndoInput(), UndoInput)
            result = await adapter.undo(input_data.count)
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                changed = data.get("tree_changed")
                if changed is False:
                    message = (
                        f"Undo of {input_data.count} step(s) left the feature "
                        "tree unchanged - there was nothing to undo"
                    )
                else:
                    message = f"Undid {input_data.count} step(s)"
                return {
                    "status": "success",
                    "message": message,
                    "data": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to undo: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in undo tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}
    @mcp.tool()
    async def create_reference_plane(
        input_data: CreateReferencePlaneInput,
    ) -> dict[str, Any]:
        """Create a reference plane offset from an existing plane or planar face.

        Adds a new plane to the feature tree, parallel to and offset from the
        named reference. The returned plane name can be passed straight to
        ``create_sketch`` to sketch anywhere other than the six built-in
        planes.

        Angled planes are not supported by this tool: an angled plane needs a
        second reference (an axis or edge) to rotate about, which this
        signature cannot take. Use ``offset`` for parallel planes. An
        ``offset`` of zero is rejected — a plane coincident with its
        reference is not useful.

        Args:
            input_data (CreateReferencePlaneInput): Reference name, offset,
                angle and flip.

        Returns:
            dict[str, Any]: Status and the new plane's details.

        Example:
            ```python
            plane = await create_reference_plane(
                {"reference": "Front Plane", "offset": 76.2}
            )
            await create_sketch({"plane": plane["plane"]["name"]})
            ```
        """
        try:
            input_data = _normalize_input(input_data, CreateReferencePlaneInput)
            result = await adapter.create_reference_plane(
                input_data.reference,
                input_data.offset,
                input_data.angle,
                input_data.flip,
            )
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                return {
                    "status": "success",
                    "message": f"Created reference plane: {data.get('name', 'Plane')}",
                    "plane": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to create reference plane: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in create_reference_plane tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def create_axis(input_data: CreateAxisInput) -> dict[str, Any]:
        """Create a reference axis along a principal direction.

        Builds an axis from the intersection of two built-in planes: x from
        Top + Front, y from Front + Right, z from Top + Right.

        Args:
            input_data (CreateAxisInput): The principal direction ('x', 'y'
                or 'z').

        Returns:
            dict[str, Any]: Status and the axis details (planes used).

        Example:
            ```python
            result = await create_axis({"reference": "z"})
            ```
        """
        try:
            input_data = _normalize_input(input_data, CreateAxisInput)
            result = await adapter.create_axis(input_data.reference)
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                axis_name = data.get("reference", input_data.reference)
                return {
                    "status": "success",
                    "message": f"Created {axis_name} axis",
                    "axis": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to create axis: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in create_axis tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def create_reference_point(
        input_data: CreateReferencePointInput,
    ) -> dict[str, Any]:
        """Create a reference point on the active part.

        Two modes:

        - ``along_curve`` — a point on the edge under ``(x, y, z)`` mm, placed
          ``distance`` mm from the edge start, or at ``percent`` (0–100) of
          its length. Give exactly one of ``distance`` / ``percent``.
        - ``face_center`` — a point at the centroid of the face under
          ``(x, y, z)`` mm.

        The coordinate must lie on the target edge/face; SolidWorks resolves
        it with a coordinate pick. ``InsertReferencePoint`` always returns a
        feature, so success is confirmed by the feature tree growing.

        Args:
            input_data (CreateReferencePointInput): Mode, coordinate, and the
                along-curve parameter.

        Returns:
            dict[str, Any]: Status and the point details (feature counts).

        Example:
            ```python
            await create_reference_point({
                "mode": "along_curve", "x": 25, "y": 0, "z": 10, "percent": 50
            })
            ```
        """
        try:
            input_data = _normalize_input(input_data, CreateReferencePointInput)
            result = await adapter.create_reference_point(
                input_data.mode,
                input_data.x,
                input_data.y,
                input_data.z,
                input_data.distance,
                input_data.percent,
            )
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                where = (
                    f"{data.get('percent')}% along a curve"
                    if data.get("percent") is not None
                    else (
                        f"{data.get('distance_mm')} mm along a curve"
                        if data.get("distance_mm") is not None
                        else "a face centre"
                    )
                )
                return {
                    "status": "success",
                    "message": f"Created a reference point at {where}",
                    "point": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to create reference point: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in create_reference_point tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def mirror_feature(input_data: MirrorFeatureInput) -> dict[str, Any]:
        """Mirror solid bodies or features about a plane.

        Selects the named sources and the mirror plane, then mirrors them.
        The mirror is verified by comparing model volume before and after:
        SolidWorks can report a feature even when it mirrored nothing, so a
        volume that did not grow is reported as an error rather than a
        false success.

        Args:
            input_data (MirrorFeatureInput): Source names, mirror plane, and
                merge/mirror_bodies flags.

        Returns:
            dict[str, Any]: Status and the mirror feature's details,
            including volume before/after and the resulting ratio.

        Example:
            ```python
            result = await mirror_feature(
                {"features": ["Loft1"], "mirror_plane": "Right Plane"}
            )
            ```
        """
        try:
            input_data = _normalize_input(input_data, MirrorFeatureInput)
            result = await adapter.mirror_feature(
                input_data.features,
                input_data.mirror_plane,
                input_data.merge,
                input_data.mirror_bodies,
            )
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                return {
                    "status": "success",
                    "message": f"Mirrored {', '.join(input_data.features)} "
                    f"about {input_data.mirror_plane}",
                    "mirror": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to mirror feature: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in mirror_feature tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    @mcp.tool()
    async def pattern_circular(input_data: PatternCircularInput) -> dict[str, Any]:
        """Pattern features around an axis.

        Selects the named axis and features, then creates a circular
        pattern. The pattern is verified by comparing model volume before
        and after: SolidWorks can report a feature even when it patterned
        nothing, so a volume that did not grow is reported as an error
        rather than a false success.

        Args:
            input_data (PatternCircularInput): Feature names, axis, count,
                angle, and equal_spacing.

        Returns:
            dict[str, Any]: Status and the pattern's details, including
            volume before/after and the resulting ratio.

        Example:
            ```python
            result = await pattern_circular(
                {"features": ["Boss-Extrude1"], "axis": "Axis1", "count": 4}
            )
            ```
        """
        try:
            input_data = _normalize_input(input_data, PatternCircularInput)
            result = await adapter.pattern_circular(
                input_data.features,
                input_data.axis,
                input_data.count,
                input_data.angle,
                input_data.equal_spacing,
            )
            if result.is_success:
                data = result.data if isinstance(result.data, dict) else {}
                return {
                    "status": "success",
                    "message": f"Patterned {', '.join(input_data.features)} "
                    f"around {input_data.axis} ({input_data.count} instances)",
                    "pattern": data,
                    "execution_time": result.execution_time,
                }
            return {
                "status": "error",
                "message": f"Failed to pattern feature: {result.error}",
            }
        except Exception as e:
            logger.error(f"Error in pattern_circular tool: {e}")
            return {"status": "error", "message": f"Unexpected error: {str(e)}"}

    # Counted from the registry rather than hand-maintained. The literal that
    # used to live here had drifted: it read 15 while 16 tools were actually
    # registered, so the function misreported its own work and the test
    # enshrined the wrong number.
    tool_count = len(await mcp.list_tools())
    return tool_count