Skip to content

solidworks_mcp.adapters.circuit_breaker

solidworks_mcp.adapters.circuit_breaker

Circuit breaker adapter for SolidWorks operations.

Implements the circuit breaker pattern to prevent cascading failures when SolidWorks operations fail repeatedly.

Attributes

T module-attribute

T = TypeVar('T')

Classes

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)

Bases: Generic[T]

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.

AdapterResultStatus

Bases: StrEnum

Result status for adapter operations.

Attributes:

Name Type Description
ERROR Any

The error value.

SUCCESS Any

The success value.

TIMEOUT Any

The timeout value.

WARNING Any

The warning value.

CircuitBreaker

CircuitBreaker(failure_threshold: int = 5, recovery_timeout: float = 60.0, expected_exception: type[Exception] = Exception)

Legacy standalone circuit breaker class expected by tests.

Parameters:

Name Type Description Default
failure_threshold int

The failure threshold value. Defaults to 5.

5
recovery_timeout float

The recovery timeout value. Defaults to 60.0.

60.0
expected_exception type[Exception]

The expected exception value. Defaults to Exception.

Exception

Attributes:

Name Type Description
expected_exception Any

The expected exception value.

failure_count Any

The failure count value.

failure_threshold Any

The failure threshold value.

last_failure_time Any

The last failure time value.

recovery_timeout Any

The recovery timeout value.

state Any

The state value.

Initialize the circuit breaker.

Parameters:

Name Type Description Default
failure_threshold int

The failure threshold value. Defaults to 5.

5
recovery_timeout float

The recovery timeout value. Defaults to 60.0.

60.0
expected_exception type[Exception]

The expected exception value. Defaults to Exception.

Exception

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
def __init__(
    self,
    failure_threshold: int = 5,
    recovery_timeout: float = 60.0,
    expected_exception: type[Exception] = Exception,
) -> None:
    """Initialize the circuit breaker.

    Args:
        failure_threshold (int): The failure threshold value. Defaults to 5.
        recovery_timeout (float): The recovery timeout value. Defaults to 60.0.
        expected_exception (type[Exception]): The expected exception value. Defaults to
                                              Exception.

    Returns:
        None: None.
    """
    self.failure_threshold = failure_threshold
    self.recovery_timeout = recovery_timeout
    self.expected_exception = expected_exception
    self.state = CircuitState.CLOSED
    self.failure_count = 0
    self.last_failure_time = 0.0
Methods:
call async
call(operation: Callable[[], object | Awaitable[object]]) -> object

Provide call support for the circuit breaker.

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
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:
    """Provide call support for the circuit breaker.

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

    Returns:
        object: The result produced by the operation.

    Raises:
        Exception: Circuit breaker is open.
    """
    if self.state == CircuitState.OPEN:
        if time.time() - self.last_failure_time < self.recovery_timeout:
            raise Exception("Circuit breaker is open")
        self.state = CircuitState.HALF_OPEN

    try:
        result = operation()
        if asyncio.iscoroutine(result):
            result = await result
        self.state = CircuitState.CLOSED
        self.failure_count = 0
        return result
    except self.expected_exception:
        self.failure_count += 1
        self.last_failure_time = time.time()
        if self.failure_count >= self.failure_threshold:
            self.state = CircuitState.OPEN
        raise

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]) -> 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]
) -> AdapterResult[SolidWorksFeature]:
    """Add chamfer through circuit breaker."""
    return await self._execute_with_circuit_breaker(
        "add_chamfer",
        lambda: self.adapter.add_chamfer(distance, edge_names),
        input_dict={"distance": distance, "edge_names": edge_names},
    )
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_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_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) -> 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

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

    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,
        ),
        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,
        },
    )
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},
    )
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) -> AdapterResult[SolidWorksModel]

Create assembly through circuit breaker.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

    Args:
        name (str | None): The name value. 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 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}
    )
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) -> AdapterResult[SolidWorksModel]

Create drawing through circuit breaker.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

    Args:
        name (str | None): The name value. 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),
        input_dict={"name": name},
    )
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) -> 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

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

    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 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}
    )
create_reference_plane async
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False) -> AdapterResult[dict[str, Any]]

Create 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,
) -> 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),
        input_dict={
            "reference": reference,
            "offset": offset,
            "angle": angle,
            "flip": flip,
        },
    )
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_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_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_dimension async
get_dimension(name: str) -> AdapterResult[float]

Get dimension through circuit breaker.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Type Description
AdapterResult[float]

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

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

    Args:
        name (str): The name value.

    Returns:
        AdapterResult[float]: The result produced by the operation.
    """
    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_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={},
    )
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_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},
    )
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_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_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={},
    )
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,
        },
    )
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},
    )
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},
    )
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_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},
    )

CircuitState

Bases: Enum

Circuit breaker states.

Attributes:

Name Type Description
CLOSED Any

The closed value.

HALF_OPEN Any

The half open value.

OPEN Any

The open value.

ExtrusionParameters

Bases: BaseModel

Parameters for extrusion operations.

Attributes:

Name Type Description
auto_select bool

The auto select value.

both_directions bool

The both directions value.

depth float

The depth value.

draft_angle float

The draft angle value.

end_condition str

The end condition value.

feature_scope bool

The feature scope value.

merge_result bool

The merge result value.

reverse_direction bool

The reverse direction value.

sketch_name str | None

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

thin_feature bool

The thin feature value.

thin_thickness float | None

The thin thickness value.

up_to_surface str | None

The up to surface value.

LoftParameters

Bases: BaseModel

Parameters for loft operations.

Attributes:

Name Type Description
end_tangent str | None

The end tangent value.

guide_curves list[str] | None

The guide curves value.

merge_result bool

The merge result value.

profiles list[str]

The profiles value.

start_tangent str | None

The start tangent value.

MassProperties

Bases: BaseModel

Mass properties information.

Attributes:

Name Type Description
center_of_mass list[float]

The center of mass value.

mass float

The mass value.

moments_of_inertia dict[str, float]

The moments of inertia value.

principal_axes dict[str, list[float]] | None

The principal axes value.

surface_area float

The surface area value.

volume float

The volume value.

RevolveParameters

Bases: BaseModel

Parameters for revolve operations.

Attributes:

Name Type Description
angle float

The angle value.

both_directions bool

The both directions value.

merge_result bool

The merge result value.

reverse_direction bool

The reverse direction value.

thin_feature bool

The thin feature value.

thin_thickness float | None

The thin thickness value.

SolidWorksAdapter

SolidWorksAdapter(config: object | None = None)

Bases: ABC

Base adapter interface for SolidWorks integration.

Parameters:

Name Type Description Default
config object | None

Configuration values for the operation. Defaults to None.

None

Attributes:

Name Type Description
_metrics Any

The metrics value.

config Any

The config value.

config_dict Any

The config dict value.

Initialize adapter with configuration.

Parameters:

Name Type Description Default
config object | None

Configuration values for the operation. Defaults to None.

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

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

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

Make an already-open document the active one.

Parameters:

Name Type Description Default
title_or_path str

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

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: What was activated, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="activate_document is not implemented by this adapter",
    )
add_arc async
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float) -> AdapterResult[str]

Add an arc to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
start_x float

The start x value.

required
start_y float

The start y value.

required
end_x float

The end x value.

required
end_y float

The end y value.

required

Returns:

Type Description
AdapterResult[str]

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

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

    Args:
        center_x (float): The center x value.
        center_y (float): The center y value.
        start_x (float): The start x value.
        start_y (float): The start y value.
        end_x (float): The end x value.
        end_y (float): The end y value.

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

Add a centerline to the current sketch.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Add an equal-distance chamfer feature to selected edges.

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

Parameters:

Name Type Description Default
distance float

Chamfer distance in millimeters.

required
edge_names list[str]

List of edge names to chamfer.

required

Returns:

Name Type Description
AdapterResult AdapterResult[Any]

Feature result or error.

Source code in src/solidworks_mcp/adapters/base.py
async def add_chamfer(
    self, distance: float, edge_names: list[str]
) -> AdapterResult[Any]:
    """Add an equal-distance chamfer feature to selected edges.

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

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

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

Add a circle to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
radius float

The radius value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

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

Parameters:

Name Type Description Default
payload Any

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

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The new view's details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_drawing_view is not implemented by this adapter",
    )
add_ellipse async
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float) -> AdapterResult[str]

Add an ellipse to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
major_axis float

The major axis value.

required
minor_axis float

The minor axis value.

required

Returns:

Type Description
AdapterResult[str]

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

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

    Args:
        center_x (float): The center x value.
        center_y (float): The center y value.
        major_axis (float): The major axis value.
        minor_axis (float): The minor axis value.

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

Add a fillet feature to selected edges.

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

Parameters:

Name Type Description Default
radius float

Fillet radius in millimeters.

required
edge_names list[str]

List of edge names to fillet.

required

Returns:

Name Type Description
AdapterResult AdapterResult[Any]

Feature result or error.

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

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

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

    Returns:
        AdapterResult: Feature result or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_fillet is not implemented by this adapter",
    )
add_line abstractmethod async
add_line(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add a line to the current sketch.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Mate two components together in the active assembly.

Parameters:

Name Type Description Default
component_a str

First component instance name.

required
component_b str

Second component instance name.

required
entity_a str

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

'Front Plane'
entity_b str

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

'Front Plane'
mate_type str

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

'coincident'
alignment str

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

'aligned'
distance float

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

0.0
angle float

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

0.0

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

    Args:
        component_a (str): First component instance name.
        component_b (str): Second component instance name.
        entity_a (str): Named feature on the first component. Defaults to
            "Front Plane".
        entity_b (str): Named feature on the second component. Defaults to
            "Front Plane".
        mate_type (str): Mate type, e.g. ``coincident``. Defaults to
            "coincident".
        alignment (str): ``aligned``, ``anti_aligned`` or ``closest``.
            Defaults to "aligned".
        distance (float): Distance in millimetres, for a distance mate.
            Defaults to 0.0.
        angle (float): Angle in degrees, for an angle mate. Defaults to 0.0.

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

Place a text note on the active drawing sheet.

Parameters:

Name Type Description Default
payload Any

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

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Add a regular polygon to the current sketch.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
radius float

The radius value.

required
sides int

The sides value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Add a rectangle to the current sketch.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    pass
add_sketch_circle async
add_sketch_circle(center_x: float, center_y: float, radius: float, construction: bool = False) -> AdapterResult[str]

Alias for add_circle used by some tool flows.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
radius float

The radius value.

required
construction bool

The construction value. Defaults to False.

False

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Apply a geometric constraint between sketch entities.

Parameters:

Name Type Description Default
entity1 str

The entity1 value.

required
entity2 str | None

The entity2 value.

required
relation_type str

The relation type value.

required
entity3 str | None

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

None

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Add a sketch dimension.

Parameters:

Name Type Description Default
entity1 str

The entity1 value.

required
entity2 str | None

The entity2 value.

required
dimension_type str

The dimension type value.

required
value float

The value value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Add a spline through the provided points.

Parameters:

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

The points value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="add_spline is not implemented by this adapter",
    )
auto_center_marks async
auto_center_marks(view_name: str, mark_holes: bool = True, mark_fillets: bool = False, mark_slots: bool = True) -> AdapterResult[dict[str, Any]]

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

Parameters:

Name Type Description Default
view_name str

Name of a view on the active drawing.

required
mark_holes bool

Mark holes / bores.

True
mark_fillets bool

Mark fillets.

False
mark_slots bool

Mark slots.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

counts, or error.

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

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

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

Check the active assembly for interfering components.

Parameters:

Name Type Description Default
params Any

Optional settings; coincident, components.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Check whether a sketch is fully defined.

Parameters:

Name Type Description Default
sketch_name str | None

Optional sketch name to inspect. Defaults to None.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Close the current model.

Parameters:

Name Type Description Default
save bool

The save value. Defaults to False.

False

Returns:

Type Description
AdapterResult[None]

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

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

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

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

Connect to SolidWorks application.

Returns:

Name Type Description
None None

None.

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

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

Create a new assembly document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

    Args:
        name (str | None): The name value. Defaults to None.

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

Create a reference axis along a principal direction.

Parameters:

Name Type Description Default
reference str

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

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The plane pair used and feature counts, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_axis is not implemented by this adapter",
    )
create_cut async
create_cut(sketch_name: str, depth: float) -> AdapterResult[str]

Create a cut feature from an existing sketch.

Parameters:

Name Type Description Default
sketch_name str

The sketch name value.

required
depth float

The depth value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Create a cut-extrude feature from the active sketch.

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

Parameters:

Name Type Description Default
params ExtrusionParameters

Depth and direction parameters.

required

Returns:

Name Type Description
AdapterResult AdapterResult[Any]

Feature result or error.

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

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

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

    Returns:
        AdapterResult: Feature result or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_cut_extrude is not implemented by this adapter",
    )
create_drawing abstractmethod async
create_drawing(name: str | None = None) -> AdapterResult[SolidWorksModel]

Create a new drawing document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

    Args:
        name (str | None): The name value. Defaults to None.

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

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

Parameters:

Name Type Description Default
payload Any

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

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: The new view's details, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="create_drawing_view is not implemented by this adapter",
    )
create_extrusion abstractmethod async
create_extrusion(params: ExtrusionParameters) -> AdapterResult[SolidWorksFeature]

Create an extrusion feature.

Parameters:

Name Type Description Default
params ExtrusionParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

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

    Args:
        params (ExtrusionParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    pass
create_loft abstractmethod async
create_loft(params: LoftParameters) -> AdapterResult[SolidWorksFeature]

Create a loft feature.

Parameters:

Name Type Description Default
params LoftParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

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

    Args:
        params (LoftParameters): The params value.

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

Create a new part document.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
units str | None

The units value. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

    Args:
        name (str | None): The name value. Defaults to None.
        units (str | None): The units value. Defaults to None.

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

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

Parameters:

Name Type Description Default
reference str

Name of the reference plane or planar face.

required
offset float

Offset distance in millimetres. Defaults to 0.0.

0.0
angle float

Angle in degrees. Defaults to 0.0.

0.0
flip bool

Reverse the offset or angle direction. Defaults to False.

False

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Create a reference point on the active part.

Parameters:

Name Type Description Default
mode str

"along_curve" or "face_center".

required
x float

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

required
y float

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

required
z float

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

required
distance float | None

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

None
percent float | None

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

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Create a revolve feature.

Parameters:

Name Type Description Default
params RevolveParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

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

    Args:
        params (RevolveParameters): The params value.

    Returns:
        AdapterResult[SolidWorksFeature]: The result produced by the operation.
    """
    pass
create_sketch abstractmethod async
create_sketch(plane: str) -> AdapterResult[str]

Create a new sketch on the specified plane.

Parameters:

Name Type Description Default
plane str

The plane value.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/base.py
@abstractmethod
async def create_sketch(self, plane: str) -> AdapterResult[str]:
    """Create a new sketch on the specified plane.

    Args:
        plane (str): The plane value.

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    pass
create_sweep abstractmethod async
create_sweep(params: SweepParameters) -> AdapterResult[SolidWorksFeature]

Create a sweep feature.

Parameters:

Name Type Description Default
params SweepParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

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

    Args:
        params (SweepParameters): The params value.

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

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

Parameters:

Name Type Description Default
payload Any

Tool payload carrying the model path and the projection angle.

None

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Delete a named feature or sketch from the active model.

Parameters:

Name Type Description Default
name str

Feature or sketch name.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Disconnect from SolidWorks application.

Returns:

Name Type Description
None None

None.

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

    Returns:
        None: None.
    """
    pass
exit_sketch abstractmethod async
exit_sketch() -> AdapterResult[None]

Exit sketch editing mode.

Returns:

Type Description
AdapterResult[None]

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

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

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

Export the current model to a file.

Parameters:

Name Type Description Default
file_path str

Path to the target file.

required
format_type str

The format type value.

required

Returns:

Type Description
AdapterResult[None]

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

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

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

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

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

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

Parameters:

Name Type Description Default
payload dict

The payload value.

required

Returns:

Type Description
AdapterResult[dict]

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

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

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

    Args:
        payload (dict): The payload value.

    Returns:
        AdapterResult[dict]: The result produced by the operation.
    """
    pass
get_dimension abstractmethod async
get_dimension(name: str) -> AdapterResult[float]

Get the value of a dimension.

Parameters:

Name Type Description Default
name str

The name value.

required

Returns:

Type Description
AdapterResult[float]

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

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

    Args:
        name (str): The name value.

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

Get mass properties of the current model.

Returns:

Type Description
AdapterResult[MassProperties]

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

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

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

Get adapter metrics.

Returns:

Type Description
dict[str, Any]

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

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

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

Get metadata for the active model.

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

Get adapter health status.

Returns:

Name Type Description
AdapterHealth AdapterHealth

The result produced by the operation.

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

    Returns:
        AdapterHealth: The result produced by the operation.
    """
    pass
insert_component async
insert_component(file_path: str, x: float = 0.0, y: float = 0.0, z: float = 0.0) -> AdapterResult[dict[str, Any]]

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

Parameters:

Name Type Description Default
file_path str

Absolute path to the .sldprt or .sldasm.

required
x float

X position in millimetres. Defaults to 0.0.

0.0
y float

Y position in millimetres. Defaults to 0.0.

0.0
z float

Z position in millimetres. Defaults to 0.0.

0.0

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

    Returns:
        AdapterResult[dict[str, Any]]: Component name and counts, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="insert_component is not implemented by this adapter",
    )
is_connected abstractmethod
is_connected() -> bool

Check if connected to SolidWorks.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

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

    Returns:
        bool: True if connected, otherwise False.
    """
    pass
list_components async
list_components() -> AdapterResult[list[str]]

List the top-level components of the active assembly.

Returns:

Type Description
AdapterResult[list[str]]

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

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

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

List configuration names for the active model.

Returns:

Type Description
AdapterResult[list[str]]

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

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

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

List the views on the active drawing.

Returns:

Type Description
AdapterResult[list[str]]

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

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

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

List model features from the feature tree.

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

Parameters:

Name Type Description Default
include_suppressed bool

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

False
max_assembly_depth int

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

2

Returns:

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

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

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

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

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

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

Enumerate every document currently open in SolidWorks.

Returns:

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

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

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

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

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

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

Mirror solid bodies or features about a plane.

Parameters:

Name Type Description Default
features list[str]

Body or feature names to mirror.

required
mirror_plane str

Plane name to mirror about.

required
merge bool

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

True
mirror_bodies bool

Mirror whole bodies rather than features. Defaults to True.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

before/after, or error.

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

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

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

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

Parameters:

Name Type Description Default
file_path str

Path to the target file.

required

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    pass
pattern_circular async
pattern_circular(features: list[str], axis: str, count: int, angle: float = 360.0, equal_spacing: bool = True) -> AdapterResult[dict[str, Any]]

Pattern features around an axis.

Parameters:

Name Type Description Default
features list[str]

Names of the features to pattern.

required
axis str

Name of the axis to rotate about.

required
count int

Total number of instances including the original.

required
angle float

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

360.0
equal_spacing bool

Space instances evenly across angle. Defaults to True.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

before/after, or error.

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

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

    Returns:
        AdapterResult[dict[str, Any]]: What was patterned and the volume
        before/after, or error.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="pattern_circular is not implemented by this adapter",
    )
rename_feature async
rename_feature(old_name: str, new_name: str) -> AdapterResult[dict[str, Any]]

Rename an existing feature on the feature tree.

Parameters:

Name Type Description Default
old_name str

Current feature name.

required
new_name str

New feature name.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

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

Parameters:

Name Type Description Default
body_name str

Name of a solid body in the active part.

required
file_path str

Absolute path for the new .sldprt.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

AdapterResult[dict[str, Any]]

solid-body names found, or error.

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

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

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

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

Parameters:

Name Type Description Default
file_path str | None

Path to the target file. Defaults to None.

None

Returns:

Type Description
AdapterResult[Any]

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

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

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

    Returns:
        AdapterResult[Any]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="save_file is not implemented by this adapter",
    )
set_dimension abstractmethod async
set_dimension(name: str, value: float) -> AdapterResult[None]

Set the value of a dimension.

Parameters:

Name Type Description Default
name str

The name value.

required
value float

The value value.

required

Returns:

Type Description
AdapterResult[None]

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

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

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

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

Set the active document's linear unit system.

Parameters:

Name Type Description Default
unit_system str

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

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

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

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

Parameters:

Name Type Description Default
entities list[str]

The entities value.

required
angle float

The angle value.

required
count int

The count value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return AdapterResult(
        status=AdapterResultStatus.ERROR,
        error="sketch_circular_pattern is not implemented by this adapter",
    )
sketch_linear_pattern async
sketch_linear_pattern(entities: list[str], direction_x: float, direction_y: float, spacing: float, count: int) -> AdapterResult[str]

Create a linear pattern of sketch entities.

Parameters:

Name Type Description Default
entities list[str]

The entities value.

required
direction_x float

The direction x value.

required
direction_y float

The direction y value.

required
spacing float

The spacing value.

required
count int

The count value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Mirror sketch entities about a mirror line.

Parameters:

Name Type Description Default
entities list[str]

The entities value.

required
mirror_line str

The mirror line value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Offset sketch entities.

Parameters:

Name Type Description Default
entities list[str]

The entities value.

required
offset_distance float

The offset distance value.

required
reverse_direction bool

The reverse direction value.

required

Returns:

Type Description
AdapterResult[str]

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

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

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

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

Suppress or unsuppress a named feature.

Parameters:

Name Type Description Default
name str

Feature name.

required
suppress bool

True to suppress, False to unsuppress.

True

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Undo the last operations in the active model.

Parameters:

Name Type Description Default
count int

Number of steps to undo.

1

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Update adapter metrics.

Parameters:

Name Type Description Default
operation_time float

The operation time value.

required
success bool

The success value.

required

Returns:

Name Type Description
None None

None.

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

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

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

    # Update average response time
    current_avg = self._metrics["average_response_time"]
    count = self._metrics["operations_count"]
    self._metrics["average_response_time"] = (
        current_avg * (count - 1) + operation_time
    ) / count

SolidWorksFeature

Bases: BaseModel

SolidWorks feature information.

Attributes:

Name Type Description
id str | None

The id value.

name str

The name value.

parameters dict[str, Any] | None

The parameters value.

parent str | None

The parent value.

properties dict[str, Any] | None

The properties value.

type str

The type value.

Methods:
__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 self.parameters and key in self.parameters:
        return self.parameters.get(key)
    return self.model_dump().get(key)

SolidWorksModel

Bases: BaseModel

SolidWorks model information.

Attributes:

Name Type Description
configuration str | None

The configuration value.

is_active bool

The is active value.

name str

The name value.

path str

The path value.

properties dict[str, Any] | None

The properties value.

type str

The type value.

Methods:
__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 == "title":
        return self.name
    if key == "units":
        return (self.properties or {}).get("units")
    return self.model_dump().get(key)

SweepParameters

Bases: BaseModel

Parameters for sweep operations.

Attributes:

Name Type Description
merge_result bool

The merge result value.

path str

The path value.

twist_along_path bool

The twist along path value.

twist_angle float

The twist angle value.

_BreakerBucket

_BreakerBucket()

Per-operation circuit breaker state.

Attributes:

Name Type Description
state CircuitState

The current state of this bucket.

failure_count int

Consecutive failures recorded in CLOSED/OPEN.

last_failure_time float

time.time() of the most recent failure.

half_open_calls int

Calls let through since entering HALF_OPEN.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
def __init__(self) -> None:
    self.state = CircuitState.CLOSED
    self.failure_count = 0
    self.last_failure_time: float = 0.0
    self.half_open_calls = 0

Functions:

_to_input_dict

_to_input_dict(params: Any) -> dict[str, Any]

Convert a Pydantic model or plain dict to a flat dict for SoC logging.

Source code in src/solidworks_mcp/adapters/circuit_breaker.py
def _to_input_dict(params: Any) -> dict[str, Any]:
    """Convert a Pydantic model or plain dict to a flat dict for SoC logging."""
    if hasattr(params, "model_dump"):
        return cast(dict[str, Any], params.model_dump())
    return cast(dict[str, Any], params) if isinstance(params, dict) else {}