Skip to content

solidworks_mcp.adapters.connection_pool

solidworks_mcp.adapters.connection_pool

Connection pool adapter for managing multiple SolidWorks connections.

Provides connection pooling capabilities to allow parallel SolidWorks operations when multiple instances are available.

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.

Functions
__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.

ConnectionPool

ConnectionPool(create_connection: Callable[[], object | Awaitable[object]], max_size: int = 3, timeout: float = 30.0)

Legacy alias class expected by tests.

Parameters:

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

Factory callable used to create a connection.

required
max_size int

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

3
timeout float

Maximum time to wait in seconds. Defaults to 30.0.

30.0

Attributes:

Name Type Description
_create_connection Any

The create connection value.

_max_size Any

The max size value.

_timeout Any

The timeout value.

Initialize the connection pool.

Parameters:

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

Factory callable used to create a connection.

required
max_size int

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

3
timeout float

Maximum time to wait in seconds. Defaults to 30.0.

30.0

Returns:

Name Type Description
None None

None.

Source code in src/solidworks_mcp/adapters/connection_pool.py
def __init__(
    self,
    create_connection: Callable[[], object | Awaitable[object]],
    max_size: int = 3,
    timeout: float = 30.0,
) -> None:
    """Initialize the connection pool.

    Args:
        create_connection (Callable[[], object | Awaitable[object]]): Factory callable used
                                                                      to create a
                                                                      connection.
        max_size (int): Maximum number of items allowed in the pool. Defaults to 3.
        timeout (float): Maximum time to wait in seconds. Defaults to 30.0.

    Returns:
        None: None.
    """
    self._create_connection = create_connection
    self._max_size = max_size
    self._timeout = timeout
    self._available: list[object] = []
    self._in_use: set[int] = set()
    self._all_connections: list[object] = []
Attributes
active_connections property
active_connections: int

Provide active connections support for the connection pool.

Returns:

Name Type Description
int int

The computed numeric result.

size property
size: int

Provide size support for the connection pool.

Returns:

Name Type Description
int int

The computed numeric result.

Functions
acquire async
acquire() -> object

Provide acquire support for the connection pool.

Returns:

Name Type Description
object object

The result produced by the operation.

Raises:

Type Description
TimeoutError

No connection available within timeout.

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

    Returns:
        object: The result produced by the operation.

    Raises:
        TimeoutError: No connection available within timeout.
    """
    if self._available:
        conn = self._available.pop()
        self._in_use.add(id(conn))
        return conn

    if len(self._all_connections) < self._max_size:
        conn = await self._new_connection()
        self._in_use.add(id(conn))
        return conn

    end_time = time.time() + self._timeout
    while time.time() < end_time:
        if self._available:
            conn = self._available.pop()
            self._in_use.add(id(conn))
            return conn
        await asyncio.sleep(0.01)

    raise TimeoutError("No connection available within timeout")
cleanup async
cleanup() -> None

Provide cleanup support for the connection pool.

Returns:

Name Type Description
None None

None.

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

    Returns:
        None: None.
    """
    for conn in self._all_connections:
        close = getattr(conn, "close", None)
        if close is None:
            continue
        result = close()
        if asyncio.iscoroutine(result):
            await result

    self._available.clear()
    self._in_use.clear()
    self._all_connections.clear()
release async
release(conn: object) -> None

Provide release support for the connection pool.

Parameters:

Name Type Description Default
conn object

The conn value.

required

Returns:

Name Type Description
None None

None.

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

    Args:
        conn (object): The conn value.

    Returns:
        None: None.
    """
    conn_id = id(conn)
    if conn_id in self._in_use:
        self._in_use.remove(conn_id)
        self._available.append(conn)

ConnectionPoolAdapter

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

Bases: SolidWorksAdapter

Connection pool wrapper for SolidWorks adapters.

Parameters:

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

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

None
pool_size int

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

3
max_retries int

Maximum number of retry attempts. Defaults to 3.

3
create_connection Callable[[], SolidWorksAdapter] | None

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

None
max_size int | None

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

None
timeout float | None

Maximum time to wait in seconds. Defaults to None.

None
config dict[str, object] | None

Configuration values for the operation. Defaults to None.

None

Attributes:

Name Type Description
_lock Any

The lock value.

adapter_factory Any

The adapter factory value.

max_retries Any

The max retries value.

pool_initialized Any

The pool initialized value.

pool_size Any

The pool size value.

timeout Any

The timeout value.

Initialize the connection pool adapter.

Parameters:

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

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

None
pool_size int

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

3
max_retries int

Maximum number of retry attempts. Defaults to 3.

3
create_connection Callable[[], SolidWorksAdapter] | None

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

None
max_size int | None

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

None
timeout float | None

Maximum time to wait in seconds. Defaults to None.

None
config dict[str, object] | None

Configuration values for the operation. Defaults to None.

None

Returns:

Name Type Description
None None

None.

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

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

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

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

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

            return MockSolidWorksAdapter(config or {})

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

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

Provide active connections support for the connection pool adapter.

Returns:

Name Type Description
int int

The computed numeric result.

size property
size: int

Provide size support for the connection pool adapter.

Returns:

Name Type Description
int int

The computed numeric result.

Functions
acquire async
acquire() -> SolidWorksAdapter

Provide acquire support for the connection pool adapter.

Returns:

Name Type Description
SolidWorksAdapter SolidWorksAdapter

The result produced by the operation.

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

    Returns:
        SolidWorksAdapter: The result produced by the operation.
    """
    return await self._get_adapter(timeout=self.timeout)
add_arc async
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float) -> AdapterResult[str]

Add arc using pool.

Parameters:

Name Type Description Default
center_x float

Arc center X coordinate.

required
center_y float

Arc center Y coordinate.

required
start_x float

Arc start X coordinate.

required
start_y float

Arc start Y coordinate.

required
end_x float

Arc end X coordinate.

required
end_y float

Arc end Y coordinate.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_arc(
    self,
    center_x: float,
    center_y: float,
    start_x: float,
    start_y: float,
    end_x: float,
    end_y: float,
) -> AdapterResult[str]:
    """Add arc using pool.

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

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

Add centerline using pool.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_centerline(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add centerline using pool.

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

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

Add circle using pool.

Parameters:

Name Type Description Default
center_x float

The center x value.

required
center_y float

The center y value.

required
radius float

The radius value.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_circle(
    self, center_x: float, center_y: float, radius: float
) -> AdapterResult[str]:
    """Add circle using pool.

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "add_circle", lambda adapter: adapter.add_circle(center_x, center_y, radius)
    )
add_fillet async
add_fillet(radius: float, edge_names: list[str]) -> AdapterResult[SolidWorksFeature]

Add fillet using pool.

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_fillet(
    self, radius: float, edge_names: list[str]
) -> AdapterResult[SolidWorksFeature]:
    """Add fillet using pool."""
    return await self._execute_with_pool(
        "add_fillet", lambda adapter: adapter.add_fillet(radius, edge_names)
    )
add_line async
add_line(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add line using pool.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_line(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add line using pool.

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "add_line", lambda adapter: adapter.add_line(x1, y1, x2, y2)
    )
add_rectangle async
add_rectangle(x1: float, y1: float, x2: float, y2: float) -> AdapterResult[str]

Add rectangle using pool.

Parameters:

Name Type Description Default
x1 float

The x1 value.

required
y1 float

The y1 value.

required
x2 float

The x2 value.

required
y2 float

The y2 value.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def add_rectangle(
    self, x1: float, y1: float, x2: float, y2: float
) -> AdapterResult[str]:
    """Add rectangle using pool.

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

    Returns:
        AdapterResult[str]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "add_rectangle", lambda adapter: adapter.add_rectangle(x1, y1, x2, y2)
    )
add_sketch_dimension async
add_sketch_dimension(entity1: str, entity2: str | None, dimension_type: str, value: float) -> AdapterResult[str]

Add sketch dimension using pool.

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

Check sketch definition status using pool.

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

Provide cleanup support for the connection pool adapter.

Returns:

Name Type Description
None None

None.

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

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

Close model using pool.

Parameters:

Name Type Description Default
save bool

The save value. Defaults to False.

False

Returns:

Type Description
AdapterResult[None]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def close_model(self, save: bool = False) -> AdapterResult[None]:
    """Close model using pool.

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

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

Initialize the connection pool.

Returns:

Name Type Description
None None

None.

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

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

Create assembly using pool.

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/connection_pool.py
async def create_assembly(
    self, name: str | None = None
) -> AdapterResult[SolidWorksModel]:
    """Create assembly using pool.

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

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

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

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

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

    return await self._execute_with_pool("create_assembly", _op)
create_cut_extrude async
create_cut_extrude(params: ExtrusionParameters) -> AdapterResult[SolidWorksFeature]

Create cut-extrude using pool.

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

Create drawing using pool.

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/connection_pool.py
async def create_drawing(
    self, name: str | None = None
) -> AdapterResult[SolidWorksModel]:
    """Create drawing using pool.

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

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

Create extrusion using pool.

Parameters:

Name Type Description Default
params ExtrusionParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_extrusion(
    self, params: ExtrusionParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create extrusion using pool.

    Args:
        params (ExtrusionParameters): The params value.

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

Create loft using pool.

Parameters:

Name Type Description Default
params LoftParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_loft(
    self, params: LoftParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create loft using pool.

    Args:
        params (LoftParameters): The params value.

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

Create part using pool.

Parameters:

Name Type Description Default
name str | None

The name value. Defaults to None.

None
units str | None

The units value. Defaults to None.

None

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

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

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

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

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

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

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

    return await self._execute_with_pool("create_part", _op)
create_revolve async
create_revolve(params: RevolveParameters) -> AdapterResult[SolidWorksFeature]

Create revolve using pool.

Parameters:

Name Type Description Default
params RevolveParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_revolve(
    self, params: RevolveParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create revolve using pool.

    Args:
        params (RevolveParameters): The params value.

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

Create sketch using pool.

Parameters:

Name Type Description Default
plane str

The plane value.

required

Returns:

Type Description
AdapterResult[str]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_sketch(self, plane: str) -> AdapterResult[str]:
    """Create sketch using pool.

    Args:
        plane (str): The plane value.

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

Create sweep using pool.

Parameters:

Name Type Description Default
params SweepParameters

The params value.

required

Returns:

Type Description
AdapterResult[SolidWorksFeature]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def create_sweep(
    self, params: SweepParameters
) -> AdapterResult[SolidWorksFeature]:
    """Create sweep using pool.

    Args:
        params (SweepParameters): The params value.

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

Disconnect all adapters in the pool.

Returns:

Name Type Description
None None

None.

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

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

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

    self.pool.clear()

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

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

Provide execute macro support for the connection pool adapter.

Parameters:

Name Type Description Default
params dict[str, Any]

The params value.

required

Returns:

Type Description
AdapterResult[dict[str, Any]]

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

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

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

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

Exit sketch using pool.

Returns:

Type Description
AdapterResult[None]

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

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

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

Export file using pool.

Parameters:

Name Type Description Default
file_path str

Path to the target file.

required
format_type str

The format type value.

required

Returns:

Type Description
AdapterResult[None]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def export_file(
    self, file_path: str, format_type: str
) -> AdapterResult[None]:
    """Export file using pool.

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

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

Export viewport image using pool.

Parameters:

Name Type Description Default
payload dict

The payload value.

required

Returns:

Type Description
AdapterResult[dict]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def export_image(self, payload: dict) -> AdapterResult[dict]:
    """Export viewport image using pool.

    Args:
        payload (dict): The payload value.

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

Get dimension using pool.

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

    Args:
        name (str): The name value.

    Returns:
        AdapterResult[float]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "get_dimension", lambda adapter: adapter.get_dimension(name)
    )
get_mass_properties async
get_mass_properties() -> AdapterResult[MassProperties]

Get mass properties using pool.

Returns:

Type Description
AdapterResult[MassProperties]

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

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

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

Get active model metadata using pool.

Returns:

Type Description
AdapterResult[dict[str, object]]

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

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

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

Get health status of the connection pool.

Returns:

Name Type Description
AdapterHealth AdapterHealth

The result produced by the operation.

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

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

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

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

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

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

    return AdapterHealth(
        healthy=healthy_count > 0,
        last_check=datetime.now(),
        error_count=len(self.pool) - healthy_count,
        success_count=healthy_count,
        average_response_time=avg_response_time,
        connection_status="pooled",
        metrics={
            "pool_size": len(self.pool),
            "available_adapters": self.available_adapters.qsize(),
            "healthy_adapters": healthy_count,
        },
    )
is_connected
is_connected() -> bool

Check if pool is initialized.

Returns:

Name Type Description
bool bool

True if connected, otherwise False.

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

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

List model configurations using pool.

Returns:

Type Description
AdapterResult[list[str]]

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

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

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

List model features using pool.

Parameters:

Name Type Description Default
include_suppressed bool

The include suppressed value. Defaults to False.

False

Returns:

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

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

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

    Args:
        include_suppressed (bool): The include suppressed value. Defaults to False.

    Returns:
        AdapterResult[list[dict[str, object]]]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "list_features",
        lambda adapter: adapter.list_features(include_suppressed),
    )
open_model async
open_model(file_path: str) -> AdapterResult[SolidWorksModel]

Open model using pool.

Parameters:

Name Type Description Default
file_path str

Path to the target file.

required

Returns:

Type Description
AdapterResult[SolidWorksModel]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def open_model(self, file_path: str) -> AdapterResult[SolidWorksModel]:
    """Open model using pool.

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

    Returns:
        AdapterResult[SolidWorksModel]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "open_model", lambda adapter: adapter.open_model(file_path)
    )
release async
release(adapter: SolidWorksAdapter) -> None

Provide release support for the connection pool adapter.

Parameters:

Name Type Description Default
adapter SolidWorksAdapter

Adapter instance used for the operation.

required

Returns:

Name Type Description
None None

None.

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

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

    Returns:
        None: None.
    """
    await self._return_adapter(adapter)
save_file async
save_file(file_path: str | None = None) -> AdapterResult[None]

Save model using pool.

Parameters:

Name Type Description Default
file_path str | None

Path to the target file. Defaults to None.

None

Returns:

Type Description
AdapterResult[None]

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

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

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "save_file", lambda adapter: adapter.save_file(file_path)
    )
set_dimension async
set_dimension(name: str, value: float) -> AdapterResult[None]

Set dimension using pool.

Parameters:

Name Type Description Default
name str

The name value.

required
value float

The value value.

required

Returns:

Type Description
AdapterResult[None]

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

Source code in src/solidworks_mcp/adapters/connection_pool.py
async def set_dimension(self, name: str, value: float) -> AdapterResult[None]:
    """Set dimension using pool.

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

    Returns:
        AdapterResult[None]: The result produced by the operation.
    """
    return await self._execute_with_pool(
        "set_dimension", lambda adapter: adapter.set_dimension(name, value)
    )

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.

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,
    }
Functions
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_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_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_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",
    )
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_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_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_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
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
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_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_features abstractmethod async
list_features(include_suppressed: bool = False) -> AdapterResult[list[dict[str, Any]]]

List model features from the feature tree.

Parameters:

Name Type Description Default
include_suppressed bool

The include suppressed value. Defaults to False.

False

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
) -> AdapterResult[list[dict[str, Any]]]:
    """List model features from the feature tree.

    Args:
        include_suppressed (bool): The include suppressed value. Defaults to False.

    Returns:
        AdapterResult[list[dict[str, Any]]]: The result produced by the operation.
    """
    pass
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
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
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",
    )
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.

Functions
__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.

Functions
__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.