Skip to content

solidworks_mcp.adapters

solidworks_mcp.adapters

SolidWorks adapter interfaces and factory.

This module provides the adapter pattern infrastructure for different SolidWorks integration approaches (pywin32, mock, future edge.js, etc.)

Attributes

__all__ module-attribute

__all__ = ['SolidWorksAdapter', 'AdapterResult', 'AdapterHealth', 'create_adapter', 'AdapterType', 'AdapterFactory', 'PyWin32Adapter', 'MockSolidWorksAdapter', 'CircuitBreakerAdapter', 'ConnectionPoolAdapter', 'ComplexityAnalyzer', 'RoutingDecision', 'IntelligentRouter', 'VbaGeneratorAdapter', 'VbaMacroExecutor', 'MacroExecutionRequest', 'MacroExecutionResult']

Classes

AdapterFactory

Factory-pattern adapter creator with singleton and fallback strategies.

Manages adapter registration and creation with configuration-based selection. Automatically wraps adapters with decorators (circuit breaker, connection pool) based on configuration. Implements singleton pattern for consistency.

Attributes:

Name Type Description
_adapter_registry dict[AdapterType, type[SolidWorksAdapter]]

The adapter registry value.

_adapters dict[AdapterType, type[SolidWorksAdapter]]

The adapters value.

_instance AdapterFactory | None

The instance value.

Example

factory = AdapterFactory() config = SolidWorksMCPConfig(adapter_type=AdapterType.PYWIN32) adapter = factory.create_adapter(config) await adapter.connect()

Methods:
__new__
__new__() -> AdapterFactory

Initialize or return singleton AdapterFactory instance.

Enforces singleton pattern to ensure single adapter registry and consistent factory behavior across application lifetime.

Returns:

Name Type Description
AdapterFactory AdapterFactory

The result produced by the operation.

Example

factory1 = AdapterFactory() factory2 = AdapterFactory() factory1 is factory2 True

Source code in src/solidworks_mcp/adapters/factory.py
def __new__(cls) -> AdapterFactory:
    """Initialize or return singleton AdapterFactory instance.

    Enforces singleton pattern to ensure single adapter registry and consistent factory
    behavior across application lifetime.

    Returns:
        AdapterFactory: The result produced by the operation.

    Example:
                        >>> factory1 = AdapterFactory()
                        >>> factory2 = AdapterFactory()
                        >>> factory1 is factory2
                        True
    """
    if cls._instance is None:
        cls._instance = super().__new__(cls)
    return cls._instance
create_adapter classmethod
create_adapter(config: SolidWorksMCPConfig) -> SolidWorksAdapter

Create and configure a SolidWorks adapter instance.

Determines the best adapter type based on configuration and environment. Selects implementation, applies wrappers (circuit breaker, connection pool), and returns a fully-initialized adapter ready for connection.

The adapter is automatically downgraded to Mock on non-Windows platforms or when testing is enabled, with fallback to configured type otherwise.

Parameters:

Name Type Description Default
config SolidWorksMCPConfig

Configuration values for the operation.

required

Returns:

Name Type Description
SolidWorksAdapter SolidWorksAdapter

The result produced by the operation.

Example

config = SolidWorksMCPConfig(mock_solidworks=True) adapter = AdapterFactory.create_adapter(config) isinstance(adapter, MockSolidWorksAdapter) True

Source code in src/solidworks_mcp/adapters/factory.py
@classmethod
def create_adapter(cls, config: SolidWorksMCPConfig) -> SolidWorksAdapter:
    """Create and configure a SolidWorks adapter instance.

    Determines the best adapter type based on configuration and environment. Selects
    implementation, applies wrappers (circuit breaker, connection pool), and returns a
    fully-initialized adapter ready for connection.

    The adapter is automatically downgraded to Mock on non-Windows platforms or when testing
    is enabled, with fallback to configured type otherwise.

    Args:
        config (SolidWorksMCPConfig): Configuration values for the operation.

    Returns:
        SolidWorksAdapter: The result produced by the operation.

    Example:
                        >>> config = SolidWorksMCPConfig(mock_solidworks=True)
                        >>> adapter = AdapterFactory.create_adapter(config)
                        >>> isinstance(adapter, MockSolidWorksAdapter)
                        True
    """
    factory = cls()
    return factory._create_adapter_impl(config)
register_adapter classmethod
register_adapter(adapter_type: AdapterType, adapter_class: type[SolidWorksAdapter]) -> None

Register an adapter class for a given adapter type.

Updates the adapter registry to map a specific AdapterType enum value to a SolidWorksAdapter implementation class. Called during initialization to register built- in adapters (PyWin32, Mock, etc.).

Parameters:

Name Type Description Default
adapter_type AdapterType

The adapter type value.

required
adapter_class type[SolidWorksAdapter]

The adapter class value.

required

Returns:

Name Type Description
None None

None.

Example

from adapters.pywin32_adapter import PyWin32Adapter AdapterFactory.register_adapter( ... AdapterType.PYWIN32, PyWin32Adapter ... )

Source code in src/solidworks_mcp/adapters/factory.py
@classmethod
def register_adapter(
    cls, adapter_type: AdapterType, adapter_class: type[SolidWorksAdapter]
) -> None:
    """Register an adapter class for a given adapter type.

    Updates the adapter registry to map a specific AdapterType enum value to a
    SolidWorksAdapter implementation class. Called during initialization to register built-
    in adapters (PyWin32, Mock, etc.).

    Args:
        adapter_type (AdapterType): The adapter type value.
        adapter_class (type[SolidWorksAdapter]): The adapter class value.

    Returns:
        None: None.

    Example:
                        >>> from adapters.pywin32_adapter import PyWin32Adapter
                        >>> AdapterFactory.register_adapter(
                        ...     AdapterType.PYWIN32, PyWin32Adapter
                        ... )
    """
    cls._adapter_registry[adapter_type] = adapter_class

AdapterHealth

Bases: BaseModel

Health status information for adapters.

Attributes:

Name Type Description
average_response_time float

The average response time value.

connection_status str

The connection status value.

error_count int

The error count value.

healthy bool

The healthy value.

last_check datetime

The last check value.

metrics dict[str, Any] | None

The metrics value.

success_count int

The success count value.

Methods:
__contains__
__contains__(key: str) -> bool

Build internal contains.

Parameters:

Name Type Description Default
key str

The key value.

required

Returns:

Name Type Description
bool bool

True if contains, otherwise False.

Source code in src/solidworks_mcp/adapters/base.py
def __contains__(self, key: str) -> bool:
    """Build internal contains.

    Args:
        key (str): The key value.

    Returns:
        bool: True if contains, otherwise False.
    """
    legacy_keys = {"status", "connected", "adapter_type", "version", "uptime"}
    if key in legacy_keys:
        return True
    return key in self.model_dump()
__getitem__
__getitem__(key: str) -> Any

Build internal getitem.

Parameters:

Name Type Description Default
key str

The key value.

required

Returns:

Name Type Description
Any Any

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/base.py
def __getitem__(self, key: str) -> Any:
    """Build internal getitem.

    Args:
        key (str): The key value.

    Returns:
        Any: The result produced by the operation.
    """
    if key == "status":
        return "healthy" if self.healthy else "unhealthy"
    if key == "connected":
        return self.connection_status == "connected"
    if key == "adapter_type":
        return (self.metrics or {}).get("adapter_type")
    if key == "version":
        return (self.metrics or {}).get("version", "mock-1.0")
    if key == "uptime":
        return (self.metrics or {}).get("uptime", 0.0)
    return self.model_dump().get(key)

AdapterResult dataclass

AdapterResult(status: AdapterResultStatus, data: T | None = None, error: str | None = None, execution_time: float | None = None, metadata: dict[str, Any] | None = None)

Result wrapper for adapter operations.

Attributes:

Name Type Description
data T | None

The data value.

error str | None

The error value.

execution_time float | None

The execution time value.

metadata dict[str, Any] | None

The metadata value.

status AdapterResultStatus

The status value.

Attributes
is_error property
is_error: bool

Check if operation had an error.

Returns:

Name Type Description
bool bool

True if error, otherwise False.

is_success property
is_success: bool

Check if operation was successful.

Returns:

Name Type Description
bool bool

True if success, otherwise False.

AdapterType

Bases: StrEnum

SolidWorks adapter implementation options.

Attributes:

Name Type Description
EDGE_DOTNET Any

The edge dotnet value.

MOCK Any

The mock value.

POWERSHELL Any

The powershell value.

PYWIN32 Any

The pywin32 value.

VBA Any

The vba value.

CircuitBreakerAdapter

CircuitBreakerAdapter(adapter: SolidWorksAdapter | None = None, failure_threshold: int = 5, recovery_timeout: int = 60, half_open_max_calls: int = 3, config: dict[str, object] | None = None)

Bases: SolidWorksAdapter

Circuit breaker wrapper for SolidWorks adapters.

Each named operation (create_cut_extrude, list_features, ...) gets its own independent breaker bucket, keyed by the operation_name passed to _execute_with_circuit_breaker. A run of failures on one tool (e.g. every create_cut_extrude attempt failing while a wrong argument count is being worked out) trips only that tool's breaker — unrelated read-only tools like list_features or get_model_info keep working. Before this, a single shared CircuitState meant one failing tool blocked every other tool on the adapter, including reads, until the shared recovery timeout elapsed.

Parameters:

Name Type Description Default
adapter SolidWorksAdapter | None

Adapter instance used for the operation. Defaults to None.

None
failure_threshold int

The failure threshold value. Defaults to 5.

5
recovery_timeout int

The recovery timeout value. Defaults to 60.

60
half_open_max_calls int

The half open max calls value. Defaults to 3.

3
config dict[str, object] | None

Configuration values for the operation. Defaults to None.

None

Attributes:

Name Type Description
adapter Any

The adapter value.

failure_threshold Any

The failure threshold value.

half_open_max_calls Any

The half open max calls value.

recovery_timeout Any

The recovery timeout value.

Initialize the circuit breaker adapter.

Parameters:

Name Type Description Default
adapter SolidWorksAdapter | None

Adapter instance used for the operation. Defaults to None.

None
failure_threshold int

The failure threshold value. Defaults to 5.

5
recovery_timeout int

The recovery timeout value. Defaults to 60.

60
half_open_max_calls int

The half open max calls value. Defaults to 3.

3
config dict[str, object] | None

Configuration values for the operation. Defaults to None.

None

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
def __init__(
    self,
    adapter: SolidWorksAdapter | None = None,
    failure_threshold: int = 5,
    recovery_timeout: int = 60,
    half_open_max_calls: int = 3,
    config: dict[str, object] | None = None,
) -> None:
    """Initialize the circuit breaker adapter.

    Args:
        adapter (SolidWorksAdapter | None): Adapter instance used for the operation.
                                            Defaults to None.
        failure_threshold (int): The failure threshold value. Defaults to 5.
        recovery_timeout (int): The recovery timeout value. Defaults to 60.
        half_open_max_calls (int): The half open max calls value. Defaults to 3.
        config (dict[str, object] | None): Configuration values for the operation. Defaults
                                           to None.

    Returns:
        None: None.
    """
    if adapter is None:
        from .mock_adapter import MockSolidWorksAdapter

        adapter = MockSolidWorksAdapter(config or {})
    super().__init__(config)
    self.adapter = adapter
    self.failure_threshold = failure_threshold
    self.recovery_timeout = recovery_timeout
    self.half_open_max_calls = half_open_max_calls

    # Legacy/default bucket, used by connect() and the generic call() API.
    self.state = CircuitState.CLOSED
    self.failure_count = 0
    self.last_failure_time: float = 0.0
    self.half_open_calls = 0

    # Per-operation buckets, keyed by operation_name, used by every named
    # method that goes through _execute_with_circuit_breaker.
    self._buckets: dict[str, _BreakerBucket] = {}
Methods:
activate_document async
activate_document(title_or_path: str) -> AdapterResult[dict[str, Any]]

Activate an open document through circuit breaker.

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]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def activate_document(
    self, title_or_path: str
) -> AdapterResult[dict[str, Any]]:
    """Activate an open document through circuit breaker.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "activate_document",
        lambda: self.adapter.activate_document(title_or_path),
        input_dict={"title_or_path": title_or_path},
    )
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 arc through circuit breaker.

Parameters:

Name Type Description Default
center_x float

Arc center X coordinate.

required
center_y float

Arc center Y coordinate.

required
start_x float

Arc start X coordinate.

required
start_y float

Arc start Y coordinate.

required
end_x float

Arc end X coordinate.

required
end_y float

Arc end Y coordinate.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.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 arc through circuit breaker.

    Args:
        center_x (float): Arc center X coordinate.
        center_y (float): Arc center Y coordinate.
        start_x (float): Arc start X coordinate.
        start_y (float): Arc start Y coordinate.
        end_x (float): Arc end X coordinate.
        end_y (float): Arc end Y coordinate.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "add_arc",
        lambda: self.adapter.add_arc(
            center_x,
            center_y,
            start_x,
            start_y,
            end_x,
            end_y,
        ),
        input_dict={
            "center_x": center_x,
            "center_y": center_y,
            "start_x": start_x,
            "start_y": start_y,
            "end_x": end_x,
            "end_y": end_y,
        },
    )
add_centerline async
add_centerline(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add centerline through circuit breaker.

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/circuit_breaker.py
async def add_centerline(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add centerline through circuit breaker.

    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 await self._execute_with_circuit_breaker(
        "add_centerline",
        lambda: self.adapter.add_centerline(x1, y1, x2, y2),
        input_dict={"x1": x1, "y1": y1, "x2": x2, "y2": y2},
    )
add_chamfer async
add_chamfer(distance: float, edge_names: list[str], angle: float = 45.0, flip: bool = False) -> AdapterResult[SolidWorksFeature]

Add chamfer through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_chamfer(
    self,
    distance: float,
    edge_names: list[str],
    angle: float = 45.0,
    flip: bool = False,
) -> AdapterResult[SolidWorksFeature]:
    """Add chamfer through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_chamfer",
        lambda: self.adapter.add_chamfer(distance, edge_names, angle, flip),
        input_dict={
            "distance": distance,
            "edge_names": edge_names,
            "angle": angle,
            "flip": flip,
        },
    )
add_circle async
add_circle(center_x: float, center_y: float, radius: float) -> AdapterResult[str]

Add circle through circuit breaker.

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/circuit_breaker.py
async def add_circle(
    self, center_x: float, center_y: float, radius: float
) -> AdapterResult[str]:
    """Add circle through circuit breaker.

    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.
    """
    return await self._execute_with_circuit_breaker(
        "add_circle",
        lambda: self.adapter.add_circle(center_x, center_y, radius),
        input_dict={"center_x": center_x, "center_y": center_y, "radius": radius},
    )
add_datum_tag async
add_datum_tag(label: str, attach_at_mm: tuple[float, float], x_mm: float, y_mm: float) -> AdapterResult[dict[str, Any]]

Add a datum feature symbol through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_datum_tag(
    self,
    label: str,
    attach_at_mm: tuple[float, float],
    x_mm: float,
    y_mm: float,
) -> AdapterResult[dict[str, Any]]:
    """Add a datum feature symbol through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_datum_tag",
        lambda: self.adapter.add_datum_tag(label, attach_at_mm, x_mm, y_mm),
        input_dict={
            "label": label,
            "attach_at_mm": attach_at_mm,
            "x_mm": x_mm,
            "y_mm": y_mm,
        },
    )
add_drawing_view async
add_drawing_view(payload: Any = None) -> AdapterResult[dict[str, Any]]

Add a drawing view through circuit breaker.

Parameters:

Name Type Description Default
payload Any

Tool payload for the drawing view.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_drawing_view(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Add a drawing view through circuit breaker.

    Args:
        payload (Any): Tool payload for the drawing view.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "add_drawing_view",
        lambda: self.adapter.add_drawing_view(payload),
        input_dict=payload if isinstance(payload, dict) else {},
    )
add_ellipse async
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float) -> AdapterResult[str]

Add ellipse through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_ellipse(
    self,
    center_x: float,
    center_y: float,
    major_axis: float,
    minor_axis: float,
) -> AdapterResult[str]:
    """Add ellipse through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_ellipse",
        lambda: self.adapter.add_ellipse(
            center_x, center_y, major_axis, minor_axis
        ),
        input_dict={
            "center_x": center_x,
            "center_y": center_y,
            "major_axis": major_axis,
            "minor_axis": minor_axis,
        },
    )
add_fillet async
add_fillet(radius: float, edge_names: list[str]) -> AdapterResult[SolidWorksFeature]

Add fillet through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_fillet(
    self, radius: float, edge_names: list[str]
) -> AdapterResult[SolidWorksFeature]:
    """Add fillet through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_fillet",
        lambda: self.adapter.add_fillet(radius, edge_names),
        input_dict={"radius": radius, "edge_names": edge_names},
    )
add_gtol async
add_gtol(characteristic: str, tolerance: float, x_mm: float, y_mm: float, diameter_zone: bool = False, material_condition: str = 'none', datums: list[str] | None = None, attach_at_mm: tuple[float, float] | None = None, dimension: tuple[str, str] | None = None) -> AdapterResult[dict[str, Any]]

Add a GD&T feature control frame through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_gtol(
    self,
    characteristic: str,
    tolerance: float,
    x_mm: float,
    y_mm: float,
    diameter_zone: bool = False,
    material_condition: str = "none",
    datums: list[str] | None = None,
    attach_at_mm: tuple[float, float] | None = None,
    dimension: tuple[str, str] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add a GD&T feature control frame through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_gtol",
        lambda: self.adapter.add_gtol(
            characteristic,
            tolerance,
            x_mm,
            y_mm,
            diameter_zone,
            material_condition,
            datums,
            attach_at_mm,
            dimension,
        ),
        input_dict={
            "characteristic": characteristic,
            "tolerance": tolerance,
            "x_mm": x_mm,
            "y_mm": y_mm,
            "diameter_zone": diameter_zone,
            "material_condition": material_condition,
            "datums": datums,
            "attach_at_mm": attach_at_mm,
            "dimension": dimension,
        },
    )
add_line async
add_line(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add line through circuit breaker.

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/circuit_breaker.py
async def add_line(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add line through circuit breaker.

    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 await self._execute_with_circuit_breaker(
        "add_line",
        lambda: self.adapter.add_line(x1, y1, x2, y2),
        input_dict={"x1": x1, "y1": y1, "x2": x2, "y2": y2},
    )
add_mate async
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0, face_a: list[float] | None = None, face_b: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Add mate through circuit breaker.

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. Defaults to "coincident".

'coincident'
alignment str

Mate alignment. Defaults to "aligned".

'aligned'
distance float

Distance in millimetres. Defaults to 0.0.

0.0
angle float

Angle in degrees. Defaults to 0.0.

0.0
face_a list[float] | None

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

None
face_b list[float] | None

The same for the second component.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_mate(
    self,
    component_a: str,
    component_b: str,
    entity_a: str = "Front Plane",
    entity_b: str = "Front Plane",
    mate_type: str = "coincident",
    alignment: str = "aligned",
    distance: float = 0.0,
    angle: float = 0.0,
    face_a: list[float] | None = None,
    face_b: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add mate through circuit breaker.

    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. Defaults to "coincident".
        alignment (str): Mate alignment. Defaults to "aligned".
        distance (float): Distance in millimetres. Defaults to 0.0.
        angle (float): Angle in degrees. Defaults to 0.0.
        face_a (list[float] | None): A point on a face of the first
            component, in its part coordinates (mm), instead of entity_a.
        face_b (list[float] | None): The same for the second component.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "add_mate",
        lambda: self.adapter.add_mate(
            component_a,
            component_b,
            entity_a,
            entity_b,
            mate_type,
            alignment,
            distance,
            angle,
            face_a,
            face_b,
        ),
        input_dict={
            "component_a": component_a,
            "component_b": component_b,
            "entity_a": entity_a,
            "entity_b": entity_b,
            "mate_type": mate_type,
            "alignment": alignment,
            "distance": distance,
            "angle": angle,
            "face_a": face_a,
            "face_b": face_b,
        },
    )
add_note async
add_note(payload: Any = None) -> AdapterResult[dict[str, Any]]

Add a drawing note through circuit breaker.

Parameters:

Name Type Description Default
payload Any

Tool payload for the note.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_note(self, payload: Any = None) -> AdapterResult[dict[str, Any]]:
    """Add a drawing note through circuit breaker.

    Args:
        payload (Any): Tool payload for the note.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "add_note",
        lambda: self.adapter.add_note(payload),
        input_dict=payload if isinstance(payload, dict) else {},
    )
add_polygon async
add_polygon(center_x: float, center_y: float, radius: float, sides: int) -> AdapterResult[str]

Add polygon through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_polygon(
    self, center_x: float, center_y: float, radius: float, sides: int
) -> AdapterResult[str]:
    """Add polygon through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_polygon",
        lambda: self.adapter.add_polygon(center_x, center_y, radius, sides),
        input_dict={
            "center_x": center_x,
            "center_y": center_y,
            "radius": radius,
            "sides": sides,
        },
    )
add_rectangle async
add_rectangle(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add rectangle through circuit breaker.

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/circuit_breaker.py
async def add_rectangle(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add rectangle through circuit breaker.

    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 await self._execute_with_circuit_breaker(
        "add_rectangle",
        lambda: self.adapter.add_rectangle(x1, y1, x2, y2),
        input_dict={"x1": x1, "y1": y1, "x2": x2, "y2": y2},
    )
add_sketch_constraint async
add_sketch_constraint(entity1: str, entity2: str | None, relation_type: str, entity3: str | None = None) -> AdapterResult[str]

Add sketch constraint through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_sketch_constraint(
    self,
    entity1: str,
    entity2: str | None,
    relation_type: str,
    entity3: str | None = None,
) -> AdapterResult[str]:
    """Add sketch constraint through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_sketch_constraint",
        lambda: self.adapter.add_sketch_constraint(
            entity1,
            entity2,
            relation_type,
            entity3,
        ),
        input_dict={
            "entity1": entity1,
            "entity2": entity2,
            "relation_type": relation_type,
            "entity3": entity3,
        },
    )
add_sketch_dimension async
add_sketch_dimension(entity1: str, entity2: str | None, dimension_type: str, value: float) -> AdapterResult[str]

Add sketch dimension through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_sketch_dimension(
    self,
    entity1: str,
    entity2: str | None,
    dimension_type: str,
    value: float,
) -> AdapterResult[str]:
    """Add sketch dimension through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_sketch_dimension",
        lambda: self.adapter.add_sketch_dimension(
            entity1,
            entity2,
            dimension_type,
            value,
        ),
        input_dict={
            "entity1": entity1,
            "entity2": entity2,
            "dimension_type": dimension_type,
            "value": value,
        },
    )
add_spline async
add_spline(points: list[dict[str, float]]) -> AdapterResult[str]

Add spline through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def add_spline(self, points: list[dict[str, float]]) -> AdapterResult[str]:
    """Add spline through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_spline",
        lambda: self.adapter.add_spline(points),
        input_dict={"points": points},
    )
arrange_dimensions async
arrange_dimensions(view_name: str | None = None) -> AdapterResult[dict[str, Any]]

Move drawing dimensions so none overlaps, then verify through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def arrange_dimensions(
    self,
    view_name: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Move drawing dimensions so none overlaps, then verify through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "arrange_dimensions",
        lambda: self.adapter.arrange_dimensions(view_name),
        input_dict={"view_name": view_name},
    )
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 drawing centre marks through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.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 drawing centre marks through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "auto_center_marks",
        lambda: self.adapter.auto_center_marks(
            view_name, mark_holes, mark_fillets, mark_slots
        ),
        input_dict={
            "view_name": view_name,
            "mark_holes": mark_holes,
            "mark_fillets": mark_fillets,
            "mark_slots": mark_slots,
        },
    )
call async
call(operation: Callable[[], object | Awaitable[object]]) -> object

Legacy call API used by tests.

Parameters:

Name Type Description Default
operation Callable[[], object | Awaitable[object]]

Callable object executed by the helper.

required

Returns:

Name Type Description
object object

The result produced by the operation.

Raises:

Type Description
RuntimeError

If the operation cannot be completed.

Exception

Circuit breaker is open.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def call(self, operation: Callable[[], object | Awaitable[object]]) -> object:
    """Legacy call API used by tests.

    Args:
        operation (Callable[[], object | Awaitable[object]]): Callable object executed by
                                                              the helper.

    Returns:
        object: The result produced by the operation.

    Raises:
        RuntimeError: If the operation cannot be completed.
        Exception: Circuit breaker is open.
    """
    if not self._should_allow_request():
        raise Exception("Circuit breaker is open")
    try:
        result = operation()
        if asyncio.iscoroutine(result):
            result = await result
        self._record_success()
        return result
    except Exception as exc:
        self._record_failure()
        raise RuntimeError(str(exc)) from exc
check_interference async
check_interference(params: Any = None) -> AdapterResult[dict[str, Any]]

Check interference through circuit breaker.

Parameters:

Name Type Description Default
params Any

Optional interference-detection settings.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def check_interference(
    self, params: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Check interference through circuit breaker.

    Args:
        params (Any): Optional interference-detection settings.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "check_interference",
        lambda: self.adapter.check_interference(params),
        input_dict=params if isinstance(params, dict) else {},
    )
check_sketch_fully_defined async
check_sketch_fully_defined(sketch_name: str | None = None) -> AdapterResult[dict[str, Any]]

Check sketch definition status through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def check_sketch_fully_defined(
    self, sketch_name: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Check sketch definition status through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "check_sketch_fully_defined",
        lambda: self.adapter.check_sketch_fully_defined(sketch_name),
        input_dict={"sketch_name": sketch_name},
    )
close_model async
close_model(save: bool = False) -> AdapterResult[None]

Close model through circuit breaker.

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/circuit_breaker.py
async def close_model(self, save: bool = False) -> AdapterResult[None]:
    """Close model through circuit breaker.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "close_model",
        lambda: self.adapter.close_model(save),
        input_dict={"save": save},
    )
connect async
connect() -> None

Connect through circuit breaker.

Returns:

Name Type Description
None None

None.

Raises:

Type Description
Exception

If the operation cannot be completed.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def connect(self) -> None:
    """Connect through circuit breaker.

    Returns:
        None: None.

    Raises:
        Exception: If the operation cannot be completed.
    """
    if not self._should_allow_request():
        raise Exception(f"Circuit breaker is {self.state.value}")

    try:
        await self.adapter.connect()
        self._record_success()
    except Exception:
        self._record_failure()
        raise
create_assembly async
create_assembly(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create assembly through circuit breaker.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_assembly(
    self, name: str | None = None, template: str | None = None
) -> AdapterResult[SolidWorksModel]:
    """Create assembly through circuit breaker.

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

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

    async def _op() -> AdapterResult[SolidWorksModel]:
        """Build internal op.

        Returns:
            AdapterResult[SolidWorksModel]: The result produced by the operation.
        """
        if template is not None:
            return await self.adapter.create_assembly(name, template)
        if name is None:
            return await self.adapter.create_assembly()
        return await self._invoke_with_optional_args(
            self.adapter.create_assembly,
            name,
        )

    return await self._execute_with_circuit_breaker(
        "create_assembly", _op, input_dict={"name": name, "template": template}
    )
create_axis async
create_axis(reference: str) -> AdapterResult[dict[str, Any]]

Create reference axis through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_axis(self, reference: str) -> AdapterResult[dict[str, Any]]:
    """Create reference axis through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "create_axis",
        lambda: self.adapter.create_axis(reference),
        input_dict={"reference": reference},
    )
create_cut_extrude async
create_cut_extrude(params: ExtrusionParameters) -> AdapterResult[SolidWorksFeature]

Create cut-extrude through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_cut_extrude(
    self, params: ExtrusionParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create cut-extrude through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "create_cut_extrude",
        lambda: self.adapter.create_cut_extrude(params),
        input_dict=_to_input_dict(params),
    )
create_drawing async
create_drawing(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create drawing through circuit breaker.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_drawing(
    self, name: str | None = None, template: str | None = None
) -> AdapterResult[SolidWorksModel]:
    """Create drawing through circuit breaker.

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "create_drawing",
        lambda: self.adapter.create_drawing(name, template),
        input_dict={"name": name, "template": template},
    )
create_drawing_view async
create_drawing_view(payload: Any = None) -> AdapterResult[dict[str, Any]]

Create a drawing view through circuit breaker.

Parameters:

Name Type Description Default
payload Any

Tool payload for the drawing view.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_drawing_view(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Create a drawing view through circuit breaker.

    Args:
        payload (Any): Tool payload for the drawing view.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "create_drawing_view",
        lambda: self.adapter.create_drawing_view(payload),
        input_dict=payload if isinstance(payload, dict) else {},
    )
create_extrusion async
create_extrusion(params: ExtrusionParameters) -> AdapterResult[SolidWorksFeature]

Create extrusion through circuit breaker.

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/circuit_breaker.py
async def create_extrusion(
    self, params: ExtrusionParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create extrusion through circuit breaker.

    Args:
        params (ExtrusionParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "create_extrusion",
        lambda: self.adapter.create_extrusion(params),
        input_dict=_to_input_dict(params),
    )
create_loft async
create_loft(params: LoftParameters) -> AdapterResult[SolidWorksFeature]

Create loft through circuit breaker.

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/circuit_breaker.py
async def create_loft(
    self, params: LoftParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create loft through circuit breaker.

    Args:
        params (LoftParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "create_loft",
        lambda: self.adapter.create_loft(params),
        input_dict=_to_input_dict(params),
    )
create_part async
create_part(name: str | None = None, units: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create part through circuit breaker.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
units str | None

The units value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_part(
    self,
    name: str | None = None,
    units: str | None = None,
    template: str | None = None,
) -> AdapterResult[SolidWorksModel]:
    """Create part through circuit breaker.

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

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

    async def _op() -> AdapterResult[SolidWorksModel]:
        """Build internal op.

        Returns:
            AdapterResult[SolidWorksModel]: The result produced by the operation.
        """
        if template is not None:
            # No zero-arg retry: dropping the template would silently
            # build the document from a different one.
            return await self.adapter.create_part(name, units, template)
        if name is None and units is None:
            return await self.adapter.create_part()
        return await self._invoke_with_optional_args(
            self.adapter.create_part,
            name,
            units,
        )

    return await self._execute_with_circuit_breaker(
        "create_part",
        _op,
        input_dict={"name": name, "units": units, "template": template},
    )
create_reference_plane async
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False, axis: str | None = None, face_point: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Create reference plane through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_reference_plane(
    self,
    reference: str,
    offset: float = 0.0,
    angle: float = 0.0,
    flip: bool = False,
    axis: str | None = None,
    face_point: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Create reference plane through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "create_reference_plane",
        lambda: self.adapter.create_reference_plane(
            reference, offset, angle, flip, axis, face_point
        ),
        input_dict={
            "reference": reference,
            "offset": offset,
            "angle": angle,
            "flip": flip,
            "axis": axis,
            "face_point": face_point,
        },
    )
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 through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.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 through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "create_reference_point",
        lambda: self.adapter.create_reference_point(
            mode, x, y, z, distance, percent
        ),
        input_dict={
            "mode": mode,
            "x": x,
            "y": y,
            "z": z,
            "distance": distance,
            "percent": percent,
        },
    )
create_revolve async
create_revolve(params: RevolveParameters) -> AdapterResult[SolidWorksFeature]

Create revolve through circuit breaker.

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/circuit_breaker.py
async def create_revolve(
    self, params: RevolveParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create revolve through circuit breaker.

    Args:
        params (RevolveParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "create_revolve",
        lambda: self.adapter.create_revolve(params),
        input_dict=_to_input_dict(params),
    )
create_sketch async
create_sketch(plane: str) -> AdapterResult[str]

Create sketch through circuit breaker.

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/circuit_breaker.py
async def create_sketch(self, plane: str) -> AdapterResult[str]:
    """Create sketch through circuit breaker.

    Args:
        plane (str): The plane value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "create_sketch",
        lambda: self.adapter.create_sketch(plane),
        input_dict={"plane": plane},
    )
create_standard_drawing async
create_standard_drawing(model_path: str, output_dir: str | None = None, title: str | None = None, subtitle: str | None = None, drawing_number: str | None = None, author: str = '', revision: str = 'A', company: str = '', drawn_date: str | None = None, notes: list[str] | None = None, include_isometric: bool = True, write_model_properties: bool = True, title_block_text_height_mm: float | None = None, include_bom: bool = False) -> AdapterResult[dict[str, Any]]

Create a complete standard A3 drawing through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_standard_drawing(
    self,
    model_path: str,
    output_dir: str | None = None,
    title: str | None = None,
    subtitle: str | None = None,
    drawing_number: str | None = None,
    author: str = "",
    revision: str = "A",
    company: str = "",
    drawn_date: str | None = None,
    notes: list[str] | None = None,
    include_isometric: bool = True,
    write_model_properties: bool = True,
    title_block_text_height_mm: float | None = None,
    include_bom: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Create a complete standard A3 drawing through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "create_standard_drawing",
        lambda: self.adapter.create_standard_drawing(
            model_path,
            output_dir,
            title,
            subtitle,
            drawing_number,
            author,
            revision,
            company,
            drawn_date,
            notes,
            include_isometric,
            write_model_properties,
            title_block_text_height_mm,
            include_bom,
        ),
        input_dict={
            "model_path": model_path,
            "output_dir": output_dir,
            "title": title,
            "subtitle": subtitle,
            "drawing_number": drawing_number,
            "author": author,
            "revision": revision,
            "company": company,
            "drawn_date": drawn_date,
            "notes": notes,
            "include_isometric": include_isometric,
            "write_model_properties": write_model_properties,
            "title_block_text_height_mm": title_block_text_height_mm,
            "include_bom": include_bom,
        },
    )
create_sweep async
create_sweep(params: SweepParameters) -> AdapterResult[SolidWorksFeature]

Create sweep through circuit breaker.

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/circuit_breaker.py
async def create_sweep(
    self, params: SweepParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create sweep through circuit breaker.

    Args:
        params (SweepParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "create_sweep",
        lambda: self.adapter.create_sweep(params),
        input_dict=_to_input_dict(params),
    )
create_technical_drawing async
create_technical_drawing(payload: Any = None) -> AdapterResult[dict[str, Any]]

Create standard views through circuit breaker.

Parameters:

Name Type Description Default
payload Any

Tool payload for the technical drawing.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def create_technical_drawing(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Create standard views through circuit breaker.

    Args:
        payload (Any): Tool payload for the technical drawing.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "create_technical_drawing",
        lambda: self.adapter.create_technical_drawing(payload),
        input_dict=payload if isinstance(payload, dict) else {},
    )
delete_feature async
delete_feature(name: str) -> AdapterResult[dict[str, Any]]

Delete a feature through circuit breaker.

Parameters:

Name Type Description Default
name str

Feature or sketch name.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def delete_feature(self, name: str) -> AdapterResult[dict[str, Any]]:
    """Delete a feature through circuit breaker.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "delete_feature",
        lambda: self.adapter.delete_feature(name),
        input_dict={"name": name},
    )
disconnect async
disconnect() -> None

Disconnect - always allowed.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def disconnect(self) -> None:
    """Disconnect - always allowed.

    Returns:
        None: None.
    """
    await self.adapter.disconnect()
execute_macro async
execute_macro(params: dict[str, Any]) -> AdapterResult[dict[str, Any]]

Provide execute macro support for the circuit breaker adapter.

Parameters:

Name Type Description Default
params dict[str, Any]

The params value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def execute_macro(
    self, params: dict[str, Any]
) -> AdapterResult[dict[str, Any]]:
    """Provide execute macro support for the circuit breaker adapter.

    Args:
        params (dict[str, Any]): The params value.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "execute_macro",
        lambda: self.adapter.execute_macro(params),  # type: ignore[attr-defined]
        input_dict=params,
    )
exit_sketch async
exit_sketch() -> AdapterResult[None]

Exit sketch through circuit breaker.

Returns:

Type Description
AdapterResult[None]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def exit_sketch(self) -> AdapterResult[None]:
    """Exit sketch through circuit breaker.

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "exit_sketch",
        lambda: self.adapter.exit_sketch(),
        input_dict={},
    )
export_file async
export_file(file_path: str, format_type: str) -> AdapterResult[None]

Export file through circuit breaker.

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/circuit_breaker.py
async def export_file(
    self, file_path: str, format_type: str
) -> AdapterResult[None]:
    """Export file through circuit breaker.

    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.
    """
    return await self._execute_with_circuit_breaker(
        "export_file",
        lambda: self.adapter.export_file(file_path, format_type),
        input_dict={"file_path": file_path, "format_type": format_type},
    )
export_flat_pattern async
export_flat_pattern(file_path: str) -> AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def export_flat_pattern(
    self,
    file_path: str,
) -> AdapterResult[dict[str, Any]]:
    """Export the active sheet-metal part's flat pattern through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "export_flat_pattern",
        lambda: self.adapter.export_flat_pattern(file_path),
        input_dict={"file_path": file_path},
    )
export_image async
export_image(payload: dict) -> AdapterResult[dict]

Export viewport image through circuit breaker.

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/circuit_breaker.py
async def export_image(self, payload: dict) -> AdapterResult[dict]:
    """Export viewport image through circuit breaker.

    Args:
        payload (dict): The payload value.

    Returns:
        AdapterResult[dict]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "export_image",
        lambda: self.adapter.export_image(payload),
        input_dict=payload,
    )
get_application_info async
get_application_info() -> AdapterResult[dict[str, Any]]

Describe the connected SolidWorks through circuit breaker.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def get_application_info(self) -> AdapterResult[dict[str, Any]]:
    """Describe the connected SolidWorks through circuit breaker.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "get_application_info",
        lambda: self.adapter.get_application_info(),
        input_dict={},
    )
get_custom_properties async
get_custom_properties(configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Read the custom properties of the active document through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def get_custom_properties(
    self,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Read the custom properties of the active document through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "get_custom_properties",
        lambda: self.adapter.get_custom_properties(configuration),
        input_dict={"configuration": configuration},
        error_results_are_failures=False,
    )
get_dimension async
get_dimension(name: str) -> AdapterResult[dict[str, Any]]

Get dimension through circuit breaker.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def get_dimension(self, name: str) -> AdapterResult[dict[str, Any]]:
    """Get dimension through circuit breaker.

    Args:
        name (str): The name value.

    Returns:
        AdapterResult[dict[str, Any]]: ``value`` and ``units`` (mm, deg or None).
    """
    return await self._execute_with_circuit_breaker(
        "get_dimension",
        lambda: self.adapter.get_dimension(name),
        input_dict={"name": name},
    )
get_mass_properties async
get_mass_properties() -> AdapterResult[MassProperties]

Get mass properties through circuit breaker.

Returns:

Type Description
AdapterResult[MassProperties]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def get_mass_properties(self) -> AdapterResult[MassProperties]:
    """Get mass properties through circuit breaker.

    Returns:
        AdapterResult[MassProperties]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "get_mass_properties",
        lambda: self.adapter.get_mass_properties(),
        input_dict={},
    )
get_material async
get_material(configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Read the material assigned to the active part through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def get_material(
    self,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Read the material assigned to the active part through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "get_material",
        lambda: self.adapter.get_material(configuration),
        input_dict={"configuration": configuration},
        error_results_are_failures=False,
    )
get_model_geometry_summary async
get_model_geometry_summary() -> AdapterResult[dict[str, Any]]

Summarise the active document through circuit breaker.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def get_model_geometry_summary(self) -> AdapterResult[dict[str, Any]]:
    """Summarise the active document through circuit breaker.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "get_model_geometry_summary",
        lambda: self.adapter.get_model_geometry_summary(),
        input_dict={},
    )
get_model_info async
get_model_info() -> AdapterResult[dict[str, object]]

Get active model metadata through circuit breaker.

Returns:

Type Description
AdapterResult[dict[str, object]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def get_model_info(self) -> AdapterResult[dict[str, object]]:
    """Get active model metadata through circuit breaker.

    Returns:
        AdapterResult[dict[str, object]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "get_model_info",
        lambda: self.adapter.get_model_info(),
        input_dict={},
    )
get_selected_entities async
get_selected_entities() -> AdapterResult[list[dict[str, Any]]]

Report the current UI selection through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def get_selected_entities(self) -> AdapterResult[list[dict[str, Any]]]:
    """Report the current UI selection through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "get_selected_entities",
        lambda: self.adapter.get_selected_entities(),
        input_dict={},
    )
health_check async
health_check() -> AdapterHealth

Get health check with circuit breaker status.

circuit_breaker reports the legacy/default bucket (used by connect()), which is what "connection health" means here. circuit_breaker_operations reports every per-tool bucket, so a tripped tool-specific breaker is visible even while the connection itself is healthy.

Returns:

Name Type Description
AdapterHealth AdapterHealth

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def health_check(self) -> AdapterHealth:
    """Get health check with circuit breaker status.

    ``circuit_breaker`` reports the legacy/default bucket (used by
    ``connect()``), which is what "connection health" means here.
    ``circuit_breaker_operations`` reports every per-tool bucket, so a
    tripped tool-specific breaker is visible even while the connection
    itself is healthy.

    Returns:
        AdapterHealth: The result produced by the operation.
    """
    base_health = await self.adapter.health_check()
    if base_health.metrics is None:
        base_health.metrics = {}
    base_health.metrics["circuit_breaker"] = {
        "state": self.state.value,
        "failure_count": self.failure_count,
        "last_failure_time": self.last_failure_time,
        "half_open_calls": self.half_open_calls,
    }
    base_health.metrics["circuit_breaker_operations"] = {
        name: {
            "state": bucket.state.value,
            "failure_count": bucket.failure_count,
            "last_failure_time": bucket.last_failure_time,
            "half_open_calls": bucket.half_open_calls,
        }
        for name, bucket in self._buckets.items()
    }

    # Consider circuit as unhealthy if the connection breaker or any
    # per-operation breaker is open.
    open_operations = [
        name
        for name, bucket in self._buckets.items()
        if bucket.state == CircuitState.OPEN
    ]
    if self.state == CircuitState.OPEN:
        base_health.healthy = False
        base_health.connection_status = "circuit_breaker_open"
    elif open_operations:
        base_health.healthy = False
        base_health.connection_status = (
            f"circuit_breaker_open_for: {', '.join(sorted(open_operations))}"
        )

    return base_health
insert_bom_table async
insert_bom_table(view_name: str, template_path: str | None = None, bom_type: str = 'top_level_only', x_mm: float | None = None, y_mm: float | None = None) -> AdapterResult[dict[str, Any]]

Insert a BOM table anchored to an assembly drawing view through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def insert_bom_table(
    self,
    view_name: str,
    template_path: str | None = None,
    bom_type: str = "top_level_only",
    x_mm: float | None = None,
    y_mm: float | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Insert a BOM table anchored to an assembly drawing view through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "insert_bom_table",
        lambda: self.adapter.insert_bom_table(
            view_name, template_path, bom_type, x_mm, y_mm
        ),
        input_dict={
            "view_name": view_name,
            "template_path": template_path,
            "bom_type": bom_type,
            "x_mm": x_mm,
            "y_mm": y_mm,
        },
    )
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 component through circuit breaker.

Parameters:

Name Type Description Default
file_path str

Path to the target file.

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]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/circuit_breaker.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 component through circuit breaker.

    Args:
        file_path (str): Path to the target file.
        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]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "insert_component",
        lambda: self.adapter.insert_component(file_path, x, y, z),
        input_dict={"file_path": file_path, "x": x, "y": y, "z": z},
    )
insert_model_dimensions async
insert_model_dimensions(view_name: str | None = None, include_hole_wizard: bool = True) -> AdapterResult[dict[str, Any]]

Bring model dimensions into drawing views through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def insert_model_dimensions(
    self,
    view_name: str | None = None,
    include_hole_wizard: bool = True,
) -> AdapterResult[dict[str, Any]]:
    """Bring model dimensions into drawing views through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "insert_model_dimensions",
        lambda: self.adapter.insert_model_dimensions(
            view_name, include_hole_wizard
        ),
        input_dict={
            "view_name": view_name,
            "include_hole_wizard": include_hole_wizard,
        },
    )
is_connected
is_connected() -> bool

Check connection status.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
def is_connected(self) -> bool:
    """Check connection status.

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

List materials from the configured material libraries through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def list_available_materials(
    self,
    search: str | None = None,
) -> AdapterResult[list[dict[str, str]]]:
    """List materials from the configured material libraries through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "list_available_materials",
        lambda: self.adapter.list_available_materials(search),
        input_dict={"search": search},
        error_results_are_failures=False,
    )
list_components async
list_components() -> AdapterResult[list[str]]

List components through circuit breaker.

Returns:

Type Description
AdapterResult[list[str]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def list_components(self) -> AdapterResult[list[str]]:
    """List components through circuit breaker.

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "list_components",
        lambda: self.adapter.list_components(),
        input_dict={},
    )
list_configurations async
list_configurations() -> AdapterResult[list[str]]

List model configurations through circuit breaker.

Returns:

Type Description
AdapterResult[list[str]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def list_configurations(self) -> AdapterResult[list[str]]:
    """List model configurations through circuit breaker.

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "list_configurations",
        lambda: self.adapter.list_configurations(),
        input_dict={},
    )
list_drawing_views async
list_drawing_views() -> AdapterResult[list[str]]

List drawing views through circuit breaker.

Returns:

Type Description
AdapterResult[list[str]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def list_drawing_views(self) -> AdapterResult[list[str]]:
    """List drawing views through circuit breaker.

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "list_drawing_views",
        lambda: self.adapter.list_drawing_views(),
        input_dict={},
    )
list_features async
list_features(include_suppressed: bool = False, max_assembly_depth: int = 2) -> AdapterResult[list[dict[str, object]]]

List model features through circuit breaker.

Parameters:

Name Type Description Default
include_suppressed bool

The include suppressed value. Defaults to False.

False
max_assembly_depth int

Sub-assembly recursion depth. Defaults to 2.

2

Returns:

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

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def list_features(
    self, include_suppressed: bool = False, max_assembly_depth: int = 2
) -> AdapterResult[list[dict[str, object]]]:
    """List model features through circuit breaker.

    Args:
        include_suppressed (bool): The include suppressed value. Defaults to False.
        max_assembly_depth (int): Sub-assembly recursion depth. Defaults to 2.

    Returns:
        AdapterResult[list[dict[str, object]]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "list_features",
        lambda: self.adapter.list_features(include_suppressed, max_assembly_depth),
        input_dict={
            "include_suppressed": include_suppressed,
            "max_assembly_depth": max_assembly_depth,
        },
    )
list_model_dimensions async
list_model_dimensions(feature_name: str | None = None) -> AdapterResult[list[dict[str, Any]]]

List every dimension in the active part or assembly through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def list_model_dimensions(
    self,
    feature_name: str | None = None,
) -> AdapterResult[list[dict[str, Any]]]:
    """List every dimension in the active part or assembly through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "list_model_dimensions",
        lambda: self.adapter.list_model_dimensions(feature_name),
        input_dict={"feature_name": feature_name},
        error_results_are_failures=False,
    )
list_open_documents async
list_open_documents() -> AdapterResult[list[dict[str, Any]]]

List open documents through circuit breaker.

Returns:

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

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

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

operation.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def list_open_documents(self) -> AdapterResult[list[dict[str, Any]]]:
    """List open documents through circuit breaker.

    Returns:
        AdapterResult[list[dict[str, Any]]]: The result produced by the
        operation.
    """
    return await self._execute_with_circuit_breaker(
        "list_open_documents",
        lambda: self.adapter.list_open_documents(),
        input_dict={},
    )
measure_entities async
measure_entities(entities: list[str]) -> AdapterResult[dict[str, Any]]

Measure one or two selected entities through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def measure_entities(
    self,
    entities: list[str],
) -> AdapterResult[dict[str, Any]]:
    """Measure one or two selected entities through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "measure_entities",
        lambda: self.adapter.measure_entities(entities),
        input_dict={"entities": entities},
        error_results_are_failures=False,
    )
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 through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.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 through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "mirror_feature",
        lambda: self.adapter.mirror_feature(
            features, mirror_plane, merge, mirror_bodies
        ),
        input_dict={
            "features": features,
            "mirror_plane": mirror_plane,
            "merge": merge,
            "mirror_bodies": mirror_bodies,
        },
    )
open_model async
open_model(file_path: str) -> AdapterResult[SolidWorksModel]

Open model through circuit breaker.

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/circuit_breaker.py
async def open_model(self, file_path: str) -> AdapterResult[SolidWorksModel]:
    """Open model through circuit breaker.

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "open_model",
        lambda: self.adapter.open_model(file_path),
        input_dict={"file_path": file_path},
    )
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 through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.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 through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "pattern_circular",
        lambda: self.adapter.pattern_circular(
            features, axis, count, angle, equal_spacing
        ),
        input_dict={
            "features": features,
            "axis": axis,
            "count": count,
            "angle": angle,
            "equal_spacing": equal_spacing,
        },
    )
rebuild_model async
rebuild_model(top_level_only: bool = False) -> AdapterResult[dict[str, Any]]

Force a rebuild through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def rebuild_model(
    self, top_level_only: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Force a rebuild through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "rebuild_model",
        lambda: self.adapter.rebuild_model(top_level_only),
        input_dict={"top_level_only": top_level_only},
        error_results_are_failures=False,
    )
rename_feature async
rename_feature(old_name: str, new_name: str) -> AdapterResult[dict[str, Any]]

Rename a feature through circuit breaker.

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 result produced by the operation.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def rename_feature(
    self, old_name: str, new_name: str
) -> AdapterResult[dict[str, Any]]:
    """Rename a feature through circuit breaker.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "rename_feature",
        lambda: self.adapter.rename_feature(old_name, new_name),
        input_dict={"old_name": old_name, "new_name": new_name},
    )
reset
reset(operation: str | None = None) -> list[str]

Close the breaker for one operation, or for all of them.

Parameters:

Name Type Description Default
operation str | None

The operation to reset; None resets every one.

None

Returns:

Type Description
list[str]

list[str]: The operations that were open or half-open.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
def reset(self, operation: str | None = None) -> list[str]:
    """Close the breaker for one operation, or for all of them.

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

    Returns:
        list[str]: The operations that were open or half-open.
    """
    if operation is None:
        buckets = dict(self._buckets)
    else:
        buckets = (
            {operation: self._buckets[operation]}
            if operation in self._buckets
            else {}
        )
    was_open = [
        name
        for name, bucket in buckets.items()
        if bucket.state != CircuitState.CLOSED
    ]
    for bucket in buckets.values():
        bucket.state = CircuitState.CLOSED
        bucket.failure_count = 0
        bucket.half_open_calls = 0
    if operation is None:
        self.state = CircuitState.CLOSED
        self.failure_count = 0
        self.half_open_calls = 0
    return sorted(was_open)
reset_circuit_breakers async
reset_circuit_breakers(operation: str | None = None) -> AdapterResult[dict[str, list[str]]]

Reset breakers through the adapter interface (see :meth:reset).

Parameters:

Name Type Description Default
operation str | None

The operation to reset; None resets every one.

None

Returns:

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

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def reset_circuit_breakers(
    self, operation: str | None = None
) -> AdapterResult[dict[str, list[str]]]:
    """Reset breakers through the adapter interface (see :meth:`reset`).

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

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

Save a body to a new part through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def save_body_as_part(
    self, body_name: str, file_path: str
) -> AdapterResult[dict[str, Any]]:
    """Save a body to a new part through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "save_body_as_part",
        lambda: self.adapter.save_body_as_part(body_name, file_path),
        input_dict={"body_name": body_name, "file_path": file_path},
    )
save_file async
save_file(file_path: str | None = None) -> AdapterResult[None]

Save model through circuit breaker.

Parameters:

Name Type Description Default
file_path str | None

Path to the target file. Defaults to None.

None

Returns:

Type Description
AdapterResult[None]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def save_file(self, file_path: str | None = None) -> AdapterResult[None]:
    """Save model through circuit breaker.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "save_file",
        lambda: self.adapter.save_file(file_path),
        input_dict={"file_path": file_path},
    )
select_face_edges async
select_face_edges(point: list[float] | None = None, side: str | None = None, plane: str | None = None, edge_type: str = 'all', append: bool = False) -> AdapterResult[dict[str, Any]]

Multi-select a face's edges through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def select_face_edges(
    self,
    point: list[float] | None = None,
    side: str | None = None,
    plane: str | None = None,
    edge_type: str = "all",
    append: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Multi-select a face's edges through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "select_face_edges",
        lambda: self.adapter.select_face_edges(
            point, side, plane, edge_type, append
        ),
        input_dict={
            "point": point,
            "side": side,
            "plane": plane,
            "edge_type": edge_type,
            "append": append,
        },
        error_results_are_failures=False,
    )
select_feature async
select_feature(feature_name: str, append: bool = False) -> AdapterResult[dict[str, Any]]

Select a named feature through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def select_feature(
    self, feature_name: str, append: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Select a named feature through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "select_feature",
        lambda: self.adapter.select_feature(feature_name, append),
        input_dict={"feature_name": feature_name, "append": append},
        error_results_are_failures=False,
    )
set_component_state async
set_component_state(component: str, fixed: bool | None = None, flexible: bool | None = None) -> AdapterResult[dict[str, Any]]

Set a component's state through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def set_component_state(
    self,
    component: str,
    fixed: bool | None = None,
    flexible: bool | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Set a component's state through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "set_component_state",
        lambda: self.adapter.set_component_state(component, fixed, flexible),
        input_dict={"component": component, "fixed": fixed, "flexible": flexible},
    )
set_custom_property async
set_custom_property(name: str, value: str, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Create or overwrite one custom property through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def set_custom_property(
    self,
    name: str,
    value: str,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Create or overwrite one custom property through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "set_custom_property",
        lambda: self.adapter.set_custom_property(name, value, configuration),
        input_dict={"name": name, "value": value, "configuration": configuration},
    )
set_dimension async
set_dimension(name: str, value: float) -> AdapterResult[None]

Set dimension through circuit breaker.

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/circuit_breaker.py
async def set_dimension(self, name: str, value: float) -> AdapterResult[None]:
    """Set dimension through circuit breaker.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "set_dimension",
        lambda: self.adapter.set_dimension(name, value),
        input_dict={"name": name, "value": value},
    )
set_material async
set_material(material_name: str, database: str | None = None, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Assign a material to the active part through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def set_material(
    self,
    material_name: str,
    database: str | None = None,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Assign a material to the active part through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "set_material",
        lambda: self.adapter.set_material(material_name, database, configuration),
        input_dict={
            "material_name": material_name,
            "database": database,
            "configuration": configuration,
        },
    )
set_sheet_scale async
set_sheet_scale(numerator: float, denominator: float) -> AdapterResult[dict[str, Any]]

Set the active drawing sheet's scale through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def set_sheet_scale(
    self,
    numerator: float,
    denominator: float,
) -> AdapterResult[dict[str, Any]]:
    """Set the active drawing sheet's scale through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "set_sheet_scale",
        lambda: self.adapter.set_sheet_scale(numerator, denominator),
        input_dict={"numerator": numerator, "denominator": denominator},
    )
set_units async
set_units(unit_system: str) -> AdapterResult[dict[str, Any]]

Set document units through circuit breaker.

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]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def set_units(self, unit_system: str) -> AdapterResult[dict[str, Any]]:
    """Set document units through circuit breaker.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "set_units",
        lambda: self.adapter.set_units(unit_system),
        input_dict={"unit_system": unit_system},
    )
sketch_circular_pattern async
sketch_circular_pattern(entities: list[str], angle: float, count: int) -> AdapterResult[str]

Sketch circular pattern through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def sketch_circular_pattern(
    self,
    entities: list[str],
    angle: float,
    count: int,
) -> AdapterResult[str]:
    """Sketch circular pattern through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "sketch_circular_pattern",
        lambda: self.adapter.sketch_circular_pattern(entities, angle, count),
        input_dict={"entities": entities, "angle": angle, "count": count},
    )
sketch_linear_pattern async
sketch_linear_pattern(entities: list[str], direction_x: float, direction_y: float, spacing: float, count: int) -> AdapterResult[str]

Sketch linear pattern through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def sketch_linear_pattern(
    self,
    entities: list[str],
    direction_x: float,
    direction_y: float,
    spacing: float,
    count: int,
) -> AdapterResult[str]:
    """Sketch linear pattern through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "sketch_linear_pattern",
        lambda: self.adapter.sketch_linear_pattern(
            entities, direction_x, direction_y, spacing, count
        ),
        input_dict={
            "entities": entities,
            "direction_x": direction_x,
            "direction_y": direction_y,
            "spacing": spacing,
            "count": count,
        },
    )
sketch_mirror async
sketch_mirror(entities: list[str], mirror_line: str) -> AdapterResult[str]

Sketch mirror through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def sketch_mirror(
    self, entities: list[str], mirror_line: str
) -> AdapterResult[str]:
    """Sketch mirror through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "sketch_mirror",
        lambda: self.adapter.sketch_mirror(entities, mirror_line),
        input_dict={"entities": entities, "mirror_line": mirror_line},
    )
sketch_offset async
sketch_offset(entities: list[str], offset_distance: float, reverse_direction: bool) -> AdapterResult[str]

Sketch offset through circuit breaker.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def sketch_offset(
    self,
    entities: list[str],
    offset_distance: float,
    reverse_direction: bool,
) -> AdapterResult[str]:
    """Sketch offset through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "sketch_offset",
        lambda: self.adapter.sketch_offset(
            entities, offset_distance, reverse_direction
        ),
        input_dict={
            "entities": entities,
            "offset_distance": offset_distance,
            "reverse_direction": reverse_direction,
        },
    )
soc_create_checkpoint async
soc_create_checkpoint(label: str, file_path: str, *, feature_tree: list[dict[str, Any]] | None = None) -> int | None

Create a named SoC checkpoint after saving the model.

Records a SoCCheckpoint row and a ModelStateSnapshot. Call this immediately after save_file to mark a stable rollback point.

Parameters:

Name Type Description Default
label str

Short human name (e.g. "base-extrude").

required
file_path str

Path of the .sldprt that was just saved.

required
feature_tree list | None

Optional feature list from list_features().

None

Returns:

Type Description
int | None

int | None: The new SoCCheckpoint.id, or None if soc_session_id is unset.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def soc_create_checkpoint(
    self,
    label: str,
    file_path: str,
    *,
    feature_tree: list[dict[str, Any]] | None = None,
) -> int | None:
    """Create a named SoC checkpoint after saving the model.

    Records a SoCCheckpoint row and a ModelStateSnapshot.  Call this
    immediately after ``save_file`` to mark a stable rollback point.

    Args:
        label (str): Short human name (e.g. "base-extrude").
        file_path (str): Path of the .sldprt that was just saved.
        feature_tree (list | None): Optional feature list from list_features().

    Returns:
        int | None: The new SoCCheckpoint.id, or None if soc_session_id is unset.
    """
    if not self.soc_session_id:
        return None
    try:
        from solidworks_mcp.agents.history_db import (
            create_soc_checkpoint,
            insert_model_state_snapshot,
            list_tool_call_records,
        )

        records = list_tool_call_records(
            self.soc_session_id, db_path=self.soc_db_path
        )
        last_id = records[-1]["id"] if records else None

        snapshot_id: int | None = None
        if feature_tree is not None:
            import json as _json

            insert_model_state_snapshot(
                session_id=self.soc_session_id,
                model_path=file_path,
                feature_tree_json=_json.dumps(feature_tree, default=str),
                db_path=self.soc_db_path,
            )
            from solidworks_mcp.agents.history_db import list_model_state_snapshots

            snaps = list_model_state_snapshots(
                self.soc_session_id, db_path=self.soc_db_path
            )
            if snaps:
                snapshot_id = snaps[0]["id"]

        return create_soc_checkpoint(
            session_id=self.soc_session_id,
            label=label,
            file_path=file_path,
            last_record_id=last_id,
            snapshot_id=snapshot_id,
            db_path=self.soc_db_path,
        )
    except Exception as exc:
        logger.debug(
            f"[soc_checkpoint] failed to create checkpoint {label!r}: {exc}"
        )
        return None
suppress_feature async
suppress_feature(name: str, suppress: bool = True) -> AdapterResult[dict[str, Any]]

Suppress or unsuppress a feature through circuit breaker.

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 result produced by the operation.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def suppress_feature(
    self, name: str, suppress: bool = True
) -> AdapterResult[dict[str, Any]]:
    """Suppress or unsuppress a feature through circuit breaker.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "suppress_feature",
        lambda: self.adapter.suppress_feature(name, suppress),
        input_dict={"name": name, "suppress": suppress},
    )
undo async
undo(count: int = 1) -> AdapterResult[dict[str, Any]]

Undo through circuit breaker.

Parameters:

Name Type Description Default
count int

Number of steps to undo.

1

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
async def undo(self, count: int = 1) -> AdapterResult[dict[str, Any]]:
    """Undo through circuit breaker.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_circuit_breaker(
        "undo",
        lambda: self.adapter.undo(count),
        input_dict={"count": count},
    )

ComplexityAnalyzer

ComplexityAnalyzer(parameter_threshold: int = 12, score_threshold: float = 0.6)

Analyze operation complexity and recommend COM or VBA execution path.

Parameters:

Name Type Description Default
parameter_threshold int

The parameter threshold value. Defaults to 12.

12
score_threshold float

The score threshold value. Defaults to 0.6.

0.6

Attributes:

Name Type Description
_parameter_threshold Any

The parameter threshold value.

_score_threshold Any

The score threshold value.

Initialize analyzer state.

Parameters:

Name Type Description Default
parameter_threshold int

The parameter threshold value. Defaults to 12.

12
score_threshold float

The score threshold value. Defaults to 0.6.

0.6

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
def __init__(
    self,
    parameter_threshold: int = 12,
    score_threshold: float = 0.6,
) -> None:
    """Initialize analyzer state.

    Args:
        parameter_threshold (int): The parameter threshold value. Defaults to 12.
        score_threshold (float): The score threshold value. Defaults to 0.6.

    Returns:
        None: None.
    """
    self._parameter_threshold = max(parameter_threshold, 1)
    self._score_threshold = max(min(score_threshold, 1.0), 0.1)
    self._profiles: dict[str, OperationProfile] = self._default_profiles()
    self._history: dict[str, dict[str, int]] = {}
Methods:
analyze
analyze(operation: str, payload: object) -> RoutingDecision

Produce a routing recommendation for an operation call.

Parameters:

Name Type Description Default
operation str

Callable object executed by the helper.

required
payload object

The payload value.

required

Returns:

Name Type Description
RoutingDecision RoutingDecision

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
def analyze(self, operation: str, payload: object) -> RoutingDecision:
    """Produce a routing recommendation for an operation call.

    Args:
        operation (str): Callable object executed by the helper.
        payload (object): The payload value.

    Returns:
        RoutingDecision: The result produced by the operation.
    """
    profile = self._profiles.get(
        operation,
        OperationProfile(name=operation, base_complexity=0.2, vba_preferred=False),
    )
    parameter_count = self._count_parameters(payload)

    parameter_component = min(
        parameter_count / float(self._parameter_threshold), 1.0
    )
    history_component = self._history_bias(operation)
    complexity_score = min(
        1.0,
        (parameter_component * 0.45)
        + (profile.base_complexity * 0.40)
        + (history_component * 0.15),
    )

    prefer_vba = (
        parameter_count > self._parameter_threshold
        or profile.vba_preferred
        or complexity_score >= self._score_threshold
    )

    reason = (
        "parameter threshold exceeded"
        if parameter_count > self._parameter_threshold
        else "profile prefers VBA"
        if profile.vba_preferred
        else "complexity score exceeded threshold"
        if complexity_score >= self._score_threshold
        else "COM path preferred"
    )

    return RoutingDecision(
        operation=operation,
        parameter_count=parameter_count,
        complexity_score=complexity_score,
        prefer_vba=prefer_vba,
        reason=reason,
    )
record_result
record_result(operation: str, route: str, success: bool) -> None

Record operation outcome for future routing influence.

Parameters:

Name Type Description Default
operation str

Callable object executed by the helper.

required
route str

The route value.

required
success bool

The success value.

required

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/complexity_analyzer.py
def record_result(self, operation: str, route: str, success: bool) -> None:
    """Record operation outcome for future routing influence.

    Args:
        operation (str): Callable object executed by the helper.
        route (str): The route value.
        success (bool): The success value.

    Returns:
        None: None.
    """
    history = self._history.setdefault(
        operation,
        {
            "com_success": 0,
            "com_failure": 0,
            "vba_success": 0,
            "vba_failure": 0,
        },
    )
    key = f"{route}_{'success' if success else 'failure'}"
    if key in history:
        history[key] += 1

ConnectionPoolAdapter

ConnectionPoolAdapter(adapter_factory: Callable[[], SolidWorksAdapter] | None = None, pool_size: int = 3, max_retries: int = 3, create_connection: Callable[[], SolidWorksAdapter] | None = None, max_size: int | None = None, timeout: float | None = None, config: dict[str, object] | None = None)

Bases: SolidWorksAdapter

Connection pool wrapper for SolidWorks adapters.

Parameters:

Name Type Description Default
adapter_factory Callable[[], SolidWorksAdapter] | None

Factory callable used to create adapter instances. Defaults to None.

None
pool_size int

Number of adapters to maintain in the pool. Defaults to 3.

3
max_retries int

Maximum number of retry attempts. Defaults to 3.

3
create_connection Callable[[], SolidWorksAdapter] | None

Factory callable used to create a connection. Defaults to None.

None
max_size int | None

Maximum number of items allowed in the pool. Defaults to None.

None
timeout float | None

Maximum time to wait in seconds. Defaults to None.

None
config dict[str, object] | None

Configuration values for the operation. Defaults to None.

None

Attributes:

Name Type Description
_lock Any

The lock value.

adapter_factory Any

The adapter factory value.

max_retries Any

The max retries value.

pool_initialized Any

The pool initialized value.

pool_size Any

The pool size value.

timeout Any

The timeout value.

Initialize the connection pool adapter.

Parameters:

Name Type Description Default
adapter_factory Callable[[], SolidWorksAdapter] | None

Factory callable used to create adapter instances. Defaults to None.

None
pool_size int

Number of adapters to maintain in the pool. Defaults to 3.

3
max_retries int

Maximum number of retry attempts. Defaults to 3.

3
create_connection Callable[[], SolidWorksAdapter] | None

Factory callable used to create a connection. Defaults to None.

None
max_size int | None

Maximum number of items allowed in the pool. Defaults to None.

None
timeout float | None

Maximum time to wait in seconds. Defaults to None.

None
config dict[str, object] | None

Configuration values for the operation. Defaults to None.

None

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/connection_pool.py
def __init__(
    self,
    adapter_factory: Callable[[], SolidWorksAdapter] | None = None,
    pool_size: int = 3,
    max_retries: int = 3,
    create_connection: Callable[[], SolidWorksAdapter] | None = None,
    max_size: int | None = None,
    timeout: float | None = None,
    config: dict[str, object] | None = None,
) -> None:
    """Initialize the connection pool adapter.

    Args:
        adapter_factory (Callable[[], SolidWorksAdapter] | None): Factory callable used to
                                                                  create adapter instances.
                                                                  Defaults to None.
        pool_size (int): Number of adapters to maintain in the pool. Defaults to 3.
        max_retries (int): Maximum number of retry attempts. Defaults to 3.
        create_connection (Callable[[], SolidWorksAdapter] | None): Factory callable used to
                                                                    create a connection.
                                                                    Defaults to None.
        max_size (int | None): Maximum number of items allowed in the pool. Defaults to
                               None.
        timeout (float | None): Maximum time to wait in seconds. Defaults to None.
        config (dict[str, object] | None): Configuration values for the operation. Defaults
                                           to None.

    Returns:
        None: None.
    """
    if adapter_factory is None and create_connection is not None:
        adapter_factory = create_connection
    if max_size is not None:
        pool_size = max_size
    if adapter_factory is None:
        from .mock_adapter import MockSolidWorksAdapter

        def adapter_factory() -> MockSolidWorksAdapter:
            """Provide adapter factory support for the connection pool adapter.

            Returns:
                MockSolidWorksAdapter: The result produced by the operation.
            """

            return MockSolidWorksAdapter(config or {})

    super().__init__(config)
    self.adapter_factory = adapter_factory
    self.pool_size = pool_size
    self.max_retries = max_retries

    self.pool: list[SolidWorksAdapter] = []
    self.available_adapters: asyncio.Queue[SolidWorksAdapter] = asyncio.Queue()
    self.pool_initialized = False
    self._lock = asyncio.Lock()
    self.timeout = timeout if timeout is not None else 30.0
Attributes
active_connections property
active_connections: int

Provide active connections support for the connection pool adapter.

Returns:

Name Type Description
int int

The computed numeric result.

size property
size: int

Provide size support for the connection pool adapter.

Returns:

Name Type Description
int int

The computed numeric result.

Methods:
acquire async
acquire() -> SolidWorksAdapter

Provide acquire support for the connection pool adapter.

Returns:

Name Type Description
SolidWorksAdapter SolidWorksAdapter

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def acquire(self) -> SolidWorksAdapter:
    """Provide acquire support for the connection pool adapter.

    Returns:
        SolidWorksAdapter: The result produced by the operation.
    """
    return await self._get_adapter(timeout=self.timeout)
activate_document async
activate_document(title_or_path: str) -> AdapterResult[dict[str, Any]]

Activate an open document using pool.

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]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def activate_document(
    self, title_or_path: str
) -> AdapterResult[dict[str, Any]]:
    """Activate an open document using pool.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "activate_document",
        lambda adapter: adapter.activate_document(title_or_path),
    )
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 arc using pool.

Parameters:

Name Type Description Default
center_x float

Arc center X coordinate.

required
center_y float

Arc center Y coordinate.

required
start_x float

Arc start X coordinate.

required
start_y float

Arc start Y coordinate.

required
end_x float

Arc end X coordinate.

required
end_y float

Arc end Y coordinate.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/connection_pool.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 arc using pool.

    Args:
        center_x (float): Arc center X coordinate.
        center_y (float): Arc center Y coordinate.
        start_x (float): Arc start X coordinate.
        start_y (float): Arc start Y coordinate.
        end_x (float): Arc end X coordinate.
        end_y (float): Arc end Y coordinate.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "add_arc",
        lambda adapter: adapter.add_arc(
            center_x,
            center_y,
            start_x,
            start_y,
            end_x,
            end_y,
        ),
    )
add_centerline async
add_centerline(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add centerline using pool.

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/connection_pool.py
async def add_centerline(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add centerline using pool.

    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 await self._execute_with_pool(
        "add_centerline",
        lambda adapter: adapter.add_centerline(x1, y1, x2, y2),
    )
add_chamfer async
add_chamfer(distance: float, edge_names: list[str], angle: float = 45.0, flip: bool = False) -> AdapterResult[SolidWorksFeature]

Add chamfer using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_chamfer(
    self,
    distance: float,
    edge_names: list[str],
    angle: float = 45.0,
    flip: bool = False,
) -> AdapterResult[SolidWorksFeature]:
    """Add chamfer using pool."""
    return await self._execute_with_pool(
        "add_chamfer",
        lambda adapter: adapter.add_chamfer(distance, edge_names, angle, flip),
    )
add_circle async
add_circle(center_x: float, center_y: float, radius: float) -> AdapterResult[str]

Add circle using pool.

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/connection_pool.py
async def add_circle(
    self, center_x: float, center_y: float, radius: float
) -> AdapterResult[str]:
    """Add circle using pool.

    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.
    """
    return await self._execute_with_pool(
        "add_circle", lambda adapter: adapter.add_circle(center_x, center_y, radius)
    )
add_datum_tag async
add_datum_tag(label: str, attach_at_mm: tuple[float, float], x_mm: float, y_mm: float) -> AdapterResult[dict[str, Any]]

Add a datum feature symbol using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_datum_tag(
    self,
    label: str,
    attach_at_mm: tuple[float, float],
    x_mm: float,
    y_mm: float,
) -> AdapterResult[dict[str, Any]]:
    """Add a datum feature symbol using pool."""
    return await self._execute_with_pool(
        "add_datum_tag",
        lambda adapter: adapter.add_datum_tag(label, attach_at_mm, x_mm, y_mm),
    )
add_drawing_view async
add_drawing_view(payload: Any = None) -> AdapterResult[dict[str, Any]]

Add a drawing view using pool.

Parameters:

Name Type Description Default
payload Any

Tool payload for the drawing view.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_drawing_view(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Add a drawing view using pool.

    Args:
        payload (Any): Tool payload for the drawing view.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "add_drawing_view", lambda adapter: adapter.add_drawing_view(payload)
    )
add_ellipse async
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float) -> AdapterResult[str]

Add ellipse using pool.

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/connection_pool.py
async def add_ellipse(
    self,
    center_x: float,
    center_y: float,
    major_axis: float,
    minor_axis: float,
) -> AdapterResult[str]:
    """Add ellipse using pool.

    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 await self._execute_with_pool(
        "add_ellipse",
        lambda adapter: adapter.add_ellipse(
            center_x, center_y, major_axis, minor_axis
        ),
    )
add_fillet async
add_fillet(radius: float, edge_names: list[str]) -> AdapterResult[SolidWorksFeature]

Add fillet using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_fillet(
    self, radius: float, edge_names: list[str]
) -> AdapterResult[SolidWorksFeature]:
    """Add fillet using pool."""
    return await self._execute_with_pool(
        "add_fillet", lambda adapter: adapter.add_fillet(radius, edge_names)
    )
add_gtol async
add_gtol(characteristic: str, tolerance: float, x_mm: float, y_mm: float, diameter_zone: bool = False, material_condition: str = 'none', datums: list[str] | None = None, attach_at_mm: tuple[float, float] | None = None, dimension: tuple[str, str] | None = None) -> AdapterResult[dict[str, Any]]

Add a GD&T feature control frame using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_gtol(
    self,
    characteristic: str,
    tolerance: float,
    x_mm: float,
    y_mm: float,
    diameter_zone: bool = False,
    material_condition: str = "none",
    datums: list[str] | None = None,
    attach_at_mm: tuple[float, float] | None = None,
    dimension: tuple[str, str] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add a GD&T feature control frame using pool."""
    return await self._execute_with_pool(
        "add_gtol",
        lambda adapter: adapter.add_gtol(
            characteristic,
            tolerance,
            x_mm,
            y_mm,
            diameter_zone,
            material_condition,
            datums,
            attach_at_mm,
            dimension,
        ),
    )
add_line async
add_line(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add line using pool.

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/connection_pool.py
async def add_line(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add line using pool.

    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 await self._execute_with_pool(
        "add_line", lambda adapter: adapter.add_line(x1, y1, x2, y2)
    )
add_mate async
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0, face_a: list[float] | None = None, face_b: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Add mate using pool.

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. Defaults to "coincident".

'coincident'
alignment str

Mate alignment. Defaults to "aligned".

'aligned'
distance float

Distance in millimetres. Defaults to 0.0.

0.0
angle float

Angle in degrees. Defaults to 0.0.

0.0
face_a list[float] | None

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

None
face_b list[float] | None

The same for the second component.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_mate(
    self,
    component_a: str,
    component_b: str,
    entity_a: str = "Front Plane",
    entity_b: str = "Front Plane",
    mate_type: str = "coincident",
    alignment: str = "aligned",
    distance: float = 0.0,
    angle: float = 0.0,
    face_a: list[float] | None = None,
    face_b: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Add mate using pool.

    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. Defaults to "coincident".
        alignment (str): Mate alignment. Defaults to "aligned".
        distance (float): Distance in millimetres. Defaults to 0.0.
        angle (float): Angle in degrees. Defaults to 0.0.
        face_a (list[float] | None): A point on a face of the first
            component, in its part coordinates (mm), instead of entity_a.
        face_b (list[float] | None): The same for the second component.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "add_mate",
        lambda adapter: adapter.add_mate(
            component_a,
            component_b,
            entity_a,
            entity_b,
            mate_type,
            alignment,
            distance,
            angle,
            face_a,
            face_b,
        ),
    )
add_note async
add_note(payload: Any = None) -> AdapterResult[dict[str, Any]]

Add a drawing note using pool.

Parameters:

Name Type Description Default
payload Any

Tool payload for the note.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_note(self, payload: Any = None) -> AdapterResult[dict[str, Any]]:
    """Add a drawing note using pool.

    Args:
        payload (Any): Tool payload for the note.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "add_note", lambda adapter: adapter.add_note(payload)
    )
add_polygon async
add_polygon(center_x: float, center_y: float, radius: float, sides: int) -> AdapterResult[str]

Add polygon using pool.

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/connection_pool.py
async def add_polygon(
    self, center_x: float, center_y: float, radius: float, sides: int
) -> AdapterResult[str]:
    """Add polygon using pool.

    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 await self._execute_with_pool(
        "add_polygon",
        lambda adapter: adapter.add_polygon(center_x, center_y, radius, sides),
    )
add_rectangle async
add_rectangle(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add rectangle using pool.

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/connection_pool.py
async def add_rectangle(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add rectangle using pool.

    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 await self._execute_with_pool(
        "add_rectangle", lambda adapter: adapter.add_rectangle(x1, y1, x2, y2)
    )
add_sketch_constraint async
add_sketch_constraint(entity1: str, entity2: str | None, relation_type: str, entity3: str | None = None) -> AdapterResult[str]

Add sketch constraint using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_sketch_constraint(
    self,
    entity1: str,
    entity2: str | None,
    relation_type: str,
    entity3: str | None = None,
) -> AdapterResult[str]:
    """Add sketch constraint using pool."""
    return await self._execute_with_pool(
        "add_sketch_constraint",
        lambda adapter: adapter.add_sketch_constraint(
            entity1,
            entity2,
            relation_type,
            entity3,
        ),
    )
add_sketch_dimension async
add_sketch_dimension(entity1: str, entity2: str | None, dimension_type: str, value: float) -> AdapterResult[str]

Add sketch dimension using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_sketch_dimension(
    self,
    entity1: str,
    entity2: str | None,
    dimension_type: str,
    value: float,
) -> AdapterResult[str]:
    """Add sketch dimension using pool."""
    return await self._execute_with_pool(
        "add_sketch_dimension",
        lambda adapter: adapter.add_sketch_dimension(
            entity1,
            entity2,
            dimension_type,
            value,
        ),
    )
add_spline async
add_spline(points: list[dict[str, float]]) -> AdapterResult[str]

Add spline using pool.

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/connection_pool.py
async def add_spline(self, points: list[dict[str, float]]) -> AdapterResult[str]:
    """Add spline using pool.

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "add_spline", lambda adapter: adapter.add_spline(points)
    )
arrange_dimensions async
arrange_dimensions(view_name: str | None = None) -> AdapterResult[dict[str, Any]]

Move drawing dimensions so none overlaps, then verify using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def arrange_dimensions(
    self,
    view_name: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Move drawing dimensions so none overlaps, then verify using pool."""
    return await self._execute_with_pool(
        "arrange_dimensions",
        lambda adapter: adapter.arrange_dimensions(view_name),
    )
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 drawing centre marks using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.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 drawing centre marks using pool."""
    return await self._execute_with_pool(
        "auto_center_marks",
        lambda adapter: adapter.auto_center_marks(
            view_name, mark_holes, mark_fillets, mark_slots
        ),
    )
check_interference async
check_interference(params: Any = None) -> AdapterResult[dict[str, Any]]

Check interference using pool.

Parameters:

Name Type Description Default
params Any

Optional interference-detection settings.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def check_interference(
    self, params: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Check interference using pool.

    Args:
        params (Any): Optional interference-detection settings.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "check_interference", lambda adapter: adapter.check_interference(params)
    )
check_sketch_fully_defined async
check_sketch_fully_defined(sketch_name: str | None = None) -> AdapterResult[dict[str, Any]]

Check sketch definition status using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def check_sketch_fully_defined(
    self, sketch_name: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Check sketch definition status using pool."""
    return await self._execute_with_pool(
        "check_sketch_fully_defined",
        lambda adapter: adapter.check_sketch_fully_defined(sketch_name),
    )
cleanup async
cleanup() -> None

Provide cleanup support for the connection pool adapter.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def cleanup(self) -> None:
    """Provide cleanup support for the connection pool adapter.

    Returns:
        None: None.
    """
    await self.disconnect()
close_model async
close_model(save: bool = False) -> AdapterResult[None]

Close model using pool.

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/connection_pool.py
async def close_model(self, save: bool = False) -> AdapterResult[None]:
    """Close model using pool.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "close_model", lambda adapter: adapter.close_model(save)
    )
connect async
connect() -> None

Initialize the connection pool.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def connect(self) -> None:
    """Initialize the connection pool.

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

Create assembly using pool.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_assembly(
    self, name: str | None = None, template: str | None = None
) -> AdapterResult[SolidWorksModel]:
    """Create assembly using pool.

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

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

    async def _op(adapter: SolidWorksAdapter) -> AdapterResult[SolidWorksModel]:
        """Build internal op.

        Args:
            adapter (SolidWorksAdapter): Adapter instance used for the operation.

        Returns:
            AdapterResult[SolidWorksModel]: The result produced by the operation.
        """
        if template is not None:
            return await adapter.create_assembly(name, template)
        if name is None:
            return await adapter.create_assembly()
        result = await self._invoke_with_optional_args(
            adapter, "create_assembly", name
        )
        return cast(AdapterResult[SolidWorksModel], result)

    return await self._execute_with_pool("create_assembly", _op)
create_axis async
create_axis(reference: str) -> AdapterResult[dict[str, Any]]

Create reference axis using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_axis(self, reference: str) -> AdapterResult[dict[str, Any]]:
    """Create reference axis using pool."""
    return await self._execute_with_pool(
        "create_axis", lambda adapter: adapter.create_axis(reference)
    )
create_cut_extrude async
create_cut_extrude(params: ExtrusionParameters) -> AdapterResult[SolidWorksFeature]

Create cut-extrude using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_cut_extrude(
    self, params: ExtrusionParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create cut-extrude using pool."""
    return await self._execute_with_pool(
        "create_cut_extrude", lambda adapter: adapter.create_cut_extrude(params)
    )
create_drawing async
create_drawing(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create drawing using pool.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_drawing(
    self, name: str | None = None, template: str | None = None
) -> AdapterResult[SolidWorksModel]:
    """Create drawing using pool.

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "create_drawing", lambda adapter: adapter.create_drawing(name, template)
    )
create_drawing_view async
create_drawing_view(payload: Any = None) -> AdapterResult[dict[str, Any]]

Create a drawing view using pool.

Parameters:

Name Type Description Default
payload Any

Tool payload for the drawing view.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_drawing_view(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Create a drawing view using pool.

    Args:
        payload (Any): Tool payload for the drawing view.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "create_drawing_view", lambda adapter: adapter.create_drawing_view(payload)
    )
create_extrusion async
create_extrusion(params: ExtrusionParameters) -> AdapterResult[SolidWorksFeature]

Create extrusion using pool.

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/connection_pool.py
async def create_extrusion(
    self, params: ExtrusionParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create extrusion using pool.

    Args:
        params (ExtrusionParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "create_extrusion", lambda adapter: adapter.create_extrusion(params)
    )
create_loft async
create_loft(params: LoftParameters) -> AdapterResult[SolidWorksFeature]

Create loft using pool.

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/connection_pool.py
async def create_loft(
    self, params: LoftParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create loft using pool.

    Args:
        params (LoftParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "create_loft", lambda adapter: adapter.create_loft(params)
    )
create_part async
create_part(name: str | None = None, units: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create part using pool.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
units str | None

The units value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_part(
    self,
    name: str | None = None,
    units: str | None = None,
    template: str | None = None,
) -> AdapterResult[SolidWorksModel]:
    """Create part using pool.

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

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

    async def _op(adapter: SolidWorksAdapter) -> AdapterResult[SolidWorksModel]:
        """Build internal op.

        Args:
            adapter (SolidWorksAdapter): Adapter instance used for the operation.

        Returns:
            AdapterResult[SolidWorksModel]: The result produced by the operation.
        """
        if template is not None:
            # No zero-arg retry: dropping the template would silently
            # build the document from a different one.
            return await adapter.create_part(name, units, template)
        if name is None and units is None:
            return await adapter.create_part()
        result = await self._invoke_with_optional_args(
            adapter, "create_part", name, units
        )
        return cast(AdapterResult[SolidWorksModel], result)

    return await self._execute_with_pool("create_part", _op)
create_reference_plane async
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False, axis: str | None = None, face_point: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Create reference plane using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_reference_plane(
    self,
    reference: str,
    offset: float = 0.0,
    angle: float = 0.0,
    flip: bool = False,
    axis: str | None = None,
    face_point: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Create reference plane using pool."""
    return await self._execute_with_pool(
        "create_reference_plane",
        lambda adapter: adapter.create_reference_plane(
            reference, offset, angle, flip, axis, face_point
        ),
    )
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 using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.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 using pool."""
    return await self._execute_with_pool(
        "create_reference_point",
        lambda adapter: adapter.create_reference_point(
            mode, x, y, z, distance, percent
        ),
    )
create_revolve async
create_revolve(params: RevolveParameters) -> AdapterResult[SolidWorksFeature]

Create revolve using pool.

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/connection_pool.py
async def create_revolve(
    self, params: RevolveParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create revolve using pool.

    Args:
        params (RevolveParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "create_revolve", lambda adapter: adapter.create_revolve(params)
    )
create_sketch async
create_sketch(plane: str) -> AdapterResult[str]

Create sketch using pool.

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/connection_pool.py
async def create_sketch(self, plane: str) -> AdapterResult[str]:
    """Create sketch using pool.

    Args:
        plane (str): The plane value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "create_sketch", lambda adapter: adapter.create_sketch(plane)
    )
create_standard_drawing async
create_standard_drawing(model_path: str, output_dir: str | None = None, title: str | None = None, subtitle: str | None = None, drawing_number: str | None = None, author: str = '', revision: str = 'A', company: str = '', drawn_date: str | None = None, notes: list[str] | None = None, include_isometric: bool = True, write_model_properties: bool = True, title_block_text_height_mm: float | None = None, include_bom: bool = False) -> AdapterResult[dict[str, Any]]

Create a complete standard A3 drawing using pool.

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

Create sweep using pool.

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/connection_pool.py
async def create_sweep(
    self, params: SweepParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create sweep using pool.

    Args:
        params (SweepParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "create_sweep", lambda adapter: adapter.create_sweep(params)
    )
create_technical_drawing async
create_technical_drawing(payload: Any = None) -> AdapterResult[dict[str, Any]]

Create standard views using pool.

Parameters:

Name Type Description Default
payload Any

Tool payload for the technical drawing.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_technical_drawing(
    self, payload: Any = None
) -> AdapterResult[dict[str, Any]]:
    """Create standard views using pool.

    Args:
        payload (Any): Tool payload for the technical drawing.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "create_technical_drawing",
        lambda adapter: adapter.create_technical_drawing(payload),
    )
delete_feature async
delete_feature(name: str) -> AdapterResult[dict[str, Any]]

Delete a feature using pool.

Parameters:

Name Type Description Default
name str

Feature or sketch name.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def delete_feature(self, name: str) -> AdapterResult[dict[str, Any]]:
    """Delete a feature using pool.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "delete_feature", lambda adapter: adapter.delete_feature(name)
    )
disconnect async
disconnect() -> None

Disconnect all adapters in the pool.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def disconnect(self) -> None:
    """Disconnect all adapters in the pool.

    Returns:
        None: None.
    """
    for adapter in self.pool:
        from .base import SolidWorksAdapter

        typed_adapter: SolidWorksAdapter = adapter
        _, error = await self._attempt_async_with_error(
            lambda a=typed_adapter: a.disconnect()  # type: ignore[misc]
        )
        if error is not None:
            logger.warning(f"Error disconnecting adapter: {error}")

    self.pool.clear()

    # Clear the queue
    while not self.available_adapters.empty():
        try:
            self.available_adapters.get_nowait()
        except asyncio.QueueEmpty:
            break

    self.pool_initialized = False
execute_macro async
execute_macro(params: dict[str, Any]) -> AdapterResult[dict[str, Any]]

Provide execute macro support for the connection pool adapter.

Parameters:

Name Type Description Default
params dict[str, Any]

The params value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def execute_macro(
    self, params: dict[str, Any]
) -> AdapterResult[dict[str, Any]]:
    """Provide execute macro support for the connection pool adapter.

    Args:
        params (dict[str, Any]): The params value.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "execute_macro",
        lambda adapter: adapter.execute_macro(params),  # type: ignore[attr-defined]
    )
exit_sketch async
exit_sketch() -> AdapterResult[None]

Exit sketch using pool.

Returns:

Type Description
AdapterResult[None]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def exit_sketch(self) -> AdapterResult[None]:
    """Exit sketch using pool.

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "exit_sketch", lambda adapter: adapter.exit_sketch()
    )
export_file async
export_file(file_path: str, format_type: str) -> AdapterResult[None]

Export file using pool.

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/connection_pool.py
async def export_file(
    self, file_path: str, format_type: str
) -> AdapterResult[None]:
    """Export file using pool.

    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.
    """
    return await self._execute_with_pool(
        "export_file", lambda adapter: adapter.export_file(file_path, format_type)
    )
export_flat_pattern async
export_flat_pattern(file_path: str) -> AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def export_flat_pattern(
    self,
    file_path: str,
) -> AdapterResult[dict[str, Any]]:
    """Export the active sheet-metal part's flat pattern using pool."""
    return await self._execute_with_pool(
        "export_flat_pattern",
        lambda adapter: adapter.export_flat_pattern(file_path),
    )
export_image async
export_image(payload: dict) -> AdapterResult[dict]

Export viewport image using pool.

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/connection_pool.py
async def export_image(self, payload: dict) -> AdapterResult[dict]:
    """Export viewport image using pool.

    Args:
        payload (dict): The payload value.

    Returns:
        AdapterResult[dict]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "export_image", lambda adapter: adapter.export_image(payload)
    )
get_application_info async
get_application_info() -> AdapterResult[dict[str, Any]]

Describe the connected SolidWorks using pool.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "get_application_info",
        lambda adapter: adapter.get_application_info(),
    )
get_custom_properties async
get_custom_properties(configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Read the custom properties of the active document using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def get_custom_properties(
    self,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Read the custom properties of the active document using pool."""
    return await self._execute_with_pool(
        "get_custom_properties",
        lambda adapter: adapter.get_custom_properties(configuration),
    )
get_dimension async
get_dimension(name: str) -> AdapterResult[dict[str, Any]]

Get dimension using pool.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def get_dimension(self, name: str) -> AdapterResult[dict[str, Any]]:
    """Get dimension using pool.

    Args:
        name (str): The name value.

    Returns:
        AdapterResult[dict[str, Any]]: ``value`` and ``units`` (mm, deg or None).
    """
    return await self._execute_with_pool(
        "get_dimension", lambda adapter: adapter.get_dimension(name)
    )
get_mass_properties async
get_mass_properties() -> AdapterResult[MassProperties]

Get mass properties using pool.

Returns:

Type Description
AdapterResult[MassProperties]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def get_mass_properties(self) -> AdapterResult[MassProperties]:
    """Get mass properties using pool.

    Returns:
        AdapterResult[MassProperties]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "get_mass_properties", lambda adapter: adapter.get_mass_properties()
    )
get_material async
get_material(configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Read the material assigned to the active part using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def get_material(
    self,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Read the material assigned to the active part using pool."""
    return await self._execute_with_pool(
        "get_material",
        lambda adapter: adapter.get_material(configuration),
    )
get_model_geometry_summary async
get_model_geometry_summary() -> AdapterResult[dict[str, Any]]

Summarise the active document using pool.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def get_model_geometry_summary(self) -> AdapterResult[dict[str, Any]]:
    """Summarise the active document using pool.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "get_model_geometry_summary",
        lambda adapter: adapter.get_model_geometry_summary(),
    )
get_model_info async
get_model_info() -> AdapterResult[dict[str, object]]

Get active model metadata using pool.

Returns:

Type Description
AdapterResult[dict[str, object]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def get_model_info(self) -> AdapterResult[dict[str, object]]:
    """Get active model metadata using pool.

    Returns:
        AdapterResult[dict[str, object]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "get_model_info", lambda adapter: adapter.get_model_info()
    )
get_selected_entities async
get_selected_entities() -> AdapterResult[list[dict[str, Any]]]

Report the current UI selection using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def get_selected_entities(self) -> AdapterResult[list[dict[str, Any]]]:
    """Report the current UI selection using pool."""
    return await self._execute_with_pool(
        "get_selected_entities", lambda adapter: adapter.get_selected_entities()
    )
health_check async
health_check() -> AdapterHealth

Get health status of the connection pool.

Returns:

Name Type Description
AdapterHealth AdapterHealth

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def health_check(self) -> AdapterHealth:
    """Get health status of the connection pool.

    Returns:
        AdapterHealth: The result produced by the operation.
    """
    healthy_count = 0
    total_response_time = 0

    if not self.pool_initialized:
        return AdapterHealth(
            healthy=False,
            last_check=datetime.now(),
            error_count=0,
            success_count=0,
            average_response_time=0,
            connection_status="pool_not_initialized",
            metrics={
                "pool_size": 0,
                "available_adapters": 0,
                "healthy_adapters": 0,
            },
        )

    # Check health of all adapters
    for adapter in self.pool:
        from .base import SolidWorksAdapter

        typed_adapter: SolidWorksAdapter = adapter
        health = await self._attempt_async(lambda a=typed_adapter: a.health_check())  # type: ignore[misc]
        if not health:
            continue
        if health.healthy:
            healthy_count += 1
        total_response_time += health.average_response_time

    avg_response_time = total_response_time / len(self.pool) if self.pool else 0

    return AdapterHealth(
        healthy=healthy_count > 0,
        last_check=datetime.now(),
        error_count=len(self.pool) - healthy_count,
        success_count=healthy_count,
        average_response_time=avg_response_time,
        connection_status="pooled",
        metrics={
            "pool_size": len(self.pool),
            "available_adapters": self.available_adapters.qsize(),
            "healthy_adapters": healthy_count,
        },
    )
insert_bom_table async
insert_bom_table(view_name: str, template_path: str | None = None, bom_type: str = 'top_level_only', x_mm: float | None = None, y_mm: float | None = None) -> AdapterResult[dict[str, Any]]

Insert a BOM table anchored to an assembly drawing view using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def insert_bom_table(
    self,
    view_name: str,
    template_path: str | None = None,
    bom_type: str = "top_level_only",
    x_mm: float | None = None,
    y_mm: float | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Insert a BOM table anchored to an assembly drawing view using pool."""
    return await self._execute_with_pool(
        "insert_bom_table",
        lambda adapter: adapter.insert_bom_table(
            view_name, template_path, bom_type, x_mm, y_mm
        ),
    )
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 component using pool.

Parameters:

Name Type Description Default
file_path str

Path to the target file.

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]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/connection_pool.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 component using pool.

    Args:
        file_path (str): Path to the target file.
        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]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "insert_component",
        lambda adapter: adapter.insert_component(file_path, x, y, z),
    )
insert_model_dimensions async
insert_model_dimensions(view_name: str | None = None, include_hole_wizard: bool = True) -> AdapterResult[dict[str, Any]]

Bring model dimensions into drawing views using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def insert_model_dimensions(
    self,
    view_name: str | None = None,
    include_hole_wizard: bool = True,
) -> AdapterResult[dict[str, Any]]:
    """Bring model dimensions into drawing views using pool."""
    return await self._execute_with_pool(
        "insert_model_dimensions",
        lambda adapter: adapter.insert_model_dimensions(
            view_name, include_hole_wizard
        ),
    )
is_connected
is_connected() -> bool

Check if pool is initialized.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

Source code in src/solidworks_mcp/adapters/connection_pool.py
def is_connected(self) -> bool:
    """Check if pool is initialized.

    Returns:
        bool: True if connected, otherwise False.
    """
    return self.pool_initialized and len(self.pool) > 0
list_available_materials async
list_available_materials(search: str | None = None) -> AdapterResult[list[dict[str, str]]]

List materials from the configured material libraries using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def list_available_materials(
    self,
    search: str | None = None,
) -> AdapterResult[list[dict[str, str]]]:
    """List materials from the configured material libraries using pool."""
    return await self._execute_with_pool(
        "list_available_materials",
        lambda adapter: adapter.list_available_materials(search),
    )
list_components async
list_components() -> AdapterResult[list[str]]

List components using pool.

Returns:

Type Description
AdapterResult[list[str]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def list_components(self) -> AdapterResult[list[str]]:
    """List components using pool.

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "list_components", lambda adapter: adapter.list_components()
    )
list_configurations async
list_configurations() -> AdapterResult[list[str]]

List model configurations using pool.

Returns:

Type Description
AdapterResult[list[str]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def list_configurations(self) -> AdapterResult[list[str]]:
    """List model configurations using pool.

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "list_configurations", lambda adapter: adapter.list_configurations()
    )
list_drawing_views async
list_drawing_views() -> AdapterResult[list[str]]

List drawing views using pool.

Returns:

Type Description
AdapterResult[list[str]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def list_drawing_views(self) -> AdapterResult[list[str]]:
    """List drawing views using pool.

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "list_drawing_views", lambda adapter: adapter.list_drawing_views()
    )
list_features async
list_features(include_suppressed: bool = False, max_assembly_depth: int = 2) -> AdapterResult[list[dict[str, object]]]

List model features using pool.

Parameters:

Name Type Description Default
include_suppressed bool

The include suppressed value. Defaults to False.

False
max_assembly_depth int

Sub-assembly recursion depth. Defaults to 2.

2

Returns:

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

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def list_features(
    self, include_suppressed: bool = False, max_assembly_depth: int = 2
) -> AdapterResult[list[dict[str, object]]]:
    """List model features using pool.

    Args:
        include_suppressed (bool): The include suppressed value. Defaults to False.
        max_assembly_depth (int): Sub-assembly recursion depth. Defaults to 2.

    Returns:
        AdapterResult[list[dict[str, object]]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "list_features",
        lambda adapter: adapter.list_features(
            include_suppressed, max_assembly_depth
        ),
    )
list_model_dimensions async
list_model_dimensions(feature_name: str | None = None) -> AdapterResult[list[dict[str, Any]]]

List every dimension in the active part or assembly using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def list_model_dimensions(
    self,
    feature_name: str | None = None,
) -> AdapterResult[list[dict[str, Any]]]:
    """List every dimension in the active part or assembly using pool."""
    return await self._execute_with_pool(
        "list_model_dimensions",
        lambda adapter: adapter.list_model_dimensions(feature_name),
    )
list_open_documents async
list_open_documents() -> AdapterResult[list[dict[str, Any]]]

List open documents using pool.

Returns:

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

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

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

operation.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def list_open_documents(self) -> AdapterResult[list[dict[str, Any]]]:
    """List open documents using pool.

    Returns:
        AdapterResult[list[dict[str, Any]]]: The result produced by the
        operation.
    """
    return await self._execute_with_pool(
        "list_open_documents", lambda adapter: adapter.list_open_documents()
    )
measure_entities async
measure_entities(entities: list[str]) -> AdapterResult[dict[str, Any]]

Measure one or two selected entities using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def measure_entities(
    self,
    entities: list[str],
) -> AdapterResult[dict[str, Any]]:
    """Measure one or two selected entities using pool."""
    return await self._execute_with_pool(
        "measure_entities",
        lambda adapter: adapter.measure_entities(entities),
    )
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 using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.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 using pool."""
    return await self._execute_with_pool(
        "mirror_feature",
        lambda adapter: adapter.mirror_feature(
            features, mirror_plane, merge, mirror_bodies
        ),
    )
open_model async
open_model(file_path: str) -> AdapterResult[SolidWorksModel]

Open model using pool.

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/connection_pool.py
async def open_model(self, file_path: str) -> AdapterResult[SolidWorksModel]:
    """Open model using pool.

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "open_model", lambda adapter: adapter.open_model(file_path)
    )
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 using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.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 using pool."""
    return await self._execute_with_pool(
        "pattern_circular",
        lambda adapter: adapter.pattern_circular(
            features, axis, count, angle, equal_spacing
        ),
    )
rebuild_model async
rebuild_model(top_level_only: bool = False) -> AdapterResult[dict[str, Any]]

Force a rebuild using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def rebuild_model(
    self, top_level_only: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Force a rebuild using pool."""
    return await self._execute_with_pool(
        "rebuild_model", lambda adapter: adapter.rebuild_model(top_level_only)
    )
release async
release(adapter: SolidWorksAdapter) -> None

Provide release support for the connection pool adapter.

Parameters:

Name Type Description Default
adapter SolidWorksAdapter

Adapter instance used for the operation.

required

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def release(self, adapter: SolidWorksAdapter) -> None:
    """Provide release support for the connection pool adapter.

    Args:
        adapter (SolidWorksAdapter): Adapter instance used for the operation.

    Returns:
        None: None.
    """
    await self._return_adapter(adapter)
rename_feature async
rename_feature(old_name: str, new_name: str) -> AdapterResult[dict[str, Any]]

Rename a feature using pool.

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 result produced by the operation.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def rename_feature(
    self, old_name: str, new_name: str
) -> AdapterResult[dict[str, Any]]:
    """Rename a feature using pool.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "rename_feature",
        lambda adapter: adapter.rename_feature(old_name, new_name),
    )
reset_circuit_breakers async
reset_circuit_breakers(operation: str | None = None) -> AdapterResult[dict[str, list[str]]]

Reset the circuit breakers of the pooled adapters.

Every slot may hold the same breaker-wrapped adapter, so each one is reset once.

Parameters:

Name Type Description Default
operation str | None

The operation to reset; None resets every one.

None

Returns:

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

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def reset_circuit_breakers(
    self, operation: str | None = None
) -> AdapterResult[dict[str, list[str]]]:
    """Reset the circuit breakers of the pooled adapters.

    Every slot may hold the same breaker-wrapped adapter, so each one is
    reset once.

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

    Returns:
        AdapterResult[dict[str, list[str]]]: ``reset``, the operations that were open.
    """
    was_open: set[str] = set()
    unique = {id(adapter): adapter for adapter in self.pool}
    for adapter in unique.values():
        reset = getattr(adapter, "reset_circuit_breakers", None)
        if reset is not None:
            result = await reset(operation)
            was_open.update((result.data or {}).get("reset", []))
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS, data={"reset": sorted(was_open)}
    )
save_body_as_part async
save_body_as_part(body_name: str, file_path: str) -> AdapterResult[dict[str, Any]]

Save a body to a new part using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def save_body_as_part(
    self, body_name: str, file_path: str
) -> AdapterResult[dict[str, Any]]:
    """Save a body to a new part using pool."""
    return await self._execute_with_pool(
        "save_body_as_part",
        lambda adapter: adapter.save_body_as_part(body_name, file_path),
    )
save_file async
save_file(file_path: str | None = None) -> AdapterResult[None]

Save model using pool.

Parameters:

Name Type Description Default
file_path str | None

Path to the target file. Defaults to None.

None

Returns:

Type Description
AdapterResult[None]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def save_file(self, file_path: str | None = None) -> AdapterResult[None]:
    """Save model using pool.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "save_file", lambda adapter: adapter.save_file(file_path)
    )
select_face_edges async
select_face_edges(point: list[float] | None = None, side: str | None = None, plane: str | None = None, edge_type: str = 'all', append: bool = False) -> AdapterResult[dict[str, Any]]

Multi-select a face's edges using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def select_face_edges(
    self,
    point: list[float] | None = None,
    side: str | None = None,
    plane: str | None = None,
    edge_type: str = "all",
    append: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Multi-select a face's edges using pool."""
    return await self._execute_with_pool(
        "select_face_edges",
        lambda adapter: adapter.select_face_edges(
            point, side, plane, edge_type, append
        ),
    )
select_feature async
select_feature(feature_name: str, append: bool = False) -> AdapterResult[dict[str, Any]]

Select a named feature using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def select_feature(
    self, feature_name: str, append: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Select a named feature using pool."""
    return await self._execute_with_pool(
        "select_feature",
        lambda adapter: adapter.select_feature(feature_name, append),
    )
set_component_state async
set_component_state(component: str, fixed: bool | None = None, flexible: bool | None = None) -> AdapterResult[dict[str, Any]]

Set a component's state using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def set_component_state(
    self,
    component: str,
    fixed: bool | None = None,
    flexible: bool | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Set a component's state using pool."""
    return await self._execute_with_pool(
        "set_component_state",
        lambda adapter: adapter.set_component_state(component, fixed, flexible),
    )
set_custom_property async
set_custom_property(name: str, value: str, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Create or overwrite one custom property using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def set_custom_property(
    self,
    name: str,
    value: str,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Create or overwrite one custom property using pool."""
    return await self._execute_with_pool(
        "set_custom_property",
        lambda adapter: adapter.set_custom_property(name, value, configuration),
    )
set_dimension async
set_dimension(name: str, value: float) -> AdapterResult[None]

Set dimension using pool.

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/connection_pool.py
async def set_dimension(self, name: str, value: float) -> AdapterResult[None]:
    """Set dimension using pool.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "set_dimension", lambda adapter: adapter.set_dimension(name, value)
    )
set_material async
set_material(material_name: str, database: str | None = None, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Assign a material to the active part using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def set_material(
    self,
    material_name: str,
    database: str | None = None,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Assign a material to the active part using pool."""
    return await self._execute_with_pool(
        "set_material",
        lambda adapter: adapter.set_material(
            material_name, database, configuration
        ),
    )
set_sheet_scale async
set_sheet_scale(numerator: float, denominator: float) -> AdapterResult[dict[str, Any]]

Set the active drawing sheet's scale using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def set_sheet_scale(
    self,
    numerator: float,
    denominator: float,
) -> AdapterResult[dict[str, Any]]:
    """Set the active drawing sheet's scale using pool."""
    return await self._execute_with_pool(
        "set_sheet_scale",
        lambda adapter: adapter.set_sheet_scale(numerator, denominator),
    )
set_units async
set_units(unit_system: str) -> AdapterResult[dict[str, Any]]

Set document units using pool.

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]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def set_units(self, unit_system: str) -> AdapterResult[dict[str, Any]]:
    """Set document units using pool.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "set_units", lambda adapter: adapter.set_units(unit_system)
    )
sketch_circular_pattern async
sketch_circular_pattern(entities: list[str], angle: float, count: int) -> AdapterResult[str]

Sketch circular pattern using pool.

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/connection_pool.py
async def sketch_circular_pattern(
    self,
    entities: list[str],
    angle: float,
    count: int,
) -> AdapterResult[str]:
    """Sketch circular pattern using pool.

    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 await self._execute_with_pool(
        "sketch_circular_pattern",
        lambda adapter: adapter.sketch_circular_pattern(entities, angle, count),
    )
sketch_linear_pattern async
sketch_linear_pattern(entities: list[str], direction_x: float, direction_y: float, spacing: float, count: int) -> AdapterResult[str]

Sketch linear pattern using pool.

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/connection_pool.py
async def sketch_linear_pattern(
    self,
    entities: list[str],
    direction_x: float,
    direction_y: float,
    spacing: float,
    count: int,
) -> AdapterResult[str]:
    """Sketch linear pattern using pool.

    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 await self._execute_with_pool(
        "sketch_linear_pattern",
        lambda adapter: adapter.sketch_linear_pattern(
            entities, direction_x, direction_y, spacing, count
        ),
    )
sketch_mirror async
sketch_mirror(entities: list[str], mirror_line: str) -> AdapterResult[str]

Sketch mirror using pool.

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/connection_pool.py
async def sketch_mirror(
    self, entities: list[str], mirror_line: str
) -> AdapterResult[str]:
    """Sketch mirror using pool.

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "sketch_mirror",
        lambda adapter: adapter.sketch_mirror(entities, mirror_line),
    )
sketch_offset async
sketch_offset(entities: list[str], offset_distance: float, reverse_direction: bool) -> AdapterResult[str]

Sketch offset using pool.

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/connection_pool.py
async def sketch_offset(
    self,
    entities: list[str],
    offset_distance: float,
    reverse_direction: bool,
) -> AdapterResult[str]:
    """Sketch offset using pool.

    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 await self._execute_with_pool(
        "sketch_offset",
        lambda adapter: adapter.sketch_offset(
            entities, offset_distance, reverse_direction
        ),
    )
suppress_feature async
suppress_feature(name: str, suppress: bool = True) -> AdapterResult[dict[str, Any]]

Suppress or unsuppress a feature using pool.

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 result produced by the operation.

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "suppress_feature",
        lambda adapter: adapter.suppress_feature(name, suppress),
    )
undo async
undo(count: int = 1) -> AdapterResult[dict[str, Any]]

Undo using pool.

Parameters:

Name Type Description Default
count int

Number of steps to undo.

1

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def undo(self, count: int = 1) -> AdapterResult[dict[str, Any]]:
    """Undo using pool.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "undo", lambda adapter: adapter.undo(count)
    )

IntelligentRouter

IntelligentRouter(analyzer: ComplexityAnalyzer, cache: ResponseCache, cacheable_operations: set[str] | None = None)

Route operations between COM and VBA paths using complexity analysis.

Parameters:

Name Type Description Default
analyzer ComplexityAnalyzer

The analyzer value.

required
cache ResponseCache

The cache value.

required
cacheable_operations set[str] | None

The cacheable operations value. Defaults to None.

None

Attributes:

Name Type Description
_analyzer Any

The analyzer value.

_cache Any

The cache value.

_cacheable_operations Any

The cacheable operations value.

Initialize router dependencies.

Parameters:

Name Type Description Default
analyzer ComplexityAnalyzer

The analyzer value.

required
cache ResponseCache

The cache value.

required
cacheable_operations set[str] | None

The cacheable operations value. Defaults to None.

None

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/intelligent_router.py
def __init__(
    self,
    analyzer: ComplexityAnalyzer,
    cache: ResponseCache,
    cacheable_operations: set[str] | None = None,
) -> None:
    """Initialize router dependencies.

    Args:
        analyzer (ComplexityAnalyzer): The analyzer value.
        cache (ResponseCache): The cache value.
        cacheable_operations (set[str] | None): The cacheable operations value. Defaults to
                                                None.

    Returns:
        None: None.
    """
    self._analyzer = analyzer
    self._cache = cache
    self._cacheable_operations = cacheable_operations or {
        # Live document metadata is deliberately NOT cached. Model state,
        # save state, paths, features, configurations, dimensions and
        # properties can all change after any CAD operation, and this
        # router has no reliable mutation-triggered invalidation.
        # "get_model_info",
        # "list_features",
        # "list_configurations",
        # "get_file_properties",
        # "get_dimension",
        # Analysis operations — NOT cached: model state changes with
        # every feature-creation tool call and the router has no
        # automatic invalidation. Caching these produced stale
        # volumes mid-build.
        # "get_mass_properties",
        # "calculate_mass_properties",
        "get_material_properties",
        "analyze_geometry",
        # "check_interference": changes as components are mated or moved;
        # a cached answer ignored the changes (#209).
        # Drawing analysis operations
        "analyze_drawing_comprehensive",
        "analyze_drawing_dimensions",
        "analyze_drawing_views",
        "analyze_drawing_annotations",
        "check_drawing_compliance",
        "check_drawing_standards",
        "compare_drawing_versions",
        # Classification and indexing
        "classify_feature_tree",
        "discover_solidworks_docs",
    }
Methods:
execute async
execute(operation: str, payload: object, call_args: tuple[Any, ...], call_kwargs: dict[str, Any], com_operation: OperationCallable, vba_operation: OperationCallable | None, cache_ttl_seconds: int | None = None) -> tuple[AdapterResult[Any], RouteResult]

Provide execute support for the intelligent router.

Parameters:

Name Type Description Default
operation str

Callable object executed by the helper.

required
payload object

The payload value.

required
call_args tuple[Any, ...]

The call args value.

required
call_kwargs dict[str, Any]

The call kwargs value.

required
com_operation OperationCallable

The com operation value.

required
vba_operation OperationCallable | None

The vba operation value.

required
cache_ttl_seconds int | None

The cache ttl seconds value. Defaults to None.

None

Returns:

Type Description
tuple[AdapterResult[Any], RouteResult]

tuple[AdapterResult[Any], RouteResult]: A tuple containing the resulting values.

Source code in src/solidworks_mcp/adapters/intelligent_router.py
async def execute(
    self,
    operation: str,
    payload: object,
    call_args: tuple[Any, ...],
    call_kwargs: dict[str, Any],
    com_operation: OperationCallable,
    vba_operation: OperationCallable | None,
    cache_ttl_seconds: int | None = None,
) -> tuple[AdapterResult[Any], RouteResult]:
    """Provide execute support for the intelligent router.

    Args:
        operation (str): Callable object executed by the helper.
        payload (object): The payload value.
        call_args (tuple[Any, ...]): The call args value.
        call_kwargs (dict[str, Any]): The call kwargs value.
        com_operation (OperationCallable): The com operation value.
        vba_operation (OperationCallable | None): The vba operation value.
        cache_ttl_seconds (int | None): The cache ttl seconds value. Defaults to None.

    Returns:
        tuple[AdapterResult[Any], RouteResult]: A tuple containing the resulting values.
    """
    if operation in self._cacheable_operations and self._cache.enabled:
        key = self._cache.make_key(operation, payload)
        cached = self._cache.get(key)
        if isinstance(cached, AdapterResult):
            return cached, RouteResult(route="cache", used_cache=True)

    decision = self._analyzer.analyze(operation=operation, payload=payload)

    if decision.prefer_vba and vba_operation is not None:
        vba_result = await self._safe_call(vba_operation, call_args, call_kwargs)
        self._analyzer.record_result(
            operation=operation,
            route="vba",
            success=vba_result.is_success,
        )
        if vba_result.is_success:
            self._cache_result(operation, payload, vba_result, cache_ttl_seconds)
            return vba_result, RouteResult(route="vba", used_cache=False)

    com_result = await self._safe_call(com_operation, call_args, call_kwargs)
    self._analyzer.record_result(
        operation=operation,
        route="com",
        success=com_result.is_success,
    )

    if com_result.is_success:
        self._cache_result(operation, payload, com_result, cache_ttl_seconds)
        return com_result, RouteResult(route="com", used_cache=False)

    if not decision.prefer_vba and vba_operation is not None:
        fallback_result = await self._safe_call(
            vba_operation,
            call_args,
            call_kwargs,
        )
        self._analyzer.record_result(
            operation=operation,
            route="vba",
            success=fallback_result.is_success,
        )
        if fallback_result.is_success:
            self._cache_result(
                operation,
                payload,
                fallback_result,
                cache_ttl_seconds,
            )
            return fallback_result, RouteResult(
                route="vba-fallback", used_cache=False
            )

    return com_result, RouteResult(route="com-error", used_cache=False)

MacroExecutionRequest dataclass

MacroExecutionRequest(macro_code: str, macro_name: str, subroutine: str = 'Main')

Request to execute a VBA macro.

Attributes:

Name Type Description
macro_code str

The macro code value.

macro_name str

The macro name value.

subroutine str

The subroutine value.

MacroExecutionResult dataclass

MacroExecutionResult(success: bool, macro_name: str, output: str | dict[str, Any] | None = None, error: str | None = None, duration_seconds: float = 0.0)

Result of VBA macro execution.

Attributes:

Name Type Description
duration_seconds float

The duration seconds value.

error str | None

The error value.

macro_name str

The macro name value.

output str | dict[str, Any] | None

The output value.

success bool

The success value.

MockSolidWorksAdapter

MockSolidWorksAdapter(config: object | None = None)

Bases: SolidWorksAdapter

Mock adapter that simulates SolidWorks operations.

Parameters:

Name Type Description Default
config object | None

Configuration values for the operation. Defaults to None.

None

Attributes:

Name Type Description
_connected Any

The connected value.

_delays Any

The delays value.

_is_connected_proxy Any

The is connected proxy value.

_operation_count Any

The operation count value.

_simulate_errors Any

The simulate errors value.

Initialize the mock solid works adapter.

Parameters:

Name Type Description Default
config object | None

Configuration values for the operation. Defaults to None.

None

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
def __init__(self, config: object | None = None) -> None:
    """Initialize the mock solid works adapter.

    Args:
        config (object | None): Configuration values for the operation. Defaults to None.

    Returns:
        None: None.
    """
    super().__init__(config)
    cfg: dict[str, Any] = dict(self.config_dict)
    self._connected = False
    self._current_model = None
    self._models: dict[str, SolidWorksModel] = {}
    self._features: dict[str, SolidWorksFeature] = {}
    # Names suppressed via suppress_feature. Kept beside _features rather
    # than on SolidWorksFeature, which has no suppression field.
    self._suppressed_features: set[str] = set()
    # Component tree for an Assembly-type current model, keyed by
    # component name. See ``_flatten_assembly_components`` for shape.
    # Empty means "use the canned default fixture" (see list_features).
    self._assembly_components: dict[str, dict[str, Any]] = {}
    self._sketches: dict[str, str] = {}
    self._current_sketch: str | None = None
    # Names currently "selected" via select_feature / select_face_edges,
    # so append and selection_count behave like the real selection set.
    self._selection: list[str] = []
    # Test hook: RawRebuildIssue objects rebuild_model should report, so
    # the error/warning paths can be exercised without real geometry.
    self.injected_rebuild_issues: list[Any] = []
    # Tracks IDs returned by add_line/add_arc/add_circle/add_centerline/
    # add_rectangle/add_spline so add_sketch_constraint can validate
    # entity1/entity2 the same way the real adapter validates against
    # its sketch-entity registry.
    self._sketch_entity_ids: set[str] = set()
    self._dimensions: dict[str, float] = {}
    # Assembly components inserted via insert_component, keyed by
    # insertion order. See insert_component/list_components/add_mate.
    self._components: list[str] = []
    # Mates added via add_mate, in order, so the geometry summary can
    # report a mate count without real geometry.
    self._mates: list[dict[str, Any]] = []
    self._component_states: dict[str, dict[str, bool]] = {}
    # Drawing views placed via create_drawing_view / add_drawing_view /
    # create_technical_drawing, in sheet order. See list_drawing_views.
    self._drawing_views: list[str] = []
    # Reference planes created via create_reference_plane, in creation
    # order, used to invent sequential "PlaneN" names. Shared feature
    # tree counter with create_axis mirrors the live adapter's
    # features_before/features_after pair (see _feature_count in
    # solidworks/features.py).
    self._reference_planes: list[str] = []
    # Axes created via create_axis, in creation order, used to invent
    # sequential "AxisN" names the same way self._reference_planes
    # invents "PlaneN" names, and to validate the axis name passed to
    # pattern_circular the same way known_sources validates mirror
    # sources.
    self._axes: list[str] = []
    # Reference points created via create_reference_point, in creation
    # order, invented "PointN" names on the same pattern as _axes.
    self._reference_points: list[str] = []
    # Centre-mark count per drawing-view name, grown by auto_center_marks.
    self._center_marks: dict[str, int] = {}
    self._feature_tree_count = 0
    # Volume tracked for mirror_feature, in mm^3. Seeded at the
    # live-measured 1819569.1 mm^3 wing volume from
    # _mirror_feature_impl in solidworks/features.py, then doubled on
    # each successful mirror so volume_before/volume_after/volume_ratio
    # stay self-consistent without a real geometry engine.
    self._mirror_volume: float = 1819569.1
    # Volume tracked for pattern_circular, in mm^3. Seeded at the
    # live-measured 48431.5 mm^3 hub+blade volume from
    # _pattern_circular_impl in solidworks/features.py, then grown by
    # _PATTERN_BLADE_VOLUME per extra instance on each successful
    # pattern so volume_before/volume_after/volume_ratio stay
    # self-consistent without a real geometry engine.
    self._pattern_volume: float = 48431.5
    self._operation_count = 0

    # Configurable simulation delays (in seconds)
    self._delays = {
        "connect": cfg.get("mock_connect_delay", 0.1),
        "model_operation": cfg.get("mock_model_delay", 0.02),
        "feature_operation": cfg.get("mock_feature_delay", 0.03) if cfg else 0.03,
        "sketch_operation": cfg.get("mock_sketch_delay", 0.1),
    }
    self._is_connected_proxy = _BoolCallable(lambda: self._connected)
    self._simulate_errors = bool(cfg.get("simulate_errors", False))
Methods:
__getattribute__
__getattribute__(name: str) -> Any

Build internal getattribute.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Name Type Description
Any Any

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
def __getattribute__(self, name: str) -> Any:
    """Build internal getattribute.

    Args:
        name (str): The name value.

    Returns:
        Any: The result produced by the operation.
    """
    if name == "is_connected":
        return object.__getattribute__(self, "_is_connected_proxy")
    return object.__getattribute__(self, name)
activate_document async
activate_document(title_or_path: str) -> AdapterResult[dict[str, Any]]

Mock making an already-open document active.

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]]: The result produced by the operation.

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(0.05)
    if not self._connected:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="Not connected to SolidWorks"
        )
    target = (title_or_path or "").strip()
    if not target:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="title_or_path is required"
        )

    needle = target.lower()
    match = None
    for model in self._models.values():
        names = {
            model.name.lower(),
            model.path.lower(),
            model.path.rsplit("/", 1)[-1].lower(),
        }
        if needle in names:
            match = model
            break
    if match is None:
        open_titles = ", ".join(m.name for m in self._models.values()) or "none"
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"No open document matches {target!r}. Open: {open_titles}",
        )

    self._current_model = match
    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={"activated": match.name, "verified": True},
        execution_time=0.05,
    )
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]

Mock adding a circular arc to sketch.

Parameters:

Name Type Description Default
center_x float

Arc centre X.

required
center_y float

Arc centre Y.

required
start_x float

Arc start point X.

required
start_y float

Arc start point Y.

required
end_x float

Arc end point X.

required
end_y float

Arc end point Y.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.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]:
    """Mock adding a circular arc to sketch.

    Args:
        center_x (float): Arc centre X.
        center_y (float): Arc centre Y.
        start_x (float): Arc start point X.
        start_y (float): Arc start point Y.
        end_x (float): Arc end point X.
        end_y (float): Arc end point Y.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    arc_id = f"Arc_{random.randint(1000, 9999)}"
    self._sketch_entity_ids.add(arc_id)

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=arc_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
add_centerline async
add_centerline(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Mock adding a construction centerline to 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/mock_adapter.py
async def add_centerline(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Mock adding a construction centerline to 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.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    centerline_id = f"Centerline_{random.randint(1000, 9999)}"
    self._sketch_entity_ids.add(centerline_id)

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=centerline_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
add_chamfer async
add_chamfer(distance: float, edge_names: list[str], angle: float = 45.0, flip: bool = False) -> AdapterResult[SolidWorksFeature]

Mock angle-distance chamfer (see :meth:_mock_edge_feature).

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def add_chamfer(
    self,
    distance: float,
    edge_names: list[str],
    angle: float = 45.0,
    flip: bool = False,
) -> AdapterResult[SolidWorksFeature]:
    """Mock angle-distance chamfer (see :meth:`_mock_edge_feature`)."""
    result = await self._mock_edge_feature("Chamfer", distance, edge_names)
    if result.is_success:
        result.data.parameters.update({"angle": angle, "flip": flip})
    return result
add_circle async
add_circle(center_x: float, center_y: float, radius: float) -> AdapterResult[str]

Mock adding a circle to 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/mock_adapter.py
async def add_circle(
    self, center_x: float, center_y: float, radius: float
) -> AdapterResult[str]:
    """Mock adding a circle to 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.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    circle_id = f"Circle{random.randint(1000, 9999)}"
    self._sketch_entity_ids.add(circle_id)

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=circle_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
add_datum_tag async
add_datum_tag(label: str, attach_at_mm: tuple[float, float], x_mm: float, y_mm: float) -> AdapterResult[dict[str, Any]]

Mock adding a datum tag; refuses what the real one refuses.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def add_datum_tag(
    self,
    label: str,
    attach_at_mm: tuple[float, float],
    x_mm: float,
    y_mm: float,
) -> AdapterResult[dict[str, Any]]:
    """Mock adding a datum tag; refuses what the real one refuses."""
    guard = self._mock_doc_error({"Drawing"}, "add_datum_tag")
    if guard is not None:
        return guard
    letter = label.strip().upper()
    if len(letter) != 1 or not letter.isalpha():
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="label must be a single letter, e.g. 'A'",
        )
    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={"label": letter, "position_mm": [x_mm, y_mm]},
    )
add_drawing_view async
add_drawing_view(payload: Any = None) -> AdapterResult[dict[str, Any]]

Mock adding a view of a model to the active drawing sheet.

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the model path and orientation.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])
    return self._mock_place_view(payload)
add_ellipse async
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float) -> AdapterResult[str]

Mock adding an axis-aligned ellipse to sketch.

Parameters:

Name Type Description Default
center_x float

Ellipse centre X in millimetres.

required
center_y float

Ellipse centre Y in millimetres.

required
major_axis float

Full major-axis length in millimetres.

required
minor_axis float

Full minor-axis length in millimetres.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def add_ellipse(
    self,
    center_x: float,
    center_y: float,
    major_axis: float,
    minor_axis: float,
) -> AdapterResult[str]:
    """Mock adding an axis-aligned ellipse to sketch.

    Args:
        center_x (float): Ellipse centre X in millimetres.
        center_y (float): Ellipse centre Y in millimetres.
        major_axis (float): Full major-axis length in millimetres.
        minor_axis (float): Full minor-axis length in millimetres.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    ellipse_id = f"Ellipse_{random.randint(1000, 9999)}"
    self._sketch_entity_ids.add(ellipse_id)

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=ellipse_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
add_fillet async
add_fillet(radius: float, edge_names: list[str]) -> AdapterResult[SolidWorksFeature]

Mock constant-radius fillet (see :meth:_mock_edge_feature).

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def add_fillet(
    self, radius: float, edge_names: list[str]
) -> AdapterResult[SolidWorksFeature]:
    """Mock constant-radius fillet (see :meth:`_mock_edge_feature`)."""
    return await self._mock_edge_feature("Fillet", radius, edge_names)
add_gtol async
add_gtol(characteristic: str, tolerance: float, x_mm: float, y_mm: float, diameter_zone: bool = False, material_condition: str = 'none', datums: list[str] | None = None, attach_at_mm: tuple[float, float] | None = None, dimension: tuple[str, str] | None = None) -> AdapterResult[dict[str, Any]]

Mock adding a feature control frame; refuses what the real one refuses.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def add_gtol(
    self,
    characteristic: str,
    tolerance: float,
    x_mm: float,
    y_mm: float,
    diameter_zone: bool = False,
    material_condition: str = "none",
    datums: list[str] | None = None,
    attach_at_mm: tuple[float, float] | None = None,
    dimension: tuple[str, str] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Mock adding a feature control frame; refuses what the real one refuses."""
    guard = self._mock_doc_error({"Drawing"}, "add_gtol")
    if guard is not None:
        return guard
    problem = gtol_problem(characteristic, tolerance, material_condition, datums)
    if problem is not None:
        return AdapterResult(status=AdapterResultStatus.ERROR, error=problem)
    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "characteristic": characteristic,
            "tolerance": f"{tolerance:g}",
            "diameter_zone": diameter_zone,
            "material_condition": material_condition,
            "datums": [d.strip().upper() for d in datums or []],
            "attached": (
                dimension[1] if dimension is not None else attach_at_mm is not None
            ),
            "position_mm": None if dimension is not None else [x_mm, y_mm],
            "layout": None,
        },
    )
add_line async
add_line(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Mock adding a line to 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/mock_adapter.py
async def add_line(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Mock adding a line to 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.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    line_id = f"Line{random.randint(1000, 9999)}"
    self._sketch_entity_ids.add(line_id)

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=line_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
add_mate async
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0, face_a: list[float] | None = None, face_b: list[float] | None = None) -> AdapterResult[dict[str, Any]]

Mock mating two components 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. Defaults to "coincident".

'coincident'
alignment str

Mate alignment. Defaults to "aligned".

'aligned'
distance float

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

0.0
angle float

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

0.0
face_a list[float] | None

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

None
face_b list[float] | None

The same for the second component.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def add_mate(
    self,
    component_a: str,
    component_b: str,
    entity_a: str = "Front Plane",
    entity_b: str = "Front Plane",
    mate_type: str = "coincident",
    alignment: str = "aligned",
    distance: float = 0.0,
    angle: float = 0.0,
    face_a: list[float] | None = None,
    face_b: list[float] | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Mock mating two components 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. Defaults to "coincident".
        alignment (str): Mate alignment. Defaults to "aligned".
        distance (float): Distance in millimetres, for a distance mate.
            Defaults to 0.0.
        angle (float): Angle in degrees, for an angle mate. Defaults to 0.0.
        face_a (list[float] | None): A point on a face of the first
            component (part coordinates, mm), used instead of entity_a.
        face_b (list[float] | None): The same for the second component.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    from .solidworks.face_selection import mate_entity_label

    known_mate_types = {
        "coincident",
        "concentric",
        "perpendicular",
        "parallel",
        "tangent",
        "distance",
        "angle",
    }
    if mate_type not in known_mate_types:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Unknown mate type '{mate_type}'. "
                f"Use one of: {', '.join(sorted(known_mate_types))}."
            ),
        )

    await asyncio.sleep(self._delays["model_operation"])
    self._operation_count += 1
    self._mates.append(
        {"mate_type": mate_type, "components": [component_a, component_b]}
    )

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "mate_type": mate_type,
            "alignment": alignment,
            "components": [component_a, component_b],
            "entities": [
                mate_entity_label(entity_a, face_a),
                mate_entity_label(entity_b, face_b),
            ],
            "distance": distance or None,
            "angle": angle or None,
            # The real adapter fills these by comparing every component's
            # Transform2 before and after the mate. The mock has no
            # geometry to move, so it reports "not determinable" rather
            # than True: this field exists precisely so a caller can tell
            # a mate that positioned something from one SolidWorks
            # accepted and ignored, and a mock that always answers True
            # would make that check useless wherever mock mode is used.
            "moved_components": [],
            "geometry_moved": None,
        },
        execution_time=self._delays["model_operation"],
    )
add_note async
add_note(payload: Any = None) -> AdapterResult[dict[str, Any]]

Mock placing a text note on the active drawing sheet.

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the text and position.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Args:
        payload (Any): Tool payload carrying the text and position.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])
    data = payload if isinstance(payload, dict) else {}
    text = data.get("text")
    if not text:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="add_note requires text"
        )

    self._operation_count += 1
    font_points = float(data.get("font_size") or 0.0)
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "text": text,
            "position": {
                "x": float(data.get("position_x", 100.0)),
                "y": float(data.get("position_y", 50.0)),
            },
            # The real adapter sets this from IAnnotation::SetPosition's
            # return. Mock mode has no sheet to place anything on, so it
            # reports "not determinable" rather than claiming success at a
            # check it never performed.
            "positioned": None,
            "font_size_points": font_points or None,
        },
        execution_time=self._delays["model_operation"],
    )
add_polygon async
add_polygon(center_x: float, center_y: float, radius: float, sides: int) -> AdapterResult[str]

Mock adding a regular polygon to sketch.

Parameters:

Name Type Description Default
center_x float

Polygon centre X in millimetres.

required
center_y float

Polygon centre Y in millimetres.

required
radius float

Circumradius in millimetres (distance from centre to each vertex; matches the real adapter's CreatePolygon(..., Inscribed=True) semantics).

required
sides int

Number of polygon sides.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def add_polygon(
    self, center_x: float, center_y: float, radius: float, sides: int
) -> AdapterResult[str]:
    """Mock adding a regular polygon to sketch.

    Args:
        center_x (float): Polygon centre X in millimetres.
        center_y (float): Polygon centre Y in millimetres.
        radius (float): Circumradius in millimetres (distance from centre
            to each vertex; matches the real adapter's
            ``CreatePolygon(..., Inscribed=True)`` semantics).
        sides (int): Number of polygon sides.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    # ID format mirrors the real PyWin32 adapter, which uses
    # ``_register_sketch_entity("Polygon", ...)`` (counter-based) so the
    # returned ID is a valid input to downstream sketch_linear_pattern /
    # sketch_circular_pattern / sketch_mirror / sketch_offset calls.
    polygon_id = f"Polygon_{len(self._sketch_entity_ids) + 1}"
    self._sketch_entity_ids.add(polygon_id)
    _ = sides  # informational only; the sides count is no longer part of the ID

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=polygon_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
add_rectangle async
add_rectangle(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Mock adding a rectangle to 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/mock_adapter.py
async def add_rectangle(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Mock adding a rectangle to 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.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )

    await asyncio.sleep(self._delays["sketch_operation"])
    self._operation_count += 1

    rect_id = f"Rectangle{random.randint(1000, 9999)}"
    self._sketch_entity_ids.add(rect_id)

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=rect_id,
        execution_time=self._delays["sketch_operation"],
    )
add_sketch_constraint async
add_sketch_constraint(entity1: str, entity2: str | None, relation_type: str, entity3: str | None = None) -> AdapterResult[str]

Mock adding a geometric constraint between sketch entities.

Parameters:

Name Type Description Default
entity1 str

Primary sketch-entity ID.

required
entity2 str | None

Secondary sketch-entity ID, or None for single-entity relations (horizontal, vertical, fix).

required
relation_type str

Constraint name (see RELATION_NAME_MAP).

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]: SUCCESS with a placeholder constraint ID, or ERROR if no active sketch, the relation_type is unsupported, arity is wrong, or an entity ID is unknown.

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

    Args:
        entity1 (str): Primary sketch-entity ID.
        entity2 (str | None): Secondary sketch-entity ID, or None for
            single-entity relations (horizontal, vertical, fix).
        relation_type (str): Constraint name (see RELATION_NAME_MAP).
        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]: SUCCESS with a placeholder constraint ID, or
            ERROR if no active sketch, the relation_type is unsupported,
            arity is wrong, or an entity ID is unknown.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )

    rt_norm = (relation_type or "").strip().lower()
    if rt_norm not in RELATION_NAME_MAP:
        supported = ", ".join(sorted(RELATION_NAME_MAP))
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Unsupported relation type '{relation_type}'. "
                f"Supported: {supported}"
            ),
        )

    # Arity validation — mirror the real adapter
    if rt_norm == "symmetric":
        if entity2 is None or entity3 is None:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=(
                    f"Relation '{relation_type}' requires entity1, "
                    "entity2, and entity3 (the centerline of symmetry)"
                ),
            )
    elif entity3 is not None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Relation '{relation_type}' does not accept entity3 — "
                "only 'symmetric' takes a third entity (the centerline)"
            ),
        )

    # Validate entity IDs against the in-process sketch-entity registry
    # so the mock surfaces the same "Unknown sketch entity" error as the
    # real adapter (which checks adapter._sketch_entities).
    for ent in (entity1, entity2, entity3):
        if ent is not None and ent not in self._sketch_entity_ids:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=(
                    f"Unknown sketch entity '{ent}'. Use IDs returned by "
                    "add_line/add_arc/add_circle/add_spline/add_centerline."
                ),
            )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    constraint_id = f"Constraint_{relation_type}_{random.randint(1000, 9999)}"

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=constraint_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
add_sketch_line async
add_sketch_line(x1: float, y1: float, x2: float, y2: float, construction: bool = False) -> AdapterResult[dict[str, Any]]

Legacy compatibility wrapper around add_line.

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
construction bool

The construction value. Defaults to False.

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def add_sketch_line(
    self,
    x1: float,
    y1: float,
    x2: float,
    y2: float,
    construction: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Legacy compatibility wrapper around add_line.

    Args:
        x1 (float): The x1 value.
        y1 (float): The y1 value.
        x2 (float): The x2 value.
        y2 (float): The y2 value.
        construction (bool): The construction value. Defaults to False.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    result = await self.add_line(x1, y1, x2, y2)
    if not result.is_success:
        return AdapterResult(
            status=result.status,
            error=result.error,
            execution_time=result.execution_time,
        )
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "id": result.data,
            "start": {"x": x1, "y": y1},
            "end": {"x": x2, "y": y2},
            "construction": construction,
        },
        execution_time=result.execution_time,
    )
add_spline async
add_spline(points: list[dict[str, float]]) -> AdapterResult[str]

Mock adding a NURBS spline through the supplied points.

Parameters:

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

Ordered control points with "x" / "y" keys. Minimum 2 points.

required

Returns:

Type Description
AdapterResult[str]

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

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

    Args:
        points (list[dict[str, float]]): Ordered control points with
            ``"x"`` / ``"y"`` keys. Minimum 2 points.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )
    if len(points) < 2:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="add_spline requires at least 2 points",
        )
    # Match the real adapter's point contract: each dict must carry
    # both ``x`` and ``y`` keys, or the live impl raises KeyError on
    # ``point["x"]``. Validating here keeps mock/live parity so tests
    # that pass against the mock won't fail live on malformed input.
    for index, point in enumerate(points):
        if not isinstance(point, dict) or "x" not in point or "y" not in point:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=(
                    f"add_spline point at index {index} is missing "
                    "required 'x' and/or 'y' keys"
                ),
            )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    spline_id = f"Spline_{random.randint(1000, 9999)}"
    self._sketch_entity_ids.add(spline_id)

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=spline_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
arrange_dimensions async
arrange_dimensions(view_name: str | None = None) -> AdapterResult[dict[str, Any]]

Mock arranging drawing dimensions: reports a clean layout.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def arrange_dimensions(
    self, view_name: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Mock arranging drawing dimensions: reports a clean layout."""
    guard = self._mock_doc_error({"Drawing"}, "arrange_dimensions")
    if guard is not None:
        return guard
    if view_name and view_name not in self._drawing_views:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"No view named {view_name!r}. Views: "
                f"{', '.join(self._drawing_views) or 'none'}"
            ),
        )
    counts = getattr(self, "_view_dimensions", {})
    total = sum(n for v, n in counts.items() if not view_name or v == view_name)
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "dimensions": total,
            "moved": total,
            "unplaced": [],
            "overlaps_before": total,
            "overlaps_after": 0,
            "remaining_overlaps": [],
            "sheet_size_m": [0.42, 0.297],
        },
    )
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]]

Mock auto-inserting centre marks on a drawing view.

The mock has no geometry, so it cannot know how many circular features a view holds - it mirrors the live adapter's refusals (not a drawing, no feature type selected, unknown view) and, on a valid request, records a nominal centre-mark increase per view so before/after deltas stay monotonic across calls.

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, the feature types acted

AdapterResult[dict[str, Any]]

on, and before/after centre-mark counts, or an error.

Source code in src/solidworks_mcp/adapters/mock_adapter.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]]:
    """Mock auto-inserting centre marks on a drawing view.

    The mock has no geometry, so it cannot know how many circular
    features a view holds - it mirrors the live adapter's refusals (not
    a drawing, no feature type selected, unknown view) and, on a valid
    request, records a nominal centre-mark increase per view so
    before/after deltas stay monotonic across calls.

    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, the feature types acted
        on, and before/after centre-mark counts, or an error.
    """
    await asyncio.sleep(self._delays["model_operation"] / 2)

    model = self._current_model
    if model is None or getattr(model, "type", None) != "Drawing":
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="auto_center_marks requires an active drawing document",
        )
    if not (mark_holes or mark_fillets or mark_slots):
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                "Select at least one feature type: mark_holes, "
                "mark_fillets or mark_slots."
            ),
        )
    if view_name not in self._drawing_views:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"No view named {view_name!r} on the active drawing. "
                f"Views: {', '.join(self._drawing_views) or 'none'}"
            ),
        )

    self._operation_count += 1
    before = self._center_marks.get(view_name, 0)
    # Nominal: two marks per selected feature type, added once.
    added = 0 if before else 2 * sum((mark_holes, mark_fillets, mark_slots))
    after = before + added
    self._center_marks[view_name] = after

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "view": view_name,
            "feature_types": [
                label
                for label, on in (
                    ("holes", mark_holes),
                    ("fillets", mark_fillets),
                    ("slots", mark_slots),
                )
                if on
            ],
            "center_marks_before": before,
            "center_marks_after": after,
            "center_marks_added": added,
        },
        execution_time=self._delays["model_operation"] / 2,
    )
check_interference async
check_interference(params: Any = None) -> AdapterResult[dict[str, Any]]

Mock checking 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]]: The result produced by the operation.

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])
    options = params if isinstance(params, dict) else {}

    if len(self._components) < 2:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                "Interference detection needs at least two components; the "
                f"assembly has {len(self._components)}."
            ),
        )

    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            # The real adapter gets this from SolidWorks' interference
            # engine. The mock has no geometry, so it cannot know whether
            # anything overlaps and says so rather than reporting a clean
            # assembly it never checked - a mock that always answered
            # False would make this tool useless wherever mock mode runs.
            "interference_found": None,
            "interference_count": None,
            "interferences": [],
            "coincident_treated_as_interference": bool(
                options.get("coincident", False)
            ),
            "scope": "whole assembly",
            "tolerance_applied": None,
        },
        execution_time=self._delays["model_operation"],
    )
check_sketch_fully_defined async
check_sketch_fully_defined(sketch_name: str | None = None) -> AdapterResult[dict[str, Any]]

Mock check for sketch definition status.

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/mock_adapter.py
async def check_sketch_fully_defined(
    self, sketch_name: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Mock check for sketch definition status.

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

    Returns:
        AdapterResult[dict[str, Any]]: Definition status payload.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="No active model",
        )

    await asyncio.sleep(self._delays["sketch_operation"] / 3)
    self._operation_count += 1

    resolved_name = sketch_name or self._current_sketch or "Sketch1"
    if sketch_name and sketch_name not in self._sketches:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Sketch not found: {sketch_name}",
        )

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "sketch_name": resolved_name,
            "is_fully_defined": True,
            "definition_state": "fully_defined",
            "source": "mock",
            "raw_status": True,
        },
        execution_time=self._delays["sketch_operation"] / 3,
    )
close_model async
close_model(save: bool = False) -> AdapterResult[None]

Mock closing 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/mock_adapter.py
async def close_model(self, save: bool = False) -> AdapterResult[None]:
    """Mock closing the current model.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.WARNING, error="No active model to close"
        )

    await asyncio.sleep(self._delays["model_operation"] / 2)
    self._operation_count += 1

    if save:
        # Simulate save operation
        await asyncio.sleep(self._delays["model_operation"])

    self._current_model = None

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=None,
        execution_time=self._delays["model_operation"],
    )
connect async
connect() -> None

Mock connection to SolidWorks.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def connect(self) -> None:
    """Mock connection to SolidWorks.

    Returns:
        None: None.
    """
    await asyncio.sleep(self._delays["connect"])
    self._connected = True

    # Initialize some sample data
    self._dimensions = {
        "D1@Sketch1": 10.0,
        "D2@Sketch1": 20.0,
        "D1@Boss-Extrude1": 50.0,
    }
create_assembly async
create_assembly(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Mock creating a new assembly.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    if not self._connected:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="Not connected to SolidWorks"
        )

    await asyncio.sleep(self._delays["model_operation"])
    self._operation_count += 1

    model_id = name or f"Assembly{len(self._models) + 1}"
    model = SolidWorksModel(
        path=f"Mock://{model_id}.sldasm",
        name=f"{model_id}",
        type="Assembly",
        is_active=True,
        configuration="Default",
        properties={
            "created": datetime.now().isoformat(),
            "mock": True,
            "template": template,
        },
    )

    self._current_model = model
    self._models[model.path] = model

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=model,
        execution_time=self._delays["model_operation"],
    )
create_axis async
create_axis(reference: str) -> AdapterResult[dict[str, Any]]

Mock creating a reference axis along a principal direction.

Mirrors the live adapter's plane-pair mapping (_AXIS_PLANE_PAIRS in solidworks/features.py, imported here directly so the two can never drift apart) and validation: only x/y/z (case-insensitive, leading ± stripped) are accepted.

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 the

AdapterResult[dict[str, Any]]

feature counter before/after, or error for an unknown reference.

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

    Mirrors the live adapter's plane-pair mapping (``_AXIS_PLANE_PAIRS``
    in ``solidworks/features.py``, imported here directly so the two can
    never drift apart) and validation: only ``x``/``y``/``z``
    (case-insensitive, leading +/- stripped) are accepted.

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

    Returns:
        AdapterResult[dict[str, Any]]: The plane pair used and the
        feature counter before/after, or error for an unknown reference.
    """
    key = str(reference or "").strip().lower().lstrip("+-")
    if key not in _AXIS_PLANE_PAIRS:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Unknown axis reference '{reference}'. "
                f"Use one of: {', '.join(sorted(_AXIS_PLANE_PAIRS))}."
            ),
        )

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    before = self._feature_tree_count
    self._feature_tree_count += 1
    after = self._feature_tree_count

    plane_a, plane_b = _AXIS_PLANE_PAIRS[key]

    # Invent a sequential "AxisN" name, tracked on self._axes, the same
    # way create_reference_plane invents "PlaneN" names on
    # self._reference_planes. The live adapter reads the new axis's name
    # from the end of the feature tree (InsertAxis2 returns only a bool).
    self._axes.append(f"Axis{len(self._axes) + 1}")

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "name": self._axes[-1],
            "reference": key,
            "planes": [plane_a, plane_b],
            "features_before": before,
            "features_after": after,
        },
        execution_time=self._delays["feature_operation"],
    )
create_drawing async
create_drawing(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Mock creating a new drawing.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    if not self._connected:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="Not connected to SolidWorks"
        )

    await asyncio.sleep(self._delays["model_operation"])
    self._operation_count += 1

    model_id = name or f"Drawing{len(self._models) + 1}"
    model = SolidWorksModel(
        path=f"Mock://{model_id}.slddrw",
        name=f"{model_id}",
        type="Drawing",
        is_active=True,
        configuration="Default",
        properties={
            "created": datetime.now().isoformat(),
            "mock": True,
            "template": template,
        },
    )

    self._current_model = model
    self._models[model.path] = model

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=model,
        execution_time=self._delays["model_operation"],
    )
create_drawing_view async
create_drawing_view(payload: Any = None) -> AdapterResult[dict[str, Any]]

Mock placing a view of a model on the active drawing sheet.

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the model path and orientation.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])
    return self._mock_place_view(payload)
create_extrusion async
create_extrusion(params: ExtrusionParameters | str, depth: float | None = None, direction: str | None = None) -> AdapterResult[SolidWorksFeature]

Mock creating an extrusion feature.

Parameters:

Name Type Description Default
params ExtrusionParameters | str

The params value.

required
depth float | None

The depth value. Defaults to None.

None
direction str | None

The direction value. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def create_extrusion(
    self,
    params: ExtrusionParameters | str,
    depth: float | None = None,
    direction: str | None = None,
) -> AdapterResult[SolidWorksFeature]:
    """Mock creating an extrusion feature.

    Args:
        params (ExtrusionParameters | str): The params value.
        depth (float | None): The depth value. Defaults to None.
        direction (str | None): The direction value. Defaults to None.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    if isinstance(params, str):
        params = ExtrusionParameters(depth=depth or 0.0)
    sketch = self._mock_named_sketch(
        getattr(params, "sketch_name", None), "extrude"
    )
    if isinstance(sketch, AdapterResult):
        return sketch

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    feature_id = f"Boss-Extrude{len(self._features) + 1}"
    feature = SolidWorksFeature(
        name=feature_id,
        type="Extrusion",
        id=str(uuid.uuid4()),
        parameters={
            "depth": params.depth,
            "direction": direction or "blind",
            "draft_angle": params.draft_angle,
            "reverse_direction": params.reverse_direction,
            "both_directions": params.both_directions,
            "end_condition": "MidPlane"
            if params.both_directions
            else params.end_condition,
            "thin_feature": params.thin_feature,
            "thin_thickness": params.thin_thickness,
            "thin_side": params.thin_side if params.thin_feature else None,
            "sketch_name": sketch,
        },
        properties={"created": datetime.now().isoformat(), "mock": True},
    )

    feature_key = feature.id or feature.name
    self._features[feature_key] = feature

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=feature,
        execution_time=self._delays["feature_operation"],
    )
create_loft async
create_loft(params: LoftParameters) -> AdapterResult[SolidWorksFeature]

Mock creating 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/mock_adapter.py
async def create_loft(
    self, params: LoftParameters
) -> AdapterResult[SolidWorksFeature]:
    """Mock creating a loft feature.

    Args:
        params (LoftParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    feature_id = f"Boss-Loft{len(self._features) + 1}"
    feature = SolidWorksFeature(
        name=feature_id,
        type="Loft",
        id=str(uuid.uuid4()),
        parameters={
            "profiles": params.profiles,
            "guide_curves": params.guide_curves,
            "start_tangent": params.start_tangent,
            "end_tangent": params.end_tangent,
        },
        properties={"created": datetime.now().isoformat(), "mock": True},
    )

    feature_key = feature.id or feature.name
    self._features[feature_key] = feature

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=feature,
        execution_time=self._delays["feature_operation"],
    )
create_part async
create_part(name: str | None = None, units: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]

Mock creating a new part.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
units str | None

The units value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    if not self._connected:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="Not connected to SolidWorks"
        )

    token = "mm"
    if units is not None and str(units).strip():
        token = _normalise_mock_unit_system(str(units))
        if token is None:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=(
                    f"Unrecognised units {units!r}. "
                    "Expected one of: mm, cm, m, in, ft."
                ),
            )

    await asyncio.sleep(self._delays["model_operation"])
    self._operation_count += 1

    model_id = name or f"Part{len(self._models) + 1}"
    model = SolidWorksModel(
        path=f"Mock://{model_id}.sldprt",
        name=f"{model_id}",
        type="Part",
        is_active=True,
        configuration="Default",
        properties={
            "created": datetime.now().isoformat(),
            "mock": True,
            "units": token,
            "template": template,
        },
    )

    self._current_model = model
    self._models[model.path] = model

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=model,
        execution_time=self._delays["model_operation"],
    )
create_reference_plane async
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False, axis: str | None = None, face_point: list[float] | None = None) -> AdapterResult[dict[str, Any]]

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

Refuses exactly what the live adapter refuses (the shared reference_plane_refusal in solidworks/features.py). On success, invents a sequential PlaneN name tracked on self._reference_planes and advances the shared mock feature-tree counter so features_before/features_after differ by exactly one, the same signal the live adapter derives from IFeatureManager::GetFeatureCount.

Parameters:

Name Type Description Default
reference str

Name of the reference plane.

required
offset float

Offset distance in millimetres. Defaults to 0.0.

0.0
angle float

Angle in degrees about axis. Defaults to 0.0.

0.0
flip bool

Reverse the offset direction. Defaults to False.

False
axis str | None

Axis to rotate about, for an angle.

None
face_point list[float] | None

Point on a flat face, in mm.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: The new plane's name and

AdapterResult[dict[str, Any]]

parameters, or error.

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

    Refuses exactly what the live adapter refuses (the shared
    ``reference_plane_refusal`` in ``solidworks/features.py``). On
    success, invents a sequential ``PlaneN`` name tracked on
    ``self._reference_planes`` and advances the shared mock feature-tree
    counter so ``features_before``/``features_after`` differ by exactly
    one, the same signal the live adapter derives from
    ``IFeatureManager::GetFeatureCount``.

    Args:
        reference (str): Name of the reference plane.
        offset (float): Offset distance in millimetres. Defaults to 0.0.
        angle (float): Angle in degrees about ``axis``. Defaults to 0.0.
        flip (bool): Reverse the offset direction. Defaults to False.
        axis (str | None): Axis to rotate about, for an angle.
        face_point (list[float] | None): Point on a flat face, in mm.

    Returns:
        AdapterResult[dict[str, Any]]: The new plane's name and
        parameters, or error.
    """
    from .solidworks.features import reference_plane_refusal

    refusal = reference_plane_refusal(reference, offset, angle, axis, face_point)
    if refusal is not None:
        return AdapterResult(status=AdapterResultStatus.ERROR, error=refusal)

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    before = self._feature_tree_count
    self._feature_tree_count += 1
    after = self._feature_tree_count

    self._reference_planes.append(f"Plane{len(self._reference_planes) + 1}")

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "name": self._reference_planes[-1],
            "reference": reference if face_point is None else None,
            "face_point": face_point,
            "offset": offset or None,
            "angle": angle or None,
            "axis": axis if angle else None,
            "flip": flip,
            "features_before": before,
            "features_after": after,
        },
        execution_time=self._delays["feature_operation"],
    )
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]]

Mock creating a reference point on the active part.

The mock has no geometry, so it cannot resolve a coordinate to an edge/face - it mirrors the live adapter's validation (unknown mode, the distance/percent XOR, range checks) and, on a valid request, bumps the feature counter the way InsertReferencePoint would.

Parameters:

Name Type Description Default
mode str

"along_curve" or "face_center".

required
x float

X of a point on the target entity, in millimetres.

required
y float

Y of a point on the target entity, in millimetres.

required
z float

Z of a point on the target entity, in millimetres.

required
distance float | None

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

None
percent float | None

For "along_curve", 0-100 of edge length.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

error matching the live adapter's refusals.

Source code in src/solidworks_mcp/adapters/mock_adapter.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]]:
    """Mock creating a reference point on the active part.

    The mock has no geometry, so it cannot resolve a coordinate to an
    edge/face - it mirrors the live adapter's *validation* (unknown mode,
    the distance/percent XOR, range checks) and, on a valid request,
    bumps the feature counter the way ``InsertReferencePoint`` would.

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

    Returns:
        AdapterResult[dict[str, Any]]: The mode and feature counts, or an
        error matching the live adapter's refusals.
    """
    key = str(mode or "").strip().lower()
    if key not in ("along_curve", "face_center"):
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(f"Unknown mode {mode!r}. Use 'along_curve' or 'face_center'."),
        )
    if key == "along_curve":
        if (distance is None) == (percent is None):
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error="along_curve needs exactly one of distance or percent",
            )
        if distance is not None and float(distance) <= 0.0:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error="distance must be positive",
            )
        if percent is not None and not 0.0 < float(percent) < 100.0:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error="percent must be between 0 and 100 (exclusive)",
            )

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1
    before = self._feature_tree_count
    self._feature_tree_count += 1
    self._reference_points.append(f"Point{len(self._reference_points) + 1}")

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "name": self._reference_points[-1],
            "mode": key,
            "at_mm": [x, y, z],
            "distance_mm": distance if key == "along_curve" else None,
            "percent": percent if key == "along_curve" else None,
            "features_before": before,
            "features_after": self._feature_tree_count,
        },
        execution_time=self._delays["feature_operation"],
    )
create_revolve async
create_revolve(params: RevolveParameters) -> AdapterResult[SolidWorksFeature]

Mock creating 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/mock_adapter.py
async def create_revolve(
    self, params: RevolveParameters
) -> AdapterResult[SolidWorksFeature]:
    """Mock creating a revolve feature.

    Args:
        params (RevolveParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    sketch = self._mock_named_sketch(
        getattr(params, "sketch_name", None), "revolve"
    )
    if isinstance(sketch, AdapterResult):
        return sketch
    axis = getattr(params, "axis_entity", None)
    if axis and axis not in self._axes:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Axis '{axis}' is not a reference axis in the "
            "model. Create one with create_axis.",
        )

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    feature_id = f"Boss-Revolve{len(self._features) + 1}"
    feature = SolidWorksFeature(
        name=feature_id,
        type="Revolve",
        id=str(uuid.uuid4()),
        parameters={
            "angle": params.angle,
            "reverse_direction": params.reverse_direction,
            "both_directions": params.both_directions,
            "thin_feature": params.thin_feature,
            "thin_thickness": params.thin_thickness,
            "sketch_name": sketch,
            "axis_entity": axis,
        },
        properties={"created": datetime.now().isoformat(), "mock": True},
    )

    feature_key = feature.id or feature.name
    self._features[feature_key] = feature

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=feature,
        execution_time=self._delays["feature_operation"],
    )
create_sketch async
create_sketch(plane: str) -> AdapterResult[dict[str, Any]]

Mock creating a sketch.

Parameters:

Name Type Description Default
plane str

The plane value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def create_sketch(self, plane: str) -> AdapterResult[dict[str, Any]]:  # type: ignore[override]
    """Mock creating a sketch.

    Args:
        plane (str): The plane value.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    if not self._current_model:
        # Legacy tests start sketching immediately after connect.
        await self.create_part()

    await asyncio.sleep(self._delays["sketch_operation"])
    self._operation_count += 1

    sketch_id = f"Sketch{len(self._sketches) + 1}"
    self._sketches[sketch_id] = plane
    self._current_sketch = sketch_id

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "id": sketch_id,
            "name": sketch_id,
            "sketch_name": sketch_id,
            "plane": plane,
        },
        execution_time=self._delays["sketch_operation"],
    )
create_standard_drawing async
create_standard_drawing(model_path: str, output_dir: str | None = None, title: str | None = None, subtitle: str | None = None, drawing_number: str | None = None, author: str = '', revision: str = 'A', company: str = '', drawn_date: str | None = None, notes: list[str] | None = None, include_isometric: bool = True, write_model_properties: bool = True, title_block_text_height_mm: float | None = None, include_bom: bool = False) -> AdapterResult[dict[str, Any]]

Mock standard A3 drawing: validates inputs, writes nothing to disk.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def create_standard_drawing(
    self,
    model_path: str,
    output_dir: str | None = None,
    title: str | None = None,
    subtitle: str | None = None,
    drawing_number: str | None = None,
    author: str = "",
    revision: str = "A",
    company: str = "",
    drawn_date: str | None = None,
    notes: list[str] | None = None,
    include_isometric: bool = True,
    write_model_properties: bool = True,
    title_block_text_height_mm: float | None = None,
    include_bom: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Mock standard A3 drawing: validates inputs, writes nothing to disk."""
    if not os.path.isfile(model_path):
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Model file not found: {model_path}",
        )
    stem = os.path.splitext(os.path.basename(model_path))[0]
    number = drawing_number or f"{stem.upper().replace(' ', '-')}-Rev{revision}-01"
    out_dir = output_dir or os.path.dirname(model_path)
    views = {
        "Drawing View1": {"role": "front", "caption": "FRONT VIEW"},
        "Drawing View2": {"role": "plan", "caption": "TOP VIEW"},
        "Drawing View3": {"role": "side", "caption": "SIDE VIEW"},
    }
    if include_isometric:
        views["Drawing View4"] = {"role": "iso", "caption": "ISOMETRIC VIEW"}
    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "scale": "1:1",
            "isometric_scale": "1:1" if include_isometric else None,
            "views": views,
            "hidden_lines_visible": {
                n: True for n, v in views.items() if v["role"] != "iso"
            },
            "bom": {"bom_type": "top_level_only", "table_box_mm": None}
            if include_bom
            else None,
            "overlap_check": {"overlaps_after": 0, "annotation_overlaps": []},
            "drawing_number": number,
            "drawing_path": os.path.join(out_dir, f"{number}.SLDDRW"),
            "pdf_path": os.path.join(out_dir, f"{number}.pdf"),
            "properties_written": {
                "model": {"Description": title or stem}
                if write_model_properties
                else {},
                "drawing": {"DrawnBy": author, "Revision": revision},
            },
            "notes": ["NOTES", *[n.upper() for n in (notes or [])]],
            "title_block": {
                "drawing number": {"found": True, "fits": True},
                "title": {"found": True, "fits": True},
            },
            "mock": True,
        },
    )
create_sweep async
create_sweep(params: SweepParameters) -> AdapterResult[SolidWorksFeature]

Mock creating 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/mock_adapter.py
async def create_sweep(
    self, params: SweepParameters
) -> AdapterResult[SolidWorksFeature]:
    """Mock creating a sweep feature.

    Args:
        params (SweepParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    feature_id = f"Boss-Sweep{len(self._features) + 1}"
    feature = SolidWorksFeature(
        name=feature_id,
        type="Sweep",
        id=str(uuid.uuid4()),
        parameters={
            "path": params.path,
            "twist_along_path": params.twist_along_path,
            "twist_angle": params.twist_angle,
        },
        properties={"created": datetime.now().isoformat(), "mock": True},
    )

    feature_key = feature.id or feature.name
    self._features[feature_key] = feature

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=feature,
        execution_time=self._delays["feature_operation"],
    )
create_technical_drawing async
create_technical_drawing(payload: Any = None) -> AdapterResult[dict[str, Any]]

Mock laying out the three standard views of a model.

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the model path and projection.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])
    data = payload if isinstance(payload, dict) else {}
    model_path = data.get("model_path") or data.get("model_file")
    if not model_path:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="A model path is required (model_path or model_file)",
        )

    third_angle = bool(data.get("third_angle", True))
    if str(data.get("projection", "")).lower() in {"first", "first_angle"}:
        third_angle = False

    before = len(self._drawing_views)
    added = [f"Drawing View{before + offset}" for offset in (1, 2, 3)]
    self._drawing_views.extend(added)
    self._operation_count += 1

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "views": added,
            "model_path": model_path,
            "projection": "third_angle" if third_angle else "first_angle",
            "views_before": before,
            "views_after": len(self._drawing_views),
        },
        execution_time=self._delays["model_operation"],
    )
delete_feature async
delete_feature(name: str) -> AdapterResult[dict[str, Any]]

Mock deleting a named feature 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]]: The result produced by the operation.

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])

    # _features is keyed by an internal id, so resolve by feature name.
    before = [f.name for f in self._features.values()]
    key = next((k for k, f in self._features.items() if f.name == name), None)
    if key is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Feature not found: {name}. "
                f"Available: {', '.join(before) or 'none'}"
            ),
        )

    del self._features[key]
    self._suppressed_features.discard(name)
    self._operation_count += 1
    after = [f.name for f in self._features.values()]

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "deleted": name,
            "removed_features": [n for n in before if n not in after],
            "features_before": len(before),
            "features_after": len(after),
        },
        execution_time=self._delays["model_operation"],
    )
disconnect async
disconnect() -> None

Mock disconnection from SolidWorks.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def disconnect(self) -> None:
    """Mock disconnection from SolidWorks.

    Returns:
        None: None.
    """
    self._connected = False
    self._current_model = None
    self._models.clear()
    self._features.clear()
    self._sketches.clear()
    self._current_sketch = None
    self._selection.clear()
exit_sketch async
exit_sketch() -> AdapterResult[None]

Mock exiting sketch mode.

Returns:

Type Description
AdapterResult[None]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def exit_sketch(self) -> AdapterResult[None]:
    """Mock exiting sketch mode.

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.WARNING, error="No active sketch to exit"
        )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._current_sketch = None

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=None,
        execution_time=self._delays["sketch_operation"] / 2,
    )
export_file async
export_file(file_path: str, format_type: str) -> AdapterResult[None]

Mock exporting 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/mock_adapter.py
async def export_file(
    self, file_path: str, format_type: str
) -> AdapterResult[None]:
    """Mock exporting 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.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    # Simulate export time based on format
    export_times = {
        "step": 2.0,
        "iges": 1.5,
        "stl": 1.0,
        "pdf": 0.5,
        "jpg": 0.3,
        "glb": 1.2,
        "gltf": 1.2,
    }

    format_lower = format_type.lower()
    delay = export_times.get(format_lower, 1.0)

    await asyncio.sleep(delay)
    self._operation_count += 1

    # Write a minimal placeholder file so callers that check existence get a valid result
    if format_lower == "stl":
        import pathlib

        out = pathlib.Path(file_path)
        out.parent.mkdir(parents=True, exist_ok=True)
        # Minimal ASCII STL — a single unit triangle (mock geometry placeholder)
        out.write_text(
            "solid mock\n"
            "  facet normal 0 0 1\n"
            "    outer loop\n"
            "      vertex 0 0 0\n"
            "      vertex 10 0 0\n"
            "      vertex 5 10 0\n"
            "    endloop\n"
            "  endfacet\n"
            "  facet normal 0 0 1\n"
            "    outer loop\n"
            "      vertex 0 0 0\n"
            "      vertex 10 0 0\n"
            "      vertex 5 0 10\n"
            "    endloop\n"
            "  endfacet\n"
            "endsolid mock\n",
            encoding="utf-8",
        )

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=None,
        execution_time=delay,
        metadata={"exported_format": format_type, "file_path": file_path},
    )
export_flat_pattern async
export_flat_pattern(file_path: str) -> AdapterResult[dict[str, Any]]

Mock flat-pattern export: validates the target, writes nothing.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def export_flat_pattern(
    self, file_path: str
) -> AdapterResult[dict[str, Any]]:
    """Mock flat-pattern export: validates the target, writes nothing."""
    guard = self._mock_doc_error({"Part"}, "export_flat_pattern")
    if guard is not None:
        return guard
    if not file_path.lower().endswith((".dxf", ".dwg")):
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="file_path must end in .dxf or .dwg",
        )
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={"file_path": file_path, "size_bytes": 0, "mock": True},
    )
export_image async
export_image(payload: dict) -> AdapterResult[dict]

Mock export of a PNG/JPG viewport screenshot.

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/mock_adapter.py
async def export_image(self, payload: dict) -> AdapterResult[dict]:
    """Mock export of a PNG/JPG viewport screenshot.

    Args:
        payload (dict): The payload value.

    Returns:
        AdapterResult[dict]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    import pathlib

    file_path = payload.get("file_path", "")
    width = int(payload.get("width", 1280))
    height = int(payload.get("height", 720))
    orientation = str(payload.get("view_orientation", "current"))

    await asyncio.sleep(0.3)
    self._operation_count += 1

    out = pathlib.Path(file_path)
    out.parent.mkdir(parents=True, exist_ok=True)

    # Write a valid 1×1 white PNG binary so UI image tags don't break
    _PNG_1X1_WHITE = (
        b"\x89PNG\r\n\x1a\n"  # PNG signature
        b"\x00\x00\x00\rIHDR"  # IHDR chunk length+type
        b"\x00\x00\x00\x01\x00\x00\x00\x01"  # 1x1
        b"\x08\x02\x00\x00\x00\x90wS\xde"  # 8-bit RGB + CRC
        b"\x00\x00\x00\x0cIDATx\x9cc\xf8\xff\xff\xff\x00\x05\xfe\x02\xfe\xdc\xcaY\xe7"  # IDAT
        b"\x00\x00\x00\x00IEND\xaeB`\x82"  # IEND
    )
    out.write_bytes(_PNG_1X1_WHITE)

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "file_path": file_path,
            "format": "PNG",
            "dimensions": f"{width}x{height}",
            "view": orientation,
        },
        execution_time=0.3,
        metadata={"mock": True, "orientation": orientation},
    )
get_application_info async
get_application_info() -> AdapterResult[dict[str, Any]]

Mock SolidWorks description: a fixed 2026 install in English.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def get_application_info(self) -> AdapterResult[dict[str, Any]]:
    """Mock SolidWorks description: a fixed 2026 install in English.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    if not self._connected:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="Not connected to SolidWorks"
        )
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "revision": "34.0.0",
            "language": "english",
            "templates": {
                kind: {"file_name": f"{kind}.{ext}", "exists": True}
                for kind, ext in (
                    ("part", "prtdot"),
                    ("assembly", "asmdot"),
                    ("drawing", "drwdot"),
                )
            },
        },
    )
get_custom_properties async
get_custom_properties(configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Mock reading custom properties.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def get_custom_properties(
    self, configuration: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Mock reading custom properties."""
    if self._current_model is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )
    store = getattr(self, "_custom_properties", {})
    props = store.get((self._mock_doc_key(), configuration or ""), {})
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "configuration": configuration or "",
            "properties": {
                k: {"value": v, "resolved": v} for k, v in props.items()
            },
        },
    )
get_dimension async
get_dimension(name: str) -> AdapterResult[dict[str, Any]]

Mock getting a dimension value; the mock's dimensions are lengths.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

AdapterResult[dict[str, Any]]: value in mm and units: "mm".

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def get_dimension(self, name: str) -> AdapterResult[dict[str, Any]]:
    """Mock getting a dimension value; the mock's dimensions are lengths.

    Args:
        name (str): The name value.

    Returns:
        AdapterResult[dict[str, Any]]: ``value`` in mm and ``units: "mm"``.
    """
    await asyncio.sleep(0.05)  # Very fast operation
    self._operation_count += 1

    if name in self._dimensions:
        return AdapterResult(
            status=AdapterResultStatus.SUCCESS,
            data={"value": self._dimensions[name], "units": "mm"},
            execution_time=0.05,
        )
    else:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Dimension '{name}' not found; list the names with "
                "list_model_dimensions"
            ),
        )
get_mass_properties async
get_mass_properties() -> AdapterResult[MassProperties]

Mock getting mass properties.

Returns:

Type Description
AdapterResult[MassProperties]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def get_mass_properties(self) -> AdapterResult[MassProperties]:
    """Mock getting mass properties.

    Returns:
        AdapterResult[MassProperties]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    # Generate realistic mock data
    properties = MassProperties(
        volume=random.uniform(1000, 100000),  # mm³
        surface_area=random.uniform(1000, 50000),  # mm²
        mass=random.uniform(0.1, 50.0),  # kg (assuming typical density)
        center_of_mass=[
            random.uniform(-100, 100),
            random.uniform(-100, 100),
            random.uniform(-100, 100),
        ],
        moments_of_inertia={
            "Ixx": random.uniform(1e6, 1e9),
            "Iyy": random.uniform(1e6, 1e9),
            "Izz": random.uniform(1e6, 1e9),
            "Ixy": random.uniform(-1e8, 1e8),
            "Ixz": random.uniform(-1e8, 1e8),
            "Iyz": random.uniform(-1e8, 1e8),
        },
    )

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=properties,
        execution_time=self._delays["feature_operation"],
    )
get_material async
get_material(configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Mock reading the active part material.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def get_material(
    self, configuration: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Mock reading the active part material."""
    guard = self._mock_doc_error({"Part"}, "get_material")
    if guard is not None:
        return guard
    assigned = getattr(self, "_materials", {}).get(self._mock_doc_key())
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "material": assigned["name"] if assigned else None,
            "database": assigned["database"] if assigned else None,
            "density_kg_m3": (
                self._MOCK_DENSITIES.get(assigned["name"]) if assigned else None
            ),
            "configuration": configuration,
        },
    )
get_model_geometry_summary async
get_model_geometry_summary() -> AdapterResult[dict[str, Any]]

Mock summary of the active part or assembly.

The mock has no geometry, so volume, bounding box and body count are None ("not determinable") rather than invented numbers a caller could mistake for a measurement. Component and mate counts are real: they come from insert_component and add_mate this session.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def get_model_geometry_summary(self) -> AdapterResult[dict[str, Any]]:
    """Mock summary of the active part or assembly.

    The mock has no geometry, so volume, bounding box and body count are
    ``None`` ("not determinable") rather than invented numbers a caller
    could mistake for a measurement. Component and mate counts are real:
    they come from ``insert_component`` and ``add_mate`` this session.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    guard = self._mock_doc_error({"Part", "Assembly"}, "get_model_geometry_summary")
    if guard is not None:
        return guard
    await asyncio.sleep(self._delays["model_operation"] / 2)
    self._operation_count += 1

    is_assembly = self._current_model.type == "Assembly"
    summary: dict[str, Any] = {
        "document_type": "assembly" if is_assembly else "part",
        "volume_mm3": None,
        "bounding_box_mm": None,
        "bounding_box_method": None,
        "solid_body_count": None,
    }
    if is_assembly:
        summary["component_count"] = len(self._components)
        summary["mate_count"] = len(self._mates)
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=summary,
        execution_time=self._delays["model_operation"] / 2,
    )
get_model_info async
get_model_info() -> AdapterResult[dict[str, Any]]

Mock metadata for the currently 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/mock_adapter.py
async def get_model_info(self) -> AdapterResult[dict[str, Any]]:
    """Mock metadata for the currently active model.

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="No active model",
        )

    await asyncio.sleep(self._delays["model_operation"] / 2)
    self._operation_count += 1

    model = self._current_model
    feature_count = len(self._features)
    info = {
        "title": model.name,
        "path": model.path,
        "type": model.type,
        "configuration": model.configuration or "Default",
        "is_dirty": False,
        "feature_count": feature_count,
        "rebuild_status": 0,
    }

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=info,
        execution_time=self._delays["model_operation"] / 2,
    )
get_selected_entities async
get_selected_entities() -> AdapterResult[list[dict[str, Any]]]

Mock UI selection — always reports one canned face and one canned edge.

There's no real UI to read a selection from in mock mode, so this returns a stable, plausible-shaped fixture rather than an empty list, so callers exercising this tool in tests get realistic field names.

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/mock_adapter.py
async def get_selected_entities(self) -> AdapterResult[list[dict[str, Any]]]:
    """Mock UI selection — always reports one canned face and one canned edge.

    There's no real UI to read a selection from in mock mode, so this
    returns a stable, plausible-shaped fixture rather than an empty list,
    so callers exercising this tool in tests get realistic field names.

    Returns:
        AdapterResult[list[dict[str, Any]]]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="No active model",
        )
    await asyncio.sleep(self._delays["feature_operation"] / 4)
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=[
            {
                "index": 1,
                "type": "FACE",
                "bounding_box_mm": {
                    "min": [0.0, 0.0, 0.0],
                    "max": [30.0, 30.0, 0.0],
                },
                "center_mm": [15.0, 15.0, 0.0],
                "area_mm2": 900.0,
                "normal": [0.0, 0.0, 1.0],
            },
            {
                "index": 2,
                "type": "EDGE",
                "start_mm": [0.0, 0.0, -15.0],
                "end_mm": [30.0, 0.0, -15.0],
                "length_mm": 30.0,
            },
        ],
        execution_time=self._delays["feature_operation"] / 4,
    )
health_check async
health_check() -> AdapterHealth

Get mock health status.

Returns:

Name Type Description
AdapterHealth AdapterHealth

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def health_check(self) -> AdapterHealth:
    """Get mock health status.

    Returns:
        AdapterHealth: The result produced by the operation.
    """
    error_count = int(self._metrics["errors_count"])
    success_count = int(
        self._metrics["operations_count"] - self._metrics["errors_count"]
    )
    return AdapterHealth(
        healthy=self._connected,
        last_check=datetime.now(),
        error_count=error_count,
        success_count=success_count,
        average_response_time=self._metrics["average_response_time"],
        connection_status="connected" if self._connected else "disconnected",
        metrics={
            "adapter_type": "mock",
            "operations_count": self._operation_count,
            "models_count": len(self._models),
            "features_count": len(self._features),
            "sketches_count": len(self._sketches),
        },
    )
insert_bom_table async
insert_bom_table(view_name: str, template_path: str | None = None, bom_type: str = 'top_level_only', x_mm: float | None = None, y_mm: float | None = None) -> AdapterResult[dict[str, Any]]

Mock inserting a BOM table.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def insert_bom_table(
    self,
    view_name: str,
    template_path: str | None = None,
    bom_type: str = "top_level_only",
    x_mm: float | None = None,
    y_mm: float | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Mock inserting a BOM table."""
    guard = self._mock_doc_error({"Drawing"}, "insert_bom_table")
    if guard is not None:
        return guard
    if bom_type not in {"top_level_only", "parts_only", "indented"}:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="bom_type must be top_level_only, parts_only or indented",
        )
    if view_name not in self._drawing_views:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"No view named {view_name!r}. Views: "
                f"{', '.join(self._drawing_views) or 'none'}"
            ),
        )
    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "view": view_name,
            "bom_type": bom_type,
            "template": template_path,
            "row_count": 2,
            "table_box_mm": [0.0, 0.0, 60.0, 15.0],
            "moved_onto_sheet": False,
        },
    )
insert_component async
insert_component(file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> AdapterResult[dict[str, Any]]

Mock inserting a component into the active assembly.

Records the component in self._components so repeated inserts accumulate and list_components reflects them.

Parameters:

Name Type Description Default
file_path str

Path to the part or sub-assembly to insert.

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]]: The result produced by the operation.

Source code in src/solidworks_mcp/adapters/mock_adapter.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]]:
    """Mock inserting a component into the active assembly.

    Records the component in ``self._components`` so repeated inserts
    accumulate and ``list_components`` reflects them.

    Args:
        file_path (str): Path to the part or sub-assembly to insert.
        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]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])
    self._operation_count += 1

    self._components.append(f"component-{len(self._components) + 1}")

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "component": self._components[-1],
            "file_path": file_path,
            "position": {"x": x, "y": y, "z": z},
            "components_before": len(self._components) - 1,
            "components_after": len(self._components),
        },
        execution_time=self._delays["model_operation"],
    )
insert_model_dimensions async
insert_model_dimensions(view_name: str | None = None, include_hole_wizard: bool = True) -> AdapterResult[dict[str, Any]]

Mock importing model dimensions: three per view, never twice.

Mirrors the live result shape (views, dimensions_added, unique_dimensions, skipped_pictorial_views, method, autodimension_status) and its refusals.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def insert_model_dimensions(
    self, view_name: str | None = None, include_hole_wizard: bool = True
) -> AdapterResult[dict[str, Any]]:
    """Mock importing model dimensions: three per view, never twice.

    Mirrors the live result shape (``views``, ``dimensions_added``,
    ``unique_dimensions``, ``skipped_pictorial_views``, ``method``,
    ``autodimension_status``) and its refusals.
    """
    await asyncio.sleep(self._delays["model_operation"] / 2)
    guard = self._mock_doc_error({"Drawing"}, "insert_model_dimensions")
    if guard is not None:
        return guard
    names = [view_name] if view_name else list(self._drawing_views)
    unknown = [n for n in names if n not in self._drawing_views]
    if unknown or not names:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"No view named {unknown[0]!r}. Views: "
                f"{', '.join(self._drawing_views) or 'none'}"
                if unknown
                else "No drawing views found to dimension; add views with "
                "create_technical_drawing or create_drawing_view"
            ),
        )
    if not hasattr(self, "_view_dimensions"):
        self._view_dimensions: dict[str, int] = {}
    per_view = []
    for name in names:
        before = self._view_dimensions.get(name, 0)
        after = before or 3
        self._view_dimensions[name] = after
        per_view.append(
            {
                "view": name,
                "dimensions_before": before,
                "dimensions_after": after,
                "dimensions_added": after - before,
                "duplicates_removed": 0,
            }
        )
    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "views": per_view,
            "dimensions_added": sum(v["dimensions_added"] for v in per_view),
            "unique_dimensions": sum(self._view_dimensions.values()),
            "skipped_pictorial_views": [],
            "method": "insert_model_annotations",
            "autodimension_status": None,
        },
    )
is_connected
is_connected() -> bool

Check if mock connection is active.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
def is_connected(self) -> bool:
    """Check if mock connection is active.

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

Mock listing the material library, with the live metadata.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def list_available_materials(
    self, search: str | None = None
) -> AdapterResult[list[dict[str, str]]]:
    """Mock listing the material library, with the live ``metadata``."""
    needle = (search or "").strip().lower()
    items = [
        dict(m)
        for m in self._MOCK_MATERIALS
        if not needle
        or needle in m["name"].lower()
        or needle in m["classification"].lower()
    ]
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=items,
        metadata={
            "folders": [self._MOCK_MATERIAL_FOLDER],
            "total": len(self._MOCK_MATERIALS),
        },
    )
list_components async
list_components() -> AdapterResult[list[str]]

Mock listing the top-level components of the active assembly.

Returns:

Type Description
AdapterResult[list[str]]

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

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

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"] / 2)
    self._operation_count += 1

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=list(self._components),
        execution_time=self._delays["model_operation"] / 2,
    )
list_configurations async
list_configurations() -> AdapterResult[list[str]]

Mock configuration listing 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/mock_adapter.py
async def list_configurations(self) -> AdapterResult[list[str]]:
    """Mock configuration listing for the active model.

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="No active model",
        )

    await asyncio.sleep(self._delays["model_operation"] / 2)
    self._operation_count += 1

    active = self._current_model.configuration or "Default"
    configs = [active] if active == "Default" else ["Default", active]

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=configs,
        execution_time=self._delays["model_operation"] / 2,
    )
list_drawing_views async
list_drawing_views() -> AdapterResult[list[str]]

Mock listing the views on the active drawing.

Returns:

Type Description
AdapterResult[list[str]]

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

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

    Returns:
        AdapterResult[list[str]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"] / 2)
    self._operation_count += 1

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=list(self._drawing_views),
        execution_time=self._delays["model_operation"] / 2,
    )
list_features async
list_features(include_suppressed: bool = False, max_assembly_depth: int = 2) -> AdapterResult[list[dict[str, Any]]]

Mock feature tree listing for the active model.

For an Assembly model, flattens in every configured component's features (see _assembly_components) alongside the document's own features, tagged with component/component_path the same way the real adapter does. Falls back to a small canned two-component fixture (plus one nested sub-assembly) when no components have been configured, mirroring the existing "seed realistic feature names" behavior for an empty Part.

Parameters:

Name Type Description Default
include_suppressed bool

The include suppressed value. Defaults to False.

False
max_assembly_depth int

Sub-assembly recursion budget. Ignored for non-Assembly models. Defaults to 2.

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/mock_adapter.py
async def list_features(
    self, include_suppressed: bool = False, max_assembly_depth: int = 2
) -> AdapterResult[list[dict[str, Any]]]:
    """Mock feature tree listing for the active model.

    For an Assembly model, flattens in every configured component's
    features (see ``_assembly_components``) alongside the document's own
    features, tagged with ``component``/``component_path`` the same way
    the real adapter does. Falls back to a small canned two-component
    fixture (plus one nested sub-assembly) when no components have been
    configured, mirroring the existing "seed realistic feature names"
    behavior for an empty Part.

    Args:
        include_suppressed (bool): The include suppressed value. Defaults to False.
        max_assembly_depth (int): Sub-assembly recursion budget. Ignored
            for non-Assembly models. Defaults to 2.

    Returns:
        AdapterResult[list[dict[str, Any]]]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="No active model",
        )

    await asyncio.sleep(self._delays["feature_operation"] / 2)
    self._operation_count += 1

    is_assembly = self._current_model.type == "Assembly"

    # Seed realistic feature names for empty mock state.
    if not self._features:
        seeded: list[dict[str, Any]] = [
            {
                "name": "Origin",
                "type": "OriginProfileFeature",
                "suppressed": False,
                "component": None,
                "component_path": None,
                "component_parent": None,
            },
            {
                "name": "Front Plane",
                "type": "RefPlane",
                "suppressed": False,
                "component": None,
                "component_path": None,
                "component_parent": None,
            },
            {
                "name": "Right Plane",
                "type": "RefPlane",
                "suppressed": False,
                "component": None,
                "component_path": None,
                "component_parent": None,
            },
            {
                "name": "Top Plane",
                "type": "RefPlane",
                "suppressed": False,
                "component": None,
                "component_path": None,
                "component_parent": None,
            },
            {
                "name": "Sketch1",
                "type": "ProfileFeature",
                "suppressed": False,
                "component": None,
                "component_path": None,
                "component_parent": None,
            },
        ]
        if is_assembly:
            components = self._assembly_components or _DEFAULT_ASSEMBLY_COMPONENTS
            seeded.extend(
                self._flatten_assembly_components(
                    components, include_suppressed, max_assembly_depth - 1, None
                )
            )
        return AdapterResult(
            status=AdapterResultStatus.SUCCESS,
            data=seeded,
            execution_time=self._delays["feature_operation"] / 2,
        )

    feature_rows: list[dict[str, Any]] = []
    for i, feature in enumerate(self._features.values()):
        row = {
            "name": feature.name,
            "type": feature.type,
            "suppressed": bool((feature.properties or {}).get("suppressed", False)),
            "position": i,
            "component": None,
            "component_path": None,
            "component_parent": None,
        }
        if include_suppressed or not row["suppressed"]:
            feature_rows.append(row)

    if is_assembly:
        components = self._assembly_components or _DEFAULT_ASSEMBLY_COMPONENTS
        feature_rows.extend(
            self._flatten_assembly_components(
                components,
                include_suppressed,
                max_assembly_depth - 1,
                None,
            )
        )

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=feature_rows,
        execution_time=self._delays["feature_operation"] / 2,
    )
list_model_dimensions async
list_model_dimensions(feature_name: str | None = None) -> AdapterResult[list[dict[str, Any]]]

Mock listing model dimensions from the tracked dimension table.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def list_model_dimensions(
    self, feature_name: str | None = None
) -> AdapterResult[list[dict[str, Any]]]:
    """Mock listing model dimensions from the tracked dimension table."""
    await asyncio.sleep(self._delays["model_operation"] / 2)
    guard = self._mock_doc_error({"Part", "Assembly"}, "list_model_dimensions")
    if guard is not None:
        return guard
    self._operation_count += 1
    dims = []
    for full_name, value in self._dimensions.items():
        feature = full_name.split("@", 1)[1] if "@" in full_name else ""
        if feature_name and feature.lower() != feature_name.lower():
            continue
        dims.append(
            {
                "full_name": full_name,
                "feature": feature,
                "value": value,
                "system_value": value / 1000.0,
                "read_only": False,
            }
        )
    if feature_name and not dims:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"No dimensions found on feature {feature_name!r}",
        )
    return AdapterResult(status=AdapterResultStatus.SUCCESS, data=dims)
list_open_documents async
list_open_documents() -> AdapterResult[list[dict[str, Any]]]

Mock enumerating the currently open documents.

Returns every model the mock has created or opened this session, with is_active reflecting self._current_model.

Returns:

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

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

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

operation.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def list_open_documents(self) -> AdapterResult[list[dict[str, Any]]]:
    """Mock enumerating the currently open documents.

    Returns every model the mock has created or opened this session, with
    ``is_active`` reflecting ``self._current_model``.

    Returns:
        AdapterResult[list[dict[str, Any]]]: The result produced by the
        operation.
    """
    await asyncio.sleep(0.05)
    if not self._connected:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="Not connected to SolidWorks"
        )

    active_path = (
        self._current_model.path if self._current_model is not None else None
    )
    docs = [
        {
            "title": model.name,
            "path": model.path,
            "type": model.type,
            "is_active": model.path == active_path,
        }
        for model in self._models.values()
    ]
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS, data=docs, execution_time=0.05
    )
measure_entities async
measure_entities(entities: list[str]) -> AdapterResult[dict[str, Any]]

Mock measuring: nominal values with the live adapter's validation.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def measure_entities(
    self, entities: list[str]
) -> AdapterResult[dict[str, Any]]:
    """Mock measuring: nominal values with the live adapter's validation."""
    await asyncio.sleep(self._delays["model_operation"] / 2)
    guard = self._mock_doc_error({"Part", "Assembly"}, "measure_entities")
    if guard is not None:
        return guard
    if not entities or len(entities) > 2:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="measure_entities takes one or two entity specs",
        )
    self._operation_count += 1
    data: dict[str, Any] = {"selected": list(entities)}
    if len(entities) == 1:
        data.update({"area_m2": 0.0025, "perimeter_m": 0.2})
    else:
        data.update({"distance_m": 0.05, "angle_rad": 0.0, "is_parallel": True})
    return AdapterResult(status=AdapterResultStatus.SUCCESS, data=data)
mirror_feature async
mirror_feature(features: list[str], mirror_plane: str, merge: bool = True, mirror_bodies: bool = True) -> AdapterResult[dict[str, Any]]

Mock mirroring solid bodies or features about a plane.

The mock has no geometry engine, so it cannot measure a real volume change - it mirrors the live adapter's refusals instead of fabricating a result it cannot know. An empty source list or plane name is rejected outright (matching _mirror_feature_impl in solidworks/features.py verbatim), and a source or plane name that was never created in this session is rejected the same way _select_named_feature / _select_reference_entity would fail to select it there.

On success, the tracked self._mirror_volume figure (seeded at the live-measured 1819569.1 mm^3 wing volume) is doubled, matching the ~2.0 ratio a correct mirror produces (measured live: 1.998528 for a lofted wing, exactly 2.0 for a boss whose sketch sits on the 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

AdapterResult[dict[str, Any]]

and volume before/after, or error.

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

    The mock has no geometry engine, so it cannot measure a real volume
    change - it mirrors the live adapter's refusals instead of
    fabricating a result it cannot know. An empty source list or plane
    name is rejected outright (matching ``_mirror_feature_impl`` in
    ``solidworks/features.py`` verbatim), and a source or plane name
    that was never created in this session is rejected the same way
    ``_select_named_feature`` / ``_select_reference_entity`` would fail
    to select it there.

    On success, the tracked ``self._mirror_volume`` figure (seeded at
    the live-measured 1819569.1 mm^3 wing volume) is doubled, matching
    the ~2.0 ratio a correct mirror produces (measured live: 1.998528
    for a lofted wing, exactly 2.0 for a boss whose sketch sits on the
    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.
    """
    names = [n for n in (features or []) if n]
    if not names:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="mirror_feature requires at least one body or feature name",
        )
    if not mirror_plane:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="mirror_feature requires a mirror plane name",
        )

    known_sources = {feature.name for feature in self._features.values()} | set(
        self._components
    )
    for name in names:
        if name not in known_sources:
            kind = "body" if mirror_bodies else "feature"
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=f"Failed to select {kind} to mirror: {name}",
            )

    known_planes = self._BUILTIN_PLANES | set(self._reference_planes)
    if mirror_plane not in known_planes:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Failed to select mirror plane: {mirror_plane}",
        )

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    volume_before = self._mirror_volume
    volume_after = volume_before * 2
    self._mirror_volume = volume_after

    self._feature_tree_count += 1
    feature_name = f"Mirror{self._feature_tree_count}"

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "name": feature_name,
            "mirrored": names,
            "mirror_plane": mirror_plane,
            "merge": bool(merge),
            "mirror_bodies": bool(mirror_bodies),
            "volume_before": volume_before,
            "volume_after": volume_after,
            "volume_change": volume_after - volume_before,
            "volume_ratio": round(volume_after / volume_before, 6),
        },
        execution_time=self._delays["feature_operation"],
    )
open_model async
open_model(file_path: str) -> AdapterResult[SolidWorksModel]

Mock opening a SolidWorks model.

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.

Raises:

Type Description
SolidWorksOperationError

Simulated adapter failure.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def open_model(self, file_path: str) -> AdapterResult[SolidWorksModel]:
    """Mock opening a SolidWorks model.

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

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

    Raises:
        SolidWorksOperationError: Simulated adapter failure.
    """
    if not self._connected:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="Not connected to SolidWorks"
        )

    if self._simulate_errors:
        raise SolidWorksOperationError("Simulated adapter failure")

    await asyncio.sleep(self._delays["model_operation"])
    self._operation_count += 1

    # Determine model type from file extension
    file_path_lower = file_path.lower()
    if file_path_lower.endswith(".sldprt"):
        model_type = "Part"
    elif file_path_lower.endswith(".sldasm"):
        model_type = "Assembly"
    elif file_path_lower.endswith(".slddrw"):
        model_type = "Drawing"
    else:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Unsupported file type: {file_path}",
        )

    # Create mock model
    model_name = file_path.split("/")[-1].split("\\")[-1]
    model = SolidWorksModel(
        path=file_path,
        name=model_name,
        type=model_type,
        is_active=True,
        configuration="Default",
        properties={
            "created": datetime.now().isoformat(),
            "model_id": model_name or f"Part{len(self._models) + 1}",
            "file_size": random.randint(100000, 5000000),
        },
    )

    self._current_model = model
    self._models[file_path] = model

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=model,
        execution_time=self._delays["model_operation"],
    )
pack_and_go_assembly async
pack_and_go_assembly(source_path: str, target_dir: str) -> AdapterResult[dict]

Mock Pack-and-Go: simulate copying an assembly to a target directory.

Parameters:

Name Type Description Default
source_path str

Path to the source .sldasm file.

required
target_dir str

Directory to copy files into.

required

Returns:

Type Description
AdapterResult[dict]

AdapterResult[dict]: Simulated pack-and-go result.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def pack_and_go_assembly(
    self,
    source_path: str,
    target_dir: str,
) -> AdapterResult[dict]:
    """Mock Pack-and-Go: simulate copying an assembly to a target directory.

    Args:
        source_path (str): Path to the source .sldasm file.
        target_dir (str): Directory to copy files into.

    Returns:
        AdapterResult[dict]: Simulated pack-and-go result.
    """
    import pathlib

    await asyncio.sleep(0.05)
    self._operation_count += 1

    source = pathlib.Path(source_path)
    out_dir = pathlib.Path(target_dir)
    mock_parts = [f"MockPart{i}.SLDPRT" for i in range(1, 3)]
    source_files = [str(source)] + [str(source.parent / p) for p in mock_parts]
    copied_files = [str(out_dir / source.name)] + [
        str(out_dir / p) for p in mock_parts
    ]
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "source_assembly": str(source),
            "target_dir": str(out_dir),
            "copied_files": copied_files,
            "source_files": source_files,
            "unsaved_changes": [],
        },
        execution_time=0.05,
        metadata={"mock": True},
    )
pattern_circular async
pattern_circular(features: list[str], axis: str, count: int, angle: float = 360.0, equal_spacing: bool = True) -> AdapterResult[dict[str, Any]]

Mock patterning features around an axis.

The mock has no geometry engine, so it cannot measure a real volume change - it mirrors the live adapter's refusals instead of fabricating a result it cannot know (matching _pattern_circular_impl in solidworks/features.py verbatim for the three argument checks below). An axis name that was never created via create_axis in this session is rejected the same way SelectByID2 would fail to select it there.

On success, the tracked self._pattern_volume figure (seeded at the live-measured 48431.5 mm^3 hub+blade volume) grows by _PATTERN_BLADE_VOLUME * (count - 1), the live-derived per-instance volume, so volume_before/volume_after/volume_ratio stay self-consistent and scale with count roughly the way adding more blades to the hub would - reproducing the live 48431.5 -> 75916.4 mm^3 measurement exactly for count=4.

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]]: The pattern's name, inputs and

AdapterResult[dict[str, Any]]

volume before/after, or error.

Source code in src/solidworks_mcp/adapters/mock_adapter.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]]:
    """Mock patterning features around an axis.

    The mock has no geometry engine, so it cannot measure a real volume
    change - it mirrors the live adapter's refusals instead of
    fabricating a result it cannot know (matching
    ``_pattern_circular_impl`` in ``solidworks/features.py`` verbatim
    for the three argument checks below). An axis name that was never
    created via ``create_axis`` in this session is rejected the same
    way ``SelectByID2`` would fail to select it there.

    On success, the tracked ``self._pattern_volume`` figure (seeded at
    the live-measured 48431.5 mm^3 hub+blade volume) grows by
    ``_PATTERN_BLADE_VOLUME * (count - 1)``, the live-derived
    per-instance volume, so volume_before/volume_after/volume_ratio
    stay self-consistent and scale with ``count`` roughly the way
    adding more blades to the hub would - reproducing the live
    48431.5 -> 75916.4 mm^3 measurement exactly for ``count=4``.

    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]]: The pattern's name, inputs and
        volume before/after, or error.
    """
    names = [n for n in (features or []) if n]
    if not names:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="pattern_circular requires at least one feature name",
        )
    if not axis:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="pattern_circular requires an axis name to rotate about",
        )
    if int(count) < 2:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"pattern_circular needs a count of at least 2 (got {count}); "
                "a pattern of one is just the original feature"
            ),
        )

    known_axes = set(self._axes)
    if axis not in known_axes:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Failed to select axis '{axis}'. Create one with "
                "create_axis first, and pass the name it returns."
            ),
        )

    await asyncio.sleep(self._delays["feature_operation"])
    self._operation_count += 1

    volume_before = self._pattern_volume
    volume_after = volume_before + self._PATTERN_BLADE_VOLUME * (int(count) - 1)
    self._pattern_volume = volume_after

    self._feature_tree_count += 1
    pattern_name = f"CirPattern{self._feature_tree_count}"

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "name": pattern_name,
            "patterned": names,
            "axis": axis,
            "count": int(count),
            "angle": float(angle),
            "equal_spacing": bool(equal_spacing),
            "volume_before": volume_before,
            "volume_after": volume_after,
            "volume_change": volume_after - volume_before,
            "volume_ratio": round(volume_after / volume_before, 6),
        },
        execution_time=self._delays["feature_operation"],
    )
rebuild_model async
rebuild_model(top_level_only: bool = False) -> AdapterResult[dict[str, Any]]

Mock rebuild with the real adapter's diagnostics contract.

Clean by default; issues placed in injected_rebuild_issues are explained with the same rebuild_diagnostics logic the real adapter uses, so ERROR-with-data / warnings-only behave identically.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def rebuild_model(
    self, top_level_only: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Mock rebuild with the real adapter's diagnostics contract.

    Clean by default; issues placed in ``injected_rebuild_issues`` are
    explained with the same ``rebuild_diagnostics`` logic the real
    adapter uses, so ERROR-with-data / warnings-only behave identically.
    """
    from .solidworks.rebuild_diagnostics import explain, summarize

    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )
    await asyncio.sleep(self._delays["model_operation"] / 4)
    entries = [explain(i) for i in self.injected_rebuild_issues]
    error_count, warning_count, summary = summarize(entries)
    data = {
        "rebuilt": True,
        "top_level_only": top_level_only,
        "errors": entries,
        "error_count": error_count,
        "warning_count": warning_count,
        "summary": summary,
    }
    return AdapterResult(
        status=(
            AdapterResultStatus.ERROR
            if error_count
            else AdapterResultStatus.SUCCESS
        ),
        data=data,
        error=summary if error_count else None,
        execution_time=self._delays["model_operation"] / 4,
    )
rename_feature async
rename_feature(old_name: str, new_name: str) -> AdapterResult[dict[str, Any]]

Mock renaming a named feature in the active model.

Mirrors the real adapter: an empty target name, an unknown feature, or a target name already in use are all errors; renaming to the current name is a no-op success.

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 result produced by the operation.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def rename_feature(
    self, old_name: str, new_name: str
) -> AdapterResult[dict[str, Any]]:
    """Mock renaming a named feature in the active model.

    Mirrors the real adapter: an empty target name, an unknown feature, or
    a target name already in use are all errors; renaming to the current
    name is a no-op success.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])

    new = new_name.split("@", 1)[0].strip()
    if not new:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="new_name must not be empty"
        )

    if old_name in self._sketches and new != old_name:
        return self._mock_rename_sketch(old_name, new)
    key = next((k for k, f in self._features.items() if f.name == old_name), None)
    if key is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Feature not found: {old_name}",
        )
    if new == old_name:
        return AdapterResult(
            status=AdapterResultStatus.SUCCESS,
            data={
                "renamed": False,
                "old_name": old_name,
                "new_name": new,
                "reason": "old and new names are the same",
            },
            execution_time=self._delays["model_operation"],
        )
    if any(f.name == new for f in self._features.values()):
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Cannot rename to '{new}': a feature with that name already exists"
            ),
        )

    self._features[key].name = new
    if old_name in self._suppressed_features:
        self._suppressed_features.discard(old_name)
        self._suppressed_features.add(new)
    self._operation_count += 1

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={"renamed": True, "old_name": old_name, "new_name": new},
        execution_time=self._delays["model_operation"],
    )
save_body_as_part async
save_body_as_part(body_name: str, file_path: str) -> AdapterResult[dict[str, Any]]

Mock extracting a solid body from the active part to a new file.

The mock has no bodies, so it cannot validate body_name against real geometry - it mirrors the live adapter's other refusals (no model, not a part, blank arguments, missing parent directory) and, on a valid request, writes an empty placeholder file so callers and tests can observe the side effect.

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 a

AdapterResult[dict[str, Any]]

single-element body list, or an error.

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

    The mock has no bodies, so it cannot validate ``body_name`` against
    real geometry - it mirrors the live adapter's other refusals (no
    model, not a part, blank arguments, missing parent directory) and, on
    a valid request, writes an empty placeholder file so callers and
    tests can observe the side effect.

    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 a
        single-element body list, or an error.
    """
    import os as _os

    await asyncio.sleep(self._delays["model_operation"])

    model = self._current_model
    if model is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )
    if getattr(model, "type", None) != "Part":
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="save_body_as_part requires an active part document",
        )
    if not str(body_name or "").strip():
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="body_name is required"
        )
    target = str(file_path or "").strip()
    if not target:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="file_path is required"
        )
    target = _os.path.abspath(target)
    parent = _os.path.dirname(target)
    if not _os.path.isdir(parent):
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Parent directory does not exist: {parent}",
        )

    with open(target, "w", encoding="utf-8"):
        pass
    self._operation_count += 1

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "body": body_name,
            "file_path": target,
            "feature": f"Save Bodies{self._operation_count}",
            "solid_bodies": [body_name],
        },
        execution_time=self._delays["model_operation"],
    )
save_file async
save_file(file_path: str | None = None) -> AdapterResult[dict[str, Any]]

Legacy compatibility save operation for tests.

Parameters:

Name Type Description Default
file_path str | None

Path to the target file. Defaults to None.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def save_file(
    self, file_path: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Legacy compatibility save operation for tests.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="No active model",
        )
    await asyncio.sleep(0.02)
    self._operation_count += 1
    resolved_path = file_path or self._current_model.path
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={"file_path": resolved_path, "saved": True},
        execution_time=0.02,
    )
select_face_edges async
select_face_edges(point: list[float] | None = None, side: str | None = None, plane: str | None = None, edge_type: str = 'all', append: bool = False) -> AdapterResult[dict[str, Any]]

Mock face-edge multi-selection on a canned 10 mm block.

Mirrors the real adapter's contract: the same input validation, the same payload shape, and the same failure cases. The block spans 0..10 mm on every axis; the +Z/-Z faces carry a 2 mm radius hole rim once any circle has been sketched, so edge_type="circular" behaves like a real drilled part. Front Plane (z = 0) is the only reference plane with a face on it.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def select_face_edges(
    self,
    point: list[float] | None = None,
    side: str | None = None,
    plane: str | None = None,
    edge_type: str = "all",
    append: bool = False,
) -> AdapterResult[dict[str, Any]]:
    """Mock face-edge multi-selection on a canned 10 mm block.

    Mirrors the real adapter's contract: the same input validation, the
    same payload shape, and the same failure cases. The block spans
    0..10 mm on every axis; the +Z/-Z faces carry a 2 mm radius hole rim
    once any circle has been sketched, so ``edge_type="circular"``
    behaves like a real drilled part. ``Front Plane`` (z = 0) is the only
    reference plane with a face on it.
    """
    from .solidworks.face_selection import side_vector, validate_face_query

    problem = validate_face_query(point, side, plane, edge_type)
    if problem:
        return AdapterResult(status=AdapterResultStatus.ERROR, error=problem)
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )
    if getattr(self._current_model, "type", "Part") != "Part":
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="select_face_edges requires an active part document.",
        )
    await asyncio.sleep(self._delays["feature_operation"] / 4)

    if point is not None:
        normal = self._mock_face_at(point)
        if normal is None:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=f"No face found at point {list(point)} mm.",
            )
    elif side is not None:
        normal = side_vector(side)
    elif plane == "Front Plane":
        normal = (0.0, 0.0, -1.0)
    else:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"No body face lies on {plane!r}.",
        )

    center = [5.0 + 5.0 * c for c in normal]
    has_hole = any(e.startswith("Circle") for e in self._sketch_entity_ids)
    edges: list[dict[str, Any]] = [
        {"curve": "linear", "length_mm": 10.0, "face_index": 0} for _ in range(4)
    ]
    if has_hole and normal[2] != 0:
        edges.append(
            {
                "curve": "circular",
                "center_mm": [5.0, 5.0, center[2]],
                "axis": [0.0, 0.0, 1.0],
                "radius_mm": 2.0,
                "face_index": 0,
            }
        )
    edges = [e for e in edges if edge_type == "all" or e["curve"] == edge_type]
    if not edges:
        kind = "" if edge_type == "all" else f"{edge_type} "
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"The selected face has no {kind}edges (face centre {center} mm).",
        )

    if not append:
        self._selection.clear()
    self._selection.extend(f"Edge{i}" for i in range(len(edges)))
    face = {
        "index": 0,
        "center_mm": center,
        "normal": [float(c) for c in normal],
        "area_mm2": 100.0,
        "planar": True,
    }
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "face": face,
            "faces": [face],
            "edge_type": edge_type,
            "edges": edges,
            "selected_edges": len(edges),
            "selection_count": len(self._selection),
        },
        execution_time=self._delays["feature_operation"] / 4,
    )
select_feature async
select_feature(feature_name: str, append: bool = False) -> AdapterResult[dict[str, Any]]

Mock feature selection, mirroring the real adapter's contract.

Succeeds only for names the mock is tracking for the active model (created features, sketches, default planes); anything else is an ERROR naming the feature - never SUCCESS with selected: False.

Parameters:

Name Type Description Default
feature_name str

The feature name, optionally @doc qualified.

required
append bool

Add to the current selection. Defaults to False.

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def select_feature(
    self, feature_name: str, append: bool = False
) -> AdapterResult[dict[str, Any]]:
    """Mock feature selection, mirroring the real adapter's contract.

    Succeeds only for names the mock is tracking for the active model
    (created features, sketches, default planes); anything else is an
    ERROR naming the feature - never SUCCESS with ``selected: False``.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    if not self._current_model:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="No active model",
        )
    await asyncio.sleep(self._delays["feature_operation"] / 4)
    self._operation_count += 1

    bare = feature_name.split("@", 1)[0].strip()
    known = (
        {f.name for f in self._features.values()}
        | set(self._sketches)
        | set(self._DEFAULT_SELECTABLE)
    )
    if bare not in known:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Feature not found or could not be selected: {feature_name}",
        )
    if not append:
        self._selection.clear()
    if bare not in self._selection:
        self._selection.append(bare)
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "selected": True,
            "feature_name": feature_name,
            "selected_name": bare,
            "entity_type": "mock",
            "selection_count": len(self._selection),
        },
        execution_time=self._delays["feature_operation"] / 4,
    )
set_component_state async
set_component_state(component: str, fixed: bool | None = None, flexible: bool | None = None) -> AdapterResult[dict[str, Any]]

Mock fixing, floating and flexing a component.

Tracks each component's state on self._component_states.

Parameters:

Name Type Description Default
component str

Instance name.

required
fixed bool | None

True fixes it, False floats it.

None
flexible bool | None

True flexible, False rigid.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def set_component_state(
    self,
    component: str,
    fixed: bool | None = None,
    flexible: bool | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Mock fixing, floating and flexing a component.

    Tracks each component's state on ``self._component_states``.

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

    Returns:
        AdapterResult[dict[str, Any]]: The state before and after.
    """
    if fixed is None and flexible is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="Nothing to change: give fixed, flexible or both.",
        )
    states = self._component_states
    before = dict(states.get(component, {"fixed": False, "flexible": False}))
    after = dict(before)
    if fixed is not None:
        after["fixed"] = fixed
    if flexible is not None:
        after["flexible"] = flexible
    states[component] = after
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={"component": component, "before": before, "after": after},
    )
set_custom_property async
set_custom_property(name: str, value: str, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Mock writing one custom property.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def set_custom_property(
    self, name: str, value: str, configuration: str | None = None
) -> AdapterResult[dict[str, Any]]:
    """Mock writing one custom property."""
    if self._current_model is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )
    if not name.strip():
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="name is required"
        )
    if not hasattr(self, "_custom_properties"):
        self._custom_properties: dict[tuple[str, str], dict[str, str]] = {}
    key = (self._mock_doc_key(), configuration or "")
    self._custom_properties.setdefault(key, {})[name] = str(value)
    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "name": name,
            "value": str(value),
            "resolved": str(value),
            "configuration": configuration or "",
        },
    )
set_dimension async
set_dimension(name: str, value: float) -> AdapterResult[None]

Mock setting a dimension value.

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/mock_adapter.py
async def set_dimension(self, name: str, value: float) -> AdapterResult[None]:
    """Mock setting a dimension value.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    await asyncio.sleep(0.1)  # Fast operation
    self._operation_count += 1

    self._dimensions[name] = value

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS, data=None, execution_time=0.1
    )
set_material async
set_material(material_name: str, database: str | None = None, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Mock assigning a material; unknown names fail as they do live.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def set_material(
    self,
    material_name: str,
    database: str | None = None,
    configuration: str | None = None,
) -> AdapterResult[dict[str, Any]]:
    """Mock assigning a material; unknown names fail as they do live."""
    guard = self._mock_doc_error({"Part"}, "set_material")
    if guard is not None:
        return guard
    wanted = material_name.strip().lower()
    match = next(
        (m for m in self._MOCK_MATERIALS if m["name"].lower() == wanted), None
    )
    if match is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Material {material_name!r} not found in "
                f"{database or 'SOLIDWORKS Materials'!r}; use "
                "list_available_materials for the exact name and library."
            ),
        )
    if not hasattr(self, "_materials"):
        self._materials: dict[str, dict[str, str]] = {}
    self._materials[self._mock_doc_key()] = match
    self._operation_count += 1
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "material": match["name"],
            "database": database or "SOLIDWORKS Materials",
            "configuration": configuration,
        },
    )
set_sheet_scale async
set_sheet_scale(numerator: float, denominator: float) -> AdapterResult[dict[str, Any]]

Mock setting the sheet scale.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def set_sheet_scale(
    self, numerator: float, denominator: float
) -> AdapterResult[dict[str, Any]]:
    """Mock setting the sheet scale."""
    guard = self._mock_doc_error({"Drawing"}, "set_sheet_scale")
    if guard is not None:
        return guard
    if numerator <= 0 or denominator <= 0:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="Scale values must be positive"
        )
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "sheet": "Sheet1",
            "scale": f"{numerator:g}:{denominator:g}",
            "requested": f"{numerator:g}:{denominator:g}",
        },
    )
set_units async
set_units(unit_system: str) -> AdapterResult[dict[str, Any]]

Mock setting the active document's linear unit system.

Mirrors the real adapter: an unrecognised token is an error, and the applied token is recorded on the current model's properties.

Parameters:

Name Type Description Default
unit_system str

One of mm, cm, m, in, ft (aliases such as inch / millimeters accepted).

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Mirrors the real adapter: an unrecognised token is an error, and the
    applied token is recorded on the current model's ``properties``.

    Args:
        unit_system (str): One of ``mm``, ``cm``, ``m``, ``in``, ``ft``
            (aliases such as ``inch`` / ``millimeters`` accepted).

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(0.1)

    token = _normalise_mock_unit_system(unit_system)
    if token is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Unrecognised unit system {unit_system!r}. "
                "Expected one of: mm, cm, m, in, ft."
            ),
        )
    if self._current_model is None:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    self._operation_count += 1
    props = dict(self._current_model.properties or {})
    props["units"] = token
    self._current_model.properties = props

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={"unit_system": token, "verified": True},
        execution_time=0.1,
    )
sketch_circular_pattern async
sketch_circular_pattern(entities: list[str], angle: float, count: int) -> AdapterResult[str]

Mock creating a circular sketch pattern around the sketch origin.

Parameters:

Name Type Description Default
entities list[str]

Seed entity IDs.

required
angle float

Total swept angle in degrees.

required
count int

Total number of instances (including the seed).

required

Returns:

Type Description
AdapterResult[str]

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

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

    Args:
        entities (list[str]): Seed entity IDs.
        angle (float): Total swept angle in degrees.
        count (int): Total number of instances (including the seed).

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )
    if not entities:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="sketch_circular_pattern requires at least one entity",
        )
    if count < 2:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="sketch_circular_pattern requires count >= 2",
        )
    if angle <= 0:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="sketch_circular_pattern requires angle > 0",
        )
    for ent in entities:
        if ent not in self._sketch_entity_ids:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=(
                    f"Unknown sketch entity '{ent}'. Use IDs returned by "
                    "add_line/add_arc/add_circle/add_spline/add_centerline."
                ),
            )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    pattern_id = f"CircularPattern_{count}x{angle}deg_{random.randint(1000, 9999)}"
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=pattern_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
sketch_linear_pattern async
sketch_linear_pattern(entities: list[str], direction_x: float, direction_y: float, spacing: float, count: int) -> AdapterResult[str]

Mock creating a linear sketch pattern.

Mirrors the real adapter's validation rules — empty entities, count < 2, non-positive spacing, and a zero direction vector each produce a clear error without "creating" a pattern.

Parameters:

Name Type Description Default
entities list[str]

Seed entity IDs.

required
direction_x float

Pattern direction X component.

required
direction_y float

Pattern direction Y component.

required
spacing float

Distance between instances in millimetres.

required
count int

Total number of instances (including the seed).

required

Returns:

Type Description
AdapterResult[str]

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

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

    Mirrors the real adapter's validation rules — empty entities,
    count < 2, non-positive spacing, and a zero direction vector each
    produce a clear error without "creating" a pattern.

    Args:
        entities (list[str]): Seed entity IDs.
        direction_x (float): Pattern direction X component.
        direction_y (float): Pattern direction Y component.
        spacing (float): Distance between instances in millimetres.
        count (int): Total number of instances (including the seed).

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )
    if not entities:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="sketch_linear_pattern requires at least one entity",
        )
    if count < 2:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="sketch_linear_pattern requires count >= 2",
        )
    if spacing <= 0:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="sketch_linear_pattern requires spacing > 0",
        )
    if math.hypot(direction_x, direction_y) < 1e-9:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=("sketch_linear_pattern requires a non-zero direction vector"),
        )
    for ent in entities:
        if ent not in self._sketch_entity_ids:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=(
                    f"Unknown sketch entity '{ent}'. Use IDs returned by "
                    "add_line/add_arc/add_circle/add_spline/add_centerline."
                ),
            )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    pattern_id = f"LinearPattern_{count}x{spacing}_{random.randint(1000, 9999)}"
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=pattern_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
sketch_mirror async
sketch_mirror(entities: list[str], mirror_line: str) -> AdapterResult[str]

Mock mirroring sketch entities about a centerline.

Parameters:

Name Type Description Default
entities list[str]

IDs of segments to mirror.

required
mirror_line str

ID of the centerline to mirror across.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def sketch_mirror(
    self, entities: list[str], mirror_line: str
) -> AdapterResult[str]:
    """Mock mirroring sketch entities about a centerline.

    Args:
        entities (list[str]): IDs of segments to mirror.
        mirror_line (str): ID of the centerline to mirror across.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )
    if not entities:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="sketch_mirror requires at least one entity",
        )
    if not mirror_line:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                "sketch_mirror requires a mirror_line entity ID (add_centerline)"
            ),
        )
    if mirror_line not in self._sketch_entity_ids:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"Unknown mirror_line entity '{mirror_line}'. Use the "
                "ID returned by add_centerline."
            ),
        )
    # Mirror the real adapter — IModelDoc2::SketchMirror needs a
    # centreline as the mirror axis; other segments silently no-op.
    if not mirror_line.startswith("Centerline_"):
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                f"mirror_line must be a centerline (from add_centerline), "
                f"got '{mirror_line}'"
            ),
        )
    for ent in entities:
        if ent not in self._sketch_entity_ids:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=(
                    f"Unknown sketch entity '{ent}'. Use IDs returned by "
                    "add_line/add_arc/add_circle/add_spline/add_centerline."
                ),
            )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    mirror_id = f"Mirror_{mirror_line}_{random.randint(1000, 9999)}"
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=mirror_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
sketch_offset async
sketch_offset(entities: list[str], offset_distance: float, reverse_direction: bool) -> AdapterResult[str]

Mock offsetting sketch entities by a fixed distance.

Parameters:

Name Type Description Default
entities list[str]

IDs of segments to offset.

required
offset_distance float

Distance in millimetres. Must be > 0.

required
reverse_direction bool

Flip the offset direction.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def sketch_offset(
    self,
    entities: list[str],
    offset_distance: float,
    reverse_direction: bool,
) -> AdapterResult[str]:
    """Mock offsetting sketch entities by a fixed distance.

    Args:
        entities (list[str]): IDs of segments to offset.
        offset_distance (float): Distance in millimetres. Must be > 0.
        reverse_direction (bool): Flip the offset direction.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    if not self._current_sketch:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active sketch"
        )
    if not entities:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error="sketch_offset requires at least one entity",
        )
    if offset_distance <= 0:
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=(
                "sketch_offset requires offset_distance > 0 — use "
                "reverse_direction to flip the side"
            ),
        )
    for ent in entities:
        if ent not in self._sketch_entity_ids:
            return AdapterResult(
                status=AdapterResultStatus.ERROR,
                error=(
                    f"Unknown sketch entity '{ent}'. Use IDs returned by "
                    "add_line/add_arc/add_circle/add_spline/add_centerline."
                ),
            )

    await asyncio.sleep(self._delays["sketch_operation"] / 2)
    self._operation_count += 1

    direction = "inward" if reverse_direction else "outward"
    offset_id = f"Offset_{offset_distance}_{direction}_{random.randint(1000, 9999)}"
    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data=offset_id,
        execution_time=self._delays["sketch_operation"] / 2,
    )
suppress_feature async
suppress_feature(name: str, suppress: bool = True) -> AdapterResult[dict[str, Any]]

Mock suppressing or unsuppressing 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 result produced by the operation.

Source code in src/solidworks_mcp/adapters/mock_adapter.py
async def suppress_feature(
    self, name: str, suppress: bool = True
) -> AdapterResult[dict[str, Any]]:
    """Mock suppressing or unsuppressing a named feature.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])

    known = any(f.name == name for f in self._features.values())
    if not known:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error=f"Feature not found: {name}"
        )

    was = name in self._suppressed_features
    if suppress:
        self._suppressed_features.add(name)
    else:
        self._suppressed_features.discard(name)
    self._operation_count += 1

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "feature": name,
            "requested": suppress,
            "suppressed": bool(suppress),
            "was_suppressed": was,
        },
        execution_time=self._delays["model_operation"],
    )
undo async
undo(count: int = 1) -> AdapterResult[dict[str, Any]]

Mock undoing the last operations in the active model.

Removes the most recently added features, mirroring what an undo of feature-creation steps does to the tree. tree_changed is False when there was nothing left to undo, which is what the real adapter reports too - SolidWorks accepts an undo on an empty stack quietly.

Parameters:

Name Type Description Default
count int

Number of steps to undo.

1

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Removes the most recently added features, mirroring what an undo of
    feature-creation steps does to the tree. ``tree_changed`` is ``False``
    when there was nothing left to undo, which is what the real adapter
    reports too - SolidWorks accepts an undo on an empty stack quietly.

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

    Returns:
        AdapterResult[dict[str, Any]]: The result produced by the operation.
    """
    await asyncio.sleep(self._delays["model_operation"])
    steps = max(1, int(count))

    keys = list(self._features)
    before = [self._features[k].name for k in keys]
    doomed = keys[-steps:] if steps <= len(keys) else list(keys)
    removed = [self._features[k].name for k in doomed]
    for key in doomed:
        self._suppressed_features.discard(self._features[key].name)
        del self._features[key]
    self._operation_count += 1
    after = [f.name for f in self._features.values()]

    return AdapterResult(
        status=AdapterResultStatus.SUCCESS,
        data={
            "requested_steps": steps,
            "features_before": len(before),
            "features_after": len(after),
            "removed_features": removed,
            "tree_changed": before != after,
        },
        execution_time=self._delays["model_operation"],
    )

PyWin32Adapter

PyWin32Adapter(config: dict[str, Any] | None = None)

Bases: SolidWorksDrawingStandardMixin, SolidWorksDocumentationMixin, SolidWorksSketchMixin, SolidWorksFeaturesMixin, SolidWorksIOMixin, SolidWorksSelectionMixin, SolidWorksAdapter

SolidWorks adapter using pywin32 COM integration.

This adapter provides direct COM integration with SolidWorks using pywin32, enabling real-time automation and control of SolidWorks applications on Windows.

Parameters:

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

Configuration values for the operation. Defaults to None.

None

Raises:

Type Description
SolidWorksMCPError

PyWin32Adapter requires Windows platform.

Attributes:

Name Type Description
constants Any

The constants value.

Example
adapter = PyWin32Adapter({'timeout': 30})
result = await adapter.connect()
if result.status == AdapterResultStatus.SUCCESS:
    print("Connected to SolidWorks successfully")

Initialize PyWin32Adapter with configuration.

Parameters:

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

Configuration values for the operation. Defaults to None.

None

Returns:

Name Type Description
None None

None.

Raises:

Type Description
SolidWorksMCPError

PyWin32Adapter requires Windows platform.

Example
config = {
    "timeout": 30,
    "auto_connect": True,
    "startup_timeout": 60
}
adapter = PyWin32Adapter(config)
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
def __init__(self, config: dict[str, Any] | None = None) -> None:
    """Initialize PyWin32Adapter with configuration.

    Args:
        config (dict[str, Any] | None): Configuration values for the operation. Defaults to
                                        None.

    Returns:
        None: None.

    Raises:
        SolidWorksMCPError: PyWin32Adapter requires Windows platform.

    Example:
                        ```python
                        config = {
                            "timeout": 30,
                            "auto_connect": True,
                            "startup_timeout": 60
                        }
                        adapter = PyWin32Adapter(config)
                        ```
    """
    if not PYWIN32_AVAILABLE:
        raise SolidWorksMCPError(
            "pywin32 is not available. Install with: pip install pywin32"
        )

    if platform.system() != "Windows":
        raise SolidWorksMCPError("PyWin32Adapter requires Windows platform")

    super().__init__(config)

    self.swApp: Any | None = None
    self.currentModel: Any | None = None
    self.currentSketch: Any | None = None
    self.currentSketchManager: Any | None = None
    self._last_sketch_name: str | None = None
    self._sketch_count: int = 0  # incremented each time a sketch is created
    self._sketch_entities: dict[str, Any] = {}
    # Cached (center_x_mm, center_y_mm) for entities whose center can't be
    # recovered via ``GetCenterPoint`` — currently polygons, which register
    # as a SAFEARRAY of segment handles (no single dispatch to read from).
    # ``sketch_circular_pattern`` reads this to derive the seed-to-axis
    # offset for polygon seeds.
    self._sketch_entity_centers: dict[str, tuple[float, float]] = {}
    self._sketch_entity_counter = 0
    self._com_initialized = False
    # Thread that initialised the COM apartment (see _handle_com_operation).
    self._com_thread_id: int | None = None

    # COM constants (equivalent to SolidWorks API constants)
    self.constants = {
        # Document types
        "swDocPART": 1,
        "swDocASSEMBLY": 2,
        "swDocDRAWING": 3,
        # Selection types
        "swSelFACES": 1,
        "swSelEDGES": 2,
        "swSelVERTICES": 3,
        "swSelSKETCHSEGS": 4,
        "swSelSKETCHPOINTS": 5,
        "swSelDATUMPLANES": 6,
        # Feature end conditions
        "swEndCondBlind": 0,
        "swEndCondThroughAll": 1,
        "swEndCondUpToNext": 2,
        "swEndCondUpToSurface": 3,
        "swEndCondOffset": 4,
        "swEndCondUpToVertex": 5,
        "swEndCondMidPlane": 6,
        "swEndCondThroughAllBoth": 9,
        # Dimension preferences / directions
        "swInputDimValOnCreate": 10,
        "swSketchAcceptNumericInput": 372,
        "swSketchCreateDimensionOnlyWhenEntered": 520,
        "swScaleSketchOnFirstDimension": 642,
        "swSmartDimensionDirectionRight": 0,
        "swSmartDimensionDirectionUp": 1,
        "swSmartDimensionDirectionLeft": 2,
        "swSmartDimensionDirectionDown": 3,
    }

    self._session_coordinator = _ComSessionCoordinator(self)
    self._sketch_geometry = _SketchGeometryService(self)
    self._document_routing = _DocumentRoutingService(self)
    self._feature_selector = _FeatureSelectionService(self)
Methods:
connect async
connect() -> None

Connect to SolidWorks COM and prepare automation-safe session state.

Raises:

Type Description
SolidWorksMCPError

If connection or readiness checks fail.

Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
async def connect(self) -> None:
    """Connect to SolidWorks COM and prepare automation-safe session state.

    Raises:
        SolidWorksMCPError: If connection or readiness checks fail.
    """
    await self._session_coordinator.connect()
disconnect async
disconnect() -> None

Disconnect from SolidWorks application.

Properly disconnects from SolidWorks COM interface and cleans up resources. This method should always be called when finished to prevent memory leaks.

Note: - Clears references to current model and application - Uninitialize COM apartment - Does not close SolidWorks application itself

Returns:

Name Type Description
None None

None.

Example
try:
    await adapter.connect()
    # ... do work ...
finally:
    await adapter.disconnect()
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
async def disconnect(self) -> None:
    """Disconnect from SolidWorks application.

    Properly disconnects from SolidWorks COM interface and cleans up resources. This method
    should always be called when finished to prevent memory leaks.

    Note: - Clears references to current model and application - Uninitialize COM apartment
    - Does not close SolidWorks application itself

    Returns:
        None: None.

    Example:
                        ```python
                        try:
                            await adapter.connect()
                            # ... do work ...
                        finally:
                            await adapter.disconnect()
                        ```
    """
    await self._session_coordinator.disconnect()
execute_macro async
execute_macro(params: dict[str, Any]) -> AdapterResult[dict[str, Any]]

Provide execute macro support for the py win32 adapter.

Parameters:

Name Type Description Default
params dict[str, Any]

The params value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

Raises:

Type Description
SolidWorksMCPError

If the operation cannot be completed.

Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
async def execute_macro(
    self, params: dict[str, Any]
) -> AdapterResult[dict[str, Any]]:
    """Provide execute macro support for the py win32 adapter.

    Args:
        params (dict[str, Any]): The params value.

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

    Raises:
        SolidWorksMCPError: If the operation cannot be completed.
    """
    macro_path = params.get("macro_path") or params.get("macro_file") or ""
    if not macro_path:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No macro_path provided"
        )
    if not os.path.isfile(macro_path):
        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"Macro file not found: {macro_path}",
        )

    def _run() -> dict[str, Any]:
        """Resolve module/proc names and delegate to _invoke_run_macro2.

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

        Raises:
            SolidWorksMCPError: If the operation cannot be completed.
        """
        module_name = _parse_vb_module_name(macro_path)
        proc_name = params.get("proc_name", "main")
        return self._invoke_run_macro2(macro_path, module_name, proc_name)

    return self._handle_com_operation("execute_macro", _run)
export_file 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.

Raises:

Type Description
Exception

If the operation cannot be completed.

RuntimeError

No active SolidWorks document for export.

Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
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.

    Raises:
        Exception: If the operation cannot be completed.
        RuntimeError: No active SolidWorks document for export.
    """
    if not self.currentModel:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )

    def _export_operation() -> None:
        """Build internal export operation.

        Returns:
            None: None.

        Raises:
            Exception: If the operation cannot be completed.
            RuntimeError: No active SolidWorks document for export.
        """
        format_map = {
            "step": 0,  # swSaveAsSTEP
            "iges": 1,  # swSaveAsIGS
            "stl": 2,  # swSaveAsSTL
            "pdf": 3,  # swSaveAsPDF
            "dwg": 4,  # swSaveAsDWG
            "jpg": 5,  # swSaveAsJPEG
            "glb": 41,  # swSaveAsGLTF (binary GLTF, SW 2023+)
            "gltf": 41,  # same enum value, text GLTF
        }

        format_lower = format_type.lower()
        if format_lower not in format_map:
            raise Exception(f"Unsupported export format: {format_type}")

        resolved_path = os.path.abspath(file_path)
        os.makedirs(os.path.dirname(resolved_path), exist_ok=True)

        if os.path.exists(resolved_path):
            self._attempt(lambda: os.remove(resolved_path))

        # Prefer swApp.ActiveDoc — more reliably typed than the late-bound
        # IDispatch reference stored in self.currentModel after OpenDoc6.
        # Use getattr so tests can pass a SimpleNamespace without ActiveDoc.
        target_doc = (
            getattr(self.swApp, "ActiveDoc", None) if self.swApp else None
        ) or self.currentModel

        # ----------------------------------------------------------------
        # STL export: use Extension.SaveAs2 + ISTLExportData
        # for both parts AND assemblies.  SaveAs3 with format=2 works for
        # parts but is unreliable for assemblies (only exports first body).
        # ----------------------------------------------------------------
        if format_lower == "stl":
            # For assemblies, resolve lightweight components first so all
            # geometry is available for the mesh export.
            self._attempt(lambda: target_doc.ResolveAllLightweightComponents(True))  # type: ignore[union-attr]

            ext = getattr(target_doc, "Extension", None)
            if ext is None:
                raise RuntimeError("No Extension object available for STL export")

            stl_data = self._prepare_stl_export_data()
            if not self._save_stl_with_extension(ext, stl_data, resolved_path):
                # SaveAs2 didn't produce file — try SaveAs3 fallback
                self._save_stl_with_fallback(target_doc, resolved_path)

            return None

        # ----------------------------------------------------------------
        # All other formats — classic SaveAs3 path.
        # SaveAs3 signature: SaveAs3(FileName, Version, Options)
        # Version = 0 means "current version" (swSaveAsCurrentVersion).
        # SolidWorks infers the export format from the file extension, so
        # we must NOT pass the format-enum value as the Version argument.
        # ----------------------------------------------------------------
        _ = format_map[format_lower]  # validate format is known; value unused
        logger.debug(
            "[pywin32.export_file] SaveAs3 {} (version=0, options=Silent)",
            resolved_path,
        )
        success = target_doc.SaveAs3(  # type: ignore[union-attr]
            resolved_path,
            0,  # swSaveAsCurrentVersion — format inferred from file extension
            2,  # swSaveAsOptions_Silent
        )

        if not success and not os.path.exists(resolved_path):
            raise Exception(
                f"SaveAs3 returned False and no file produced: {resolved_path}"
            )

        return None

    return self._handle_com_operation("export_file", _export_operation)
export_image async
export_image(payload: dict) -> AdapterResult[dict]

Export a screenshot of the current model to a PNG/JPG file.

Payload keys (matching ExportImageInput): file_path (str): Output path including extension. format_type (str): "png" or "jpg". Default "png". width (int): Pixel width. Default 1280. height (int): Pixel height. Default 720. view_orientation (str): "front" | "top" | "right" | "isometric" | "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.

Raises:

Type Description
RuntimeError

If the operation cannot be completed.

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

    Payload keys (matching ExportImageInput): file_path (str): Output path including
    extension. format_type (str): "png" or "jpg". Default "png". width (int): Pixel width.
    Default 1280. height (int): Pixel height. Default 720. view_orientation (str): "front" |
    "top" | "right" | "isometric" | "current".

    Args:
        payload (dict): The payload value.

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

    Raises:
        RuntimeError: If the operation cannot be completed.
    """
    if not self.currentModel:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="No active model"
        )
    if not self.swApp:
        return AdapterResult(
            status=AdapterResultStatus.ERROR, error="SolidWorks not connected"
        )

    orientation = str(payload.get("view_orientation", "current")).lower()
    file_path = payload.get("file_path", "")
    width = int(payload.get("width", 1280))
    height = int(payload.get("height", 720))

    # Map orientation names to SolidWorks swStandardViews_e constants
    _VIEW_CONSTANTS = {
        "front": 1,  # swFrontView
        "back": 2,  # swBackView
        "left": 3,  # swLeftView
        "right": 4,  # swRightView
        "top": 5,  # swTopView
        "bottom": 6,  # swBottomView
        "isometric": 7,  # swIsometricView
        "dimetric": 8,  # swDimetricView
        "trimetric": 9,  # swTriMetricView
    }

    def _screenshot_operation() -> dict:
        """Build internal screenshot operation.

        Returns:
            dict: A dictionary containing the resulting values.

        Raises:
            RuntimeError: If the operation cannot be completed.
        """

        import os as _os

        resolved = _os.path.abspath(file_path)
        _os.makedirs(_os.path.dirname(resolved), exist_ok=True)

        target_doc = self._resolve_export_target_doc()

        # Activate target_doc's own MDI window before capturing. Without
        # this, SaveBitmapWithVariableSize renders whatever document
        # window is currently frontmost in the SW frame -- which can be
        # a completely different open document if the user has clicked
        # around in SolidWorks since -- even though it's called on the
        # correct target_doc COM object. See com-api-pitfalls.md #21.
        _, target_title = self._document_identity(target_doc)
        if target_title:
            self._attempt(
                lambda: self.swApp.ActivateDoc3(  # type: ignore[union-attr]
                    target_title, False, 0, _byref_int()
                )
            )

        # Ensure SolidWorks window is focused so the viewport is rendered.
        # Required for both view changes and bitmap capture.
        self._attempt(lambda: self.swApp.Frame.SetFocus())  # type: ignore[union-attr]

        # Set view orientation if requested
        if orientation != "current" and orientation in _VIEW_CONSTANTS:
            view_const = _VIEW_CONSTANTS[orientation]
            self._set_view_orientation(target_doc, orientation, view_const)

        # Zoom to fit so the model fills the viewport before capture
        self._zoom_to_fit(target_doc)

        # Remove any pre-existing file so SolidWorks never shows the
        # "already exists — replace?" confirmation dialog.
        if _os.path.exists(resolved):
            _os.remove(resolved)

        # SaveBMP at the requested size; SaveAs3 (window size) otherwise.
        saved = self._save_screenshot_sized(target_doc, resolved, width, height)
        if not saved:
            self._save_screenshot_with_saveas3(target_doc, resolved)
            saved = _os.path.exists(resolved)

        if not saved:
            raise RuntimeError(
                f"All screenshot methods produced no output for {resolved}"
            )

        # Report the size actually written, not the one asked for: the
        # SaveAs3 fallback ignores width/height.
        size = bitmap.image_size(resolved)
        return {
            "file_path": resolved,
            "format": _os.path.splitext(resolved)[1].lstrip(".").upper() or "PNG",
            "dimensions": f"{size[0]}x{size[1]}" if size else "unknown",
            "requested_dimensions": f"{width}x{height}",
            "view": orientation,
        }

    return self._handle_com_operation("export_image", _screenshot_operation)
health_check async
health_check() -> AdapterHealth

Get adapter health status.

Performs comprehensive health check including connection status, operation metrics, and SolidWorks application responsiveness.

Returns:

Name Type Description
AdapterHealth AdapterHealth

The result produced by the operation.

Example
health = await adapter.health_check()
if health.healthy:
    print(f"Adapter healthy, {health.success_count} operations completed")
else:
    print(f"Adapter unhealthy: {health.error_count} errors")
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
async def health_check(self) -> AdapterHealth:
    """Get adapter health status.

    Performs comprehensive health check including connection status, operation metrics, and
    SolidWorks application responsiveness.

    Returns:
        AdapterHealth: The result produced by the operation.

    Example:
                        ```python
                        health = await adapter.health_check()
                        if health.healthy:
                            print(f"Adapter healthy, {health.success_count} operations completed")
                        else:
                            print(f"Adapter unhealthy: {health.error_count} errors")
                        ```
    """
    healthy = self.is_connected()

    # Support both callable COM method and property-style RevisionNumber.
    sw_version: str | None = None
    if self.swApp:
        sw_version = self._attempt(
            lambda: self._get_attr_or_call(self.swApp, "RevisionNumber")
        )

    # Try a simple operation to verify connection
    if healthy:
        healthy = sw_version is not None

    return AdapterHealth(
        healthy=healthy,
        last_check=datetime.now(),
        error_count=int(self._metrics["errors_count"]),
        success_count=int(
            self._metrics["operations_count"] - self._metrics["errors_count"]
        ),
        average_response_time=self._metrics["average_response_time"],
        connection_status="connected" if healthy else "disconnected",
        metrics={
            "adapter_type": "pywin32",
            "sw_version": sw_version or "Unknown",
            "current_model": self.currentModel.GetTitle()
            if self.currentModel
            else None,
        },
    )
is_connected
is_connected() -> bool

Check if connected to SolidWorks.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

Example
if adapter.is_connected():
    print("Ready to automate SolidWorks")
else:
    await adapter.connect()
Source code in src/solidworks_mcp/adapters/pywin32_adapter.py
def is_connected(self) -> bool:
    """Check if connected to SolidWorks.

    Returns:
        bool: True if connected, otherwise False.

    Example:
                        ```python
                        if adapter.is_connected():
                            print("Ready to automate SolidWorks")
                        else:
                            await adapter.connect()
                        ```
    """
    return self.swApp is not None

RoutingDecision

Bases: BaseModel

Complexity-based routing decision.

Attributes:

Name Type Description
complexity_score float

The complexity score value.

operation str

The operation value.

parameter_count int

The parameter count value.

prefer_vba bool

The prefer vba value.

reason str

The reason value.

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], angle: float = 45.0, flip: bool = False) -> AdapterResult[Any]

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

At the default 45 degrees both legs equal distance.

Parameters:

Name Type Description Default
distance float

Chamfer distance in millimeters, along one face.

required
edge_names list[str]

List of edge names to chamfer.

required
angle float

Chamfer angle in degrees. Defaults to 45.

45.0
flip bool

Measure distance along the other face.

False

Returns:

Name Type Description
AdapterResult AdapterResult[Any]

Feature result or error.

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

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

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

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

Add a circle to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
radius float

The radius value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    pass
add_datum_tag async
add_datum_tag(label: str, attach_at_mm: tuple[float, float], x_mm: float, y_mm: float) -> AdapterResult[dict[str, Any]]

Add a datum feature symbol on a drawing edge.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_datum_tag is not implemented by this adapter",
    )
add_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_gtol async
add_gtol(characteristic: str, tolerance: float, x_mm: float, y_mm: float, diameter_zone: bool = False, material_condition: str = 'none', datums: list[str] | None = None, attach_at_mm: tuple[float, float] | None = None, dimension: tuple[str, str] | None = None) -> AdapterResult[dict[str, Any]]

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

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

Add a line to the current sketch.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Mate two components together in the active assembly.

Parameters:

Name Type Description Default
component_a str

First component instance name.

required
component_b str

Second component instance name.

required
entity_a str

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

'Front Plane'
entity_b str

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

'Front Plane'
mate_type str

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

'coincident'
alignment str

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

'aligned'
distance float

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

0.0
angle float

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

0.0
face_a list[float] | None

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

None
face_b list[float] | None

The same for the second component.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Place a text note on the active drawing sheet.

Parameters:

Name Type Description Default
payload Any

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

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The note's details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_note is not implemented by this adapter",
    )
add_polygon async
add_polygon(center_x: float, center_y: float, radius: float, sides: int) -> 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",
    )
arrange_dimensions async
arrange_dimensions(view_name: str | None = None) -> AdapterResult[dict[str, Any]]

Move drawing dimensions so none overlaps, then verify.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Parameters:

Name Type Description Default
view_name str

Name of a view on the active drawing.

required
mark_holes bool

Mark holes / bores.

True
mark_fillets bool

Mark fillets.

False
mark_slots bool

Mark slots.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

counts, or error.

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

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

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

Check the active assembly for interfering components.

Parameters:

Name Type Description Default
params Any

Optional settings; coincident, components.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Check whether a sketch is fully defined.

Parameters:

Name Type Description Default
sketch_name str | None

Optional sketch name to inspect. Defaults to None.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Close the current model.

Parameters:

Name Type Description Default
save bool

The save value. Defaults to False.

False

Returns:

Type Description
AdapterResult[None]

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

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

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

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

Connect to SolidWorks application.

Returns:

Name Type Description
None None

None.

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

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

Create a new assembly document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

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

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

Create a reference axis along a principal direction.

Parameters:

Name Type Description Default
reference str

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

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The plane pair used and feature counts, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_axis is not implemented by this adapter",
    )
create_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, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create a new drawing document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

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

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

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

Parameters:

Name Type Description Default
payload Any

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

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The new view's details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_drawing_view is not implemented by this adapter",
    )
create_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, template: str | None = None) -> AdapterResult[SolidWorksModel]

Create a new part document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
units str | None

The units value. Defaults to None.

None
template str | None

Template file path. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

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

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

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

Parameters:

Name Type Description Default
reference str

Name of the reference plane.

required
offset float

Offset distance in millimetres. Defaults to 0.0.

0.0
angle float

Angle in degrees about axis. Defaults to 0.0.

0.0
flip bool

Reverse the offset or angle direction. Defaults to False.

False
axis str | None

Named axis to rotate about; needed with angle.

None
face_point list[float] | None

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

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Create a reference point on the active part.

Parameters:

Name Type Description Default
mode str

"along_curve" or "face_center".

required
x float

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

required
y float

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

required
z float

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

required
distance float | None

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

None
percent float | None

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

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Create a revolve feature.

Parameters:

Name Type Description Default
params RevolveParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

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

    Args:
        params (RevolveParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    pass
create_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_standard_drawing async
create_standard_drawing(model_path: str, output_dir: str | None = None, title: str | None = None, subtitle: str | None = None, drawing_number: str | None = None, author: str = '', revision: str = 'A', company: str = '', drawn_date: str | None = None, notes: list[str] | None = None, include_isometric: bool = True, write_model_properties: bool = True, title_block_text_height_mm: float | None = None, include_bom: bool = False) -> AdapterResult[dict[str, Any]]

Create a complete standard A3 drawing.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

Create a sweep feature.

Parameters:

Name Type Description Default
params SweepParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

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

    Args:
        params (SweepParameters): The params value.

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

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

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the model path and the projection angle.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The view names created, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_technical_drawing is not implemented by this adapter",
    )
delete_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_flat_pattern async
export_flat_pattern(file_path: str) -> AdapterResult[dict[str, Any]]

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

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

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

Parameters:

Name Type Description Default
payload dict

The payload value.

required

Returns:

Type Description
AdapterResult[dict]

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

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

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

    Args:
        payload (dict): The payload value.

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

Describe the connected SolidWorks without changing anything.

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

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

part, assembly and drawing, the default template's

AdapterResult[dict[str, Any]]

file_name and whether the file exists.

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

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

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

Read the custom properties of the active document.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

Get the value of a dimension.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Args:
        name (str): The name value.

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

Get mass properties of the current model.

Returns:

Type Description
AdapterResult[MassProperties]

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

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

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

Read the material assigned to the active part.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

Get adapter metrics.

Returns:

Type Description
dict[str, Any]

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

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

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

Summarise the active part or assembly without changing it.

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

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

"assembly"), volume_mm3, bounding_box_mm (min,

AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

solid_body_count, and for assemblies component_count and

AdapterResult[dict[str, Any]]

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

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

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

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

Get metadata for the active model.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

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

Returns:

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

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

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

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

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

set (varies by entity type).

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

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

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

Get adapter health status.

Returns:

Name Type Description
AdapterHealth AdapterHealth

The result produced by the operation.

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

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

Insert a BOM table anchored to an assembly drawing view.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Parameters:

Name Type Description Default
file_path str

Absolute path to the .sldprt or .sldasm.

required
x float

X position in millimetres. Defaults to 0.0.

0.0
y float

Y position in millimetres. Defaults to 0.0.

0.0
z float

Z position in millimetres. Defaults to 0.0.

0.0

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Bring model dimensions into drawing views.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

Check if connected to SolidWorks.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

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

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

List materials from the configured material libraries.

Returns:

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

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

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

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

List the top-level components of the active assembly.

Returns:

Type Description
AdapterResult[list[str]]

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

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

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

List configuration names for the active model.

Returns:

Type Description
AdapterResult[list[str]]

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

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

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

List the views on the active drawing.

Returns:

Type Description
AdapterResult[list[str]]

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

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

    Returns:
        AdapterResult[list[str]]: View names, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="list_drawing_views is not implemented by this adapter",
    )
list_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_model_dimensions async
list_model_dimensions(feature_name: str | None = None) -> AdapterResult[list[dict[str, Any]]]

List every dimension in the active part or assembly.

Returns:

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

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

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

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

Enumerate every document currently open in SolidWorks.

Returns:

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

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

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

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

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

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

Measure one or two selected entities.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="measure_entities is not implemented by this adapter",
    )
mirror_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",
    )
rebuild_model async
rebuild_model(top_level_only: bool = False) -> AdapterResult[dict[str, Any]]

Force a rebuild and report per-feature rebuild errors.

Parameters:

Name Type Description Default
top_level_only bool

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

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

errors (one entry per failing feature with feature,

AdapterResult[dict[str, Any]]

type, code, code_name, severity, description,

AdapterResult[dict[str, Any]]

parents, hint), error_count and warning_count.

AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

remains.

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

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

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

Rename an existing feature on the feature tree.

Parameters:

Name Type Description Default
old_name str

Current feature name.

required
new_name str

New feature name.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The old and new names, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="rename_feature is not implemented by this adapter",
    )
reset_circuit_breakers async
reset_circuit_breakers(operation: str | None = None) -> AdapterResult[dict[str, list[str]]]

Re-open operations a circuit breaker paused.

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

Parameters:

Name Type Description Default
operation str | None

The operation to reset; None resets every one.

None

Returns:

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

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

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

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

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

    Returns:
        AdapterResult[dict[str, list[str]]]: ``reset``, the operations that were paused.
    """
    return AdapterResult(status=AdapterResultStatus.SUCCESS, data={"reset": []})
save_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",
    )
select_face_edges async
select_face_edges(point: list[float] | None = None, side: str | None = None, plane: str | None = None, edge_type: str = 'all', append: bool = False) -> AdapterResult[dict[str, Any]]

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

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

Parameters:

Name Type Description Default
point list[float] | None

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

None
side str | None

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

None
plane str | None

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

None
edge_type str

all, linear or circular.

'all'
append bool

Add to the current selection. Defaults to False.

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

(one descriptor per selected edge) and selection_count.

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

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

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

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

Select a named feature, sketch, plane or component.

Parameters:

Name Type Description Default
feature_name str

The feature name, optionally @document qualified.

required
append bool

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

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

feature_name, selected_name, entity_type and

AdapterResult[dict[str, Any]]

selection_count. ERROR when nothing could be selected - never

AdapterResult[dict[str, Any]]

SUCCESS with selected: False.

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

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

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

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

Parameters:

Name Type Description Default
component str

Instance name, as list_components reports it.

required
fixed bool | None

True fixes it, False floats it.

None
flexible bool | None

True flexible, False rigid.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The state before and after, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_component_state is not implemented by this adapter",
    )
set_custom_property async
set_custom_property(name: str, value: str, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Create or overwrite one custom property.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_custom_property is not implemented by this adapter",
    )
set_dimension abstractmethod async
set_dimension(name: str, value: float) -> 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_material async
set_material(material_name: str, database: str | None = None, configuration: str | None = None) -> AdapterResult[dict[str, Any]]

Assign a material to the active part.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

Set the active drawing sheet's scale.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Returns:
        AdapterResult[dict[str, Any]]: Error unless the adapter implements it.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="set_sheet_scale is not implemented by this adapter",
    )
set_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

VbaGeneratorAdapter

VbaGeneratorAdapter(backing_adapter: Any, macro_executor: VbaMacroExecutor | None = None)

Adapter that executes complex operations through VBA-oriented flow.

This adapter currently uses the wrapped COM adapter for final execution, but annotates responses as VBA-routed and can be extended to execute generated macros directly in future iterations.

Parameters:

Name Type Description Default
backing_adapter Any

The backing adapter value.

required
macro_executor VbaMacroExecutor | None

The macro executor value. Defaults to None.

None

Attributes:

Name Type Description
_backing_adapter Any

The backing adapter value.

_macro_executor Any

The macro executor value.

config Any

The config value.

Initialize the vba generator adapter.

Parameters:

Name Type Description Default
backing_adapter Any

The backing adapter value.

required
macro_executor VbaMacroExecutor | None

The macro executor value. Defaults to None.

None

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/vba_adapter.py
def __init__(
    self,
    backing_adapter: Any,
    macro_executor: VbaMacroExecutor | None = None,
) -> None:
    """Initialize the vba generator adapter.

    Args:
        backing_adapter (Any): The backing adapter value.
        macro_executor (VbaMacroExecutor | None): The macro executor value. Defaults to
                                                  None.

    Returns:
        None: None.
    """
    self._backing_adapter = backing_adapter
    self._macro_executor = macro_executor or VbaMacroExecutor()
    self.config = getattr(backing_adapter, "config", None)
Methods:
__getattr__
__getattr__(item: str) -> Any

Delegate unknown members to backing adapter.

Parameters:

Name Type Description Default
item str

The item value.

required

Returns:

Name Type Description
Any Any

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/vba_adapter.py
def __getattr__(self, item: str) -> Any:
    """Delegate unknown members to backing adapter.

    Args:
        item (str): The item value.

    Returns:
        Any: The result produced by the operation.
    """
    return getattr(self._backing_adapter, item)
connect async
connect() -> None

Connect to SolidWorks using wrapped adapter.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/vba_adapter.py
async def connect(self) -> None:
    """Connect to SolidWorks using wrapped adapter.

    Returns:
        None: None.
    """
    await self._backing_adapter.connect()
create_extrusion async
create_extrusion(params: ExtrusionParameters) -> AdapterResult[Any]

Create the extrusion.

Parameters:

Name Type Description Default
params ExtrusionParameters

The params value.

required

Returns:

Type Description
AdapterResult[Any]

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

Source code in src/solidworks_mcp/adapters/vba_adapter.py
async def create_extrusion(
    self,
    params: ExtrusionParameters,
) -> AdapterResult[Any]:
    """Create the extrusion.

    Args:
        params (ExtrusionParameters): The params value.

    Returns:
        AdapterResult[Any]: The result produced by the operation.
    """
    return await self._run_with_vba_metadata(
        operation="create_extrusion",
        payload=params,
        com_call=self._backing_adapter.create_extrusion,
        vba_code=self._generate_extrusion_vba(params),
    )
create_loft async
create_loft(params: LoftParameters) -> AdapterResult[Any]

Create the loft.

Parameters:

Name Type Description Default
params LoftParameters

The params value.

required

Returns:

Type Description
AdapterResult[Any]

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

Source code in src/solidworks_mcp/adapters/vba_adapter.py
async def create_loft(
    self,
    params: LoftParameters,
) -> AdapterResult[Any]:
    """Create the loft.

    Args:
        params (LoftParameters): The params value.

    Returns:
        AdapterResult[Any]: The result produced by the operation.
    """
    return await self._run_with_vba_metadata(
        operation="create_loft",
        payload=params,
        com_call=self._backing_adapter.create_loft,
        vba_code=self._generate_loft_vba(params),
    )
create_revolve async
create_revolve(params: RevolveParameters) -> AdapterResult[Any]

Create the revolve.

Parameters:

Name Type Description Default
params RevolveParameters

The params value.

required

Returns:

Type Description
AdapterResult[Any]

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

Source code in src/solidworks_mcp/adapters/vba_adapter.py
async def create_revolve(
    self,
    params: RevolveParameters,
) -> AdapterResult[Any]:
    """Create the revolve.

    Args:
        params (RevolveParameters): The params value.

    Returns:
        AdapterResult[Any]: The result produced by the operation.
    """
    return await self._run_with_vba_metadata(
        operation="create_revolve",
        payload=params,
        com_call=self._backing_adapter.create_revolve,
        vba_code=self._generate_revolve_vba(params),
    )
create_sweep async
create_sweep(params: SweepParameters) -> AdapterResult[Any]

Create the sweep.

Parameters:

Name Type Description Default
params SweepParameters

The params value.

required

Returns:

Type Description
AdapterResult[Any]

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

Source code in src/solidworks_mcp/adapters/vba_adapter.py
async def create_sweep(
    self,
    params: SweepParameters,
) -> AdapterResult[Any]:
    """Create the sweep.

    Args:
        params (SweepParameters): The params value.

    Returns:
        AdapterResult[Any]: The result produced by the operation.
    """
    return await self._run_with_vba_metadata(
        operation="create_sweep",
        payload=params,
        com_call=self._backing_adapter.create_sweep,
        vba_code=self._generate_sweep_vba(params),
    )
disconnect async
disconnect() -> None

Disconnect wrapped adapter.

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/vba_adapter.py
async def disconnect(self) -> None:
    """Disconnect wrapped adapter.

    Returns:
        None: None.
    """
    await self._backing_adapter.disconnect()
execute_macro async
execute_macro(macro_code: str, macro_name: str = 'GeneratedMacro', subroutine: str = 'Main') -> AdapterResult[Any]

Provide execute macro support for the vba generator adapter.

Parameters:

Name Type Description Default
macro_code str

The macro code value.

required
macro_name str

The macro name value. Defaults to "GeneratedMacro".

'GeneratedMacro'
subroutine str

The subroutine value. Defaults to "Main".

'Main'

Returns:

Type Description
AdapterResult[Any]

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

Source code in src/solidworks_mcp/adapters/vba_adapter.py
async def execute_macro(
    self,
    macro_code: str,
    macro_name: str = "GeneratedMacro",
    subroutine: str = "Main",
) -> AdapterResult[Any]:
    """Provide execute macro support for the vba generator adapter.

    Args:
        macro_code (str): The macro code value.
        macro_name (str): The macro name value. Defaults to "GeneratedMacro".
        subroutine (str): The subroutine value. Defaults to "Main".

    Returns:
        AdapterResult[Any]: The result produced by the operation.
    """
    request = MacroExecutionRequest(
        macro_code=macro_code,
        macro_name=macro_name,
        subroutine=subroutine,
    )
    return await self._macro_executor.execute_macro(
        request=request,
        backing_adapter=self._backing_adapter,
    )
get_macro_execution_history
get_macro_execution_history(macro_name: str | None = None) -> dict[str, Any]

Retrieve VBA macro execution history.

Parameters:

Name Type Description Default
macro_name str | None

The macro name value. Defaults to None.

None

Returns:

Type Description
dict[str, Any]

dict[ str, Any,

dict[str, Any]

]: A dictionary containing the resulting values.

Source code in src/solidworks_mcp/adapters/vba_adapter.py
def get_macro_execution_history(
    self, macro_name: str | None = None
) -> dict[
    str,
    Any,
]:
    """Retrieve VBA macro execution history.

    Args:
        macro_name (str | None): The macro name value. Defaults to None.

    Returns:
        dict[
            str,
            Any,
        ]: A dictionary containing the resulting values.
    """
    history = self._macro_executor.get_execution_history(macro_name)
    return {key: value.__dict__ for key, value in history.items()}
health_check async
health_check() -> Any

Return wrapped adapter health with VBA route marker.

Returns:

Name Type Description
Any Any

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/vba_adapter.py
async def health_check(self) -> Any:
    """Return wrapped adapter health with VBA route marker.

    Returns:
        Any: The result produced by the operation.
    """
    health = await self._backing_adapter.health_check()
    if hasattr(health, "metrics"):
        metrics = dict(health.metrics or {})
        metrics["route"] = "vba"
        health.metrics = metrics
    return health
is_connected
is_connected() -> bool

Return wrapped adapter connection state.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

Source code in src/solidworks_mcp/adapters/vba_adapter.py
def is_connected(self) -> bool:
    """Return wrapped adapter connection state.

    Returns:
        bool: True if connected, otherwise False.
    """
    return bool(self._backing_adapter.is_connected())

VbaMacroExecutor

VbaMacroExecutor(temp_macro_dir: Path | None = None)

Manage VBA macro execution with save and tracking.

This executor handles the full lifecycle: code generation, on-disk persistence, execution via the backing adapter, and result tracking.

Parameters:

Name Type Description Default
temp_macro_dir Path | None

The temp macro dir value. Defaults to None.

None

Attributes:

Name Type Description
_temp_macro_dir Any

The temp macro dir value.

Initialize macro executor.

Parameters:

Name Type Description Default
temp_macro_dir Path | None

The temp macro dir value. Defaults to None.

None

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/vba_macro_executor.py
def __init__(self, temp_macro_dir: Path | None = None) -> None:
    """Initialize macro executor.

    Args:
        temp_macro_dir (Path | None): The temp macro dir value. Defaults to None.

    Returns:
        None: None.
    """
    self._temp_macro_dir = temp_macro_dir or Path(tempfile.gettempdir())
    self._execution_history: dict[str, MacroExecutionResult] = {}
Methods:
execute_macro async
execute_macro(request: MacroExecutionRequest, backing_adapter: Any) -> AdapterResult[MacroExecutionResult]

Provide execute macro support for the vba macro executor.

Parameters:

Name Type Description Default
request MacroExecutionRequest

The request value.

required
backing_adapter Any

The backing adapter value.

required

Returns:

Type Description
AdapterResult[MacroExecutionResult]

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

Source code in src/solidworks_mcp/adapters/vba_macro_executor.py
async def execute_macro(
    self,
    request: MacroExecutionRequest,
    backing_adapter: Any,
) -> AdapterResult[MacroExecutionResult]:
    """Provide execute macro support for the vba macro executor.

    Args:
        request (MacroExecutionRequest): The request value.
        backing_adapter (Any): The backing adapter value.

    Returns:
        AdapterResult[MacroExecutionResult]: The result produced by the operation.
    """
    start_time = datetime.utcnow()
    macro_path = self._save_macro_to_disk(request.macro_code, request.macro_name)

    try:
        result = await self._execute_via_adapter(
            macro_path=macro_path,
            subroutine=request.subroutine,
            backing_adapter=backing_adapter,
        )

        duration = (datetime.utcnow() - start_time).total_seconds()
        execution_result = MacroExecutionResult(
            success=result.get("success", False),
            macro_name=request.macro_name,
            output=result.get("output"),
            error=result.get("error"),
            duration_seconds=duration,
        )

        self._execution_history[request.macro_name] = execution_result

        return AdapterResult(
            status=AdapterResultStatus.SUCCESS,
            data=execution_result,
            metadata={
                "macro_path": str(macro_path),
                "macro_name": request.macro_name,
                "duration_seconds": duration,
                "subroutine": request.subroutine,
            },
        )

    except Exception as exc:
        duration = (datetime.utcnow() - start_time).total_seconds()
        execution_result = MacroExecutionResult(
            success=False,
            macro_name=request.macro_name,
            error=str(exc),
            duration_seconds=duration,
        )

        self._execution_history[request.macro_name] = execution_result

        return AdapterResult(
            status=AdapterResultStatus.ERROR,
            error=f"macro execution failed: {exc}",
        )
get_execution_history
get_execution_history(macro_name: str | None = None) -> dict[str, MacroExecutionResult]

Retrieve macro execution history.

Parameters:

Name Type Description Default
macro_name str | None

The macro name value. Defaults to None.

None

Returns:

Type Description
dict[str, MacroExecutionResult]

dict[ str, MacroExecutionResult,

dict[str, MacroExecutionResult]

]: A dictionary containing the resulting values.

Source code in src/solidworks_mcp/adapters/vba_macro_executor.py
def get_execution_history(
    self, macro_name: str | None = None
) -> dict[
    str,
    MacroExecutionResult,
]:
    """Retrieve macro execution history.

    Args:
        macro_name (str | None): The macro name value. Defaults to None.

    Returns:
        dict[
            str,
            MacroExecutionResult,
        ]: A dictionary containing the
                                                                resulting values.
    """
    if macro_name is not None:
        return (
            {
                macro_name: self._execution_history[macro_name],
            }
            if macro_name in self._execution_history
            else {}
        )
    return dict(self._execution_history)

Functions:

create_adapter async

create_adapter(config: SolidWorksMCPConfig) -> SolidWorksAdapter

Async factory function for creating SolidWorks adapters.

Parameters:

Name Type Description Default
config SolidWorksMCPConfig

Configuration values for the operation.

required

Returns:

Name Type Description
SolidWorksAdapter SolidWorksAdapter

The result produced by the operation.

Source code in src/solidworks_mcp/adapters/factory.py
async def create_adapter(config: SolidWorksMCPConfig) -> SolidWorksAdapter:
    """Async factory function for creating SolidWorks adapters.

    Args:
        config (SolidWorksMCPConfig): Configuration values for the operation.

    Returns:
        SolidWorksAdapter: The result produced by the operation.
    """
    # Register adapters if not already done
    _register_default_adapters()

    # Create adapter using factory
    adapter = AdapterFactory.create_adapter(config)

    return adapter