solidworks_mcp.tools.docs_discovery¶
solidworks_mcp.tools.docs_discovery ¶
Docs discovery tool for SolidWorks COM and VBA command indexing.
Builds an index of every SolidWorks COM interface, with each member's signature and description, from the registered SolidWorks type library, plus the VBA library references in the registry. The API lookup tools answer from that index and build it themselves the first time, so an agent never has to prepare anything: SolidWorks only has to be installed.
Index records (:mod:.type_library) and lookup results (below) are Pydantic
models; the tools return them as plain dicts with model_dump(), like
every other tool in the package.
Attributes¶
ApiMember
module-attribute
¶
_LEGACY_INDEX_DIRS
module-attribute
¶
_LEGACY_INDEX_DIRS = (Path('.generated/docs-index'), Path('tests/.generated/solidworks_integration/docs-index'), Path('tests/.generated/docs-index'))
_LookupResultT
module-attribute
¶
_LookupResultT = TypeVar('_LookupResultT', MemberLookup, InterfaceLookup, EnumLookup, RelatedLookup)
_MEMBER
module-attribute
¶
_MEMBER_LISTS
module-attribute
¶
_MEMBER_LISTS: tuple[tuple[MemberType, str], ...] = (('method', 'methods'), ('property', 'properties'))
Classes¶
ApiEnum ¶
Bases: BaseModel
One SolidWorks enum in the index.
Attributes:
| Name | Type | Description |
|---|---|---|
description |
str | None
|
The type library's help string, if any. |
members |
list[ApiEnumMember]
|
Its members in declaration order. |
ApiEnumMember ¶
Bases: BaseModel
One member of a SolidWorks enum.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The member's name, e.g. |
value |
int
|
Its integer value. |
ApiIndexInput ¶
Bases: CompatInput
Fields every API lookup takes to choose the index it answers from.
Attributes:
| Name | Type | Description |
|---|---|---|
year |
int | None
|
The SolidWorks year whose API to answer for. |
index_file |
str | None
|
A saved index to answer from instead. |
ApiMethod ¶
Bases: BaseModel
A SolidWorks API method and its signature.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['method']
|
Always |
description |
str
|
The library's one-line help string. |
parameters |
list[ApiParameter]
|
The parameters, in call order. |
return_type |
str | None
|
What it returns; None for nothing. |
ApiParameter ¶
Bases: BaseModel
One parameter of a SolidWorks API method.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The parameter name as the type library spells it. |
type |
str
|
Its VBA type or interface name. |
direction |
Direction
|
Whether the caller passes it, SolidWorks fills it, or both. |
ApiProperty ¶
Bases: BaseModel
A SolidWorks API property.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['property']
|
Always |
description |
str
|
The library's one-line help string. |
type |
str | None
|
The value's type. |
access |
Access
|
Whether it can be read, written or both. |
CompatInput ¶
Bases: BaseModel
Base schema allowing legacy/extra fields used by existing tests.
Attributes:
| Name | Type | Description |
|---|---|---|
model_config |
Any
|
The model config value. |
DiscoverDocsInput ¶
Bases: CompatInput
Input schema for discover_solidworks_docs.
Attributes:
| Name | Type | Description |
|---|---|---|
output_dir |
str | None
|
Folder to save the index in. |
include_vba |
bool
|
Whether to scan for VBA library references. |
year |
int | None
|
The SolidWorks year whose type library to read. |
EnumLookup ¶
Bases: BaseModel
get_api_enum's result.
Attributes:
| Name | Type | Description |
|---|---|---|
found |
bool
|
Whether an enum or member of that name is indexed. |
name |
str
|
The name asked for. |
enum |
str | None
|
The enum, as SolidWorks spells it. |
matched_member |
str | None
|
The member asked for, when the name was a member's. |
description |
str | None
|
The enum's help string, if any. |
members |
list[ApiEnumMember] | None
|
Its members and their values. |
note |
str | None
|
Why there's no match. |
FindRelatedApiInput ¶
Bases: ApiIndexInput
Input schema for find_related_api_members.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
An interface or member name to find relatives of. |
max_results |
int
|
How many related members to return at most. |
GetApiEnumInput ¶
Bases: ApiIndexInput
Input schema for get_api_enum.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
An enum name, or one of its members' names. |
InterfaceLookup ¶
Bases: BaseModel
lookup_api_interface's result.
Attributes:
| Name | Type | Description |
|---|---|---|
found |
bool
|
Whether the interface is indexed. |
interface |
str
|
Its name, as SolidWorks spells it when found. |
methods |
list[str] | None
|
Its method names. |
properties |
list[str] | None
|
Its property names. |
method_count |
int | None
|
How many methods. |
property_count |
int | None
|
How many properties. |
note |
str | None
|
Why no index could be built. |
LookupApiInterfaceInput ¶
Bases: ApiIndexInput
Input schema for lookup_api_interface.
Attributes:
| Name | Type | Description |
|---|---|---|
interface |
str
|
The COM interface whose members to list. |
LookupApiMethodInput ¶
Bases: ApiIndexInput
Input schema for lookup_api_method.
Attributes:
| Name | Type | Description |
|---|---|---|
interface |
str
|
The COM interface the member is on. |
method |
str
|
The method or property name. |
MemberLookup ¶
Bases: BaseModel
lookup_api_method's result: one member's signature, or no match.
Attributes:
| Name | Type | Description |
|---|---|---|
found |
bool
|
Whether the member is on the interface. |
interface |
str
|
The interface, as SolidWorks spells it when found. |
method |
str | None
|
The name asked for, on a no-match. |
member |
str | None
|
The member's real name. |
member_type |
MemberType | None
|
|
signature_indexed |
bool | None
|
Always true on a match. |
description |
str | None
|
The help string. |
parameters |
list[ApiParameter] | None
|
The parameters. |
return_type |
str | None
|
The return type (a property's value type). |
access |
Access | None
|
A property's access. |
note |
str | None
|
Why there's no match, or a casing difference. |
RelatedLookup ¶
Bases: BaseModel
find_related_api_members's result.
Attributes:
| Name | Type | Description |
|---|---|---|
found |
bool
|
Whether anything related was found. |
query |
str
|
The name asked for. |
resolved_as |
str
|
How the name was read. |
related |
list[RelatedMember]
|
The related members. |
note |
str | None
|
Why no index could be built. |
RelatedMember ¶
Bases: BaseModel
One member find_related_api_members returns.
Attributes:
| Name | Type | Description |
|---|---|---|
object |
str
|
The interface it is on. |
member |
str
|
Its name. |
member_type |
MemberType
|
|
reason |
str
|
Why it is related. |
SearchApiHelpInput ¶
Bases: ApiIndexInput
Input schema for search_solidworks_api_help.
Attributes:
| Name | Type | Description |
|---|---|---|
query |
str
|
Words to search member and interface names for. |
max_results |
int
|
How many matches to return at most. |
auto_discover_if_missing |
bool
|
Accepted for old callers; unused. |
SearchMatch ¶
Bases: BaseModel
One search_solidworks_api_help match.
Attributes:
| Name | Type | Description |
|---|---|---|
object |
str
|
The interface, or |
member |
str
|
The member or library name. |
member_type |
str
|
|
score |
int
|
Relevance; higher is better. |
status |
str | None
|
A VBA library's status. |
SolidWorksAdapter ¶
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
Methods:¶
activate_configuration
async
¶
Make a configuration active.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
activate_document
async
¶
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
active_configuration
async
¶
Read the active configuration's name.
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
add_arc
async
¶
add_arc(center_x: float, center_y: float, start_x: float, start_y: float, end_x: float, end_y: float, kind: str = 'center', through: tuple[float, float] | None = None) -> AdapterResult[str]
Add an arc to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
start_x
|
float
|
The start x value. |
required |
start_y
|
float
|
The start y value. |
required |
end_x
|
float
|
The end x value. |
required |
end_y
|
float
|
The end y value. |
required |
kind
|
str
|
|
'center'
|
through
|
tuple[float, float] | None
|
A point on a three-point arc. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_balloons
async
¶
Number a drawing view's parts with balloons, one per part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
view_name
|
str
|
The drawing view. |
required |
layout
|
str
|
|
'square'
|
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
add_centerline
async
¶
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
add_chamfer
async
¶
add_chamfer(distance: float, edge_names: list[str], angle: float = 45.0, flip: bool = False) -> AdapterResult[Any]
Add an angle-distance chamfer to the named or selected edges.
At the default 45 degrees both legs equal distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
distance
|
float
|
Chamfer distance in millimeters, along one face. |
required |
edge_names
|
list[str]
|
List of edge names to chamfer. |
required |
angle
|
float
|
Chamfer angle in degrees. Defaults to 45. |
45.0
|
flip
|
bool
|
Measure |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
AdapterResult |
AdapterResult[Any]
|
Feature result or error. |
Source code in src/solidworks_mcp/adapters/base.py
add_circle
abstractmethod
async
¶
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
add_cosmetic_thread
async
¶
add_cosmetic_thread(edge_point: list[float], size: str, diameter: float, end_type: str = 'blind', depth: float | None = None, standard: str = 'iso') -> AdapterResult[dict[str, Any]]
Add a cosmetic thread on a circular edge.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
add_datum_tag
async
¶
add_datum_tag(label: str, attach_at_mm: tuple[float, float], x_mm: float, y_mm: float) -> AdapterResult[dict[str, Any]]
Add a datum feature symbol on a drawing edge.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
add_dimension
async
¶
add_dimension(dimension_type: str, entity1_point: list[float], position: list[float], entity2_point: list[float] | None = None) -> AdapterResult[dict[str, Any]]
Add one dimension between drawing entities picked at sheet points.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
add_draft
async
¶
add_draft(angle: float, faces: list[list[float]], neutral_face: list[float], reverse: bool = False) -> AdapterResult[dict[str, Any]]
Draft faces against a neutral face.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
add_drawing_view
async
¶
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
add_edge_flange
async
¶
add_edge_flange(edge_point: list[float], length: float, angle: float = 90.0, bend_radius: float | None = None, flip: bool = False) -> AdapterResult[dict[str, Any]]
A flange off the sheet edge nearest a point.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
add_ellipse
async
¶
add_ellipse(center_x: float, center_y: float, major_axis: float, minor_axis: float, angle: float = 0.0) -> AdapterResult[str]
Add an ellipse to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
major_axis
|
float
|
The major axis value. |
required |
minor_axis
|
float
|
The minor axis value. |
required |
angle
|
float
|
The major axis's turn from +x, in degrees. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_fillet
async
¶
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
add_gtol
async
¶
add_gtol(characteristic: str, tolerance: float, x_mm: float, y_mm: float, diameter_zone: bool = False, material_condition: str = 'none', datums: list[str] | None = None, attach_at_mm: tuple[float, float] | None = None, dimension: tuple[str, str] | None = None) -> AdapterResult[dict[str, Any]]
Add a GD&T feature control frame to the active drawing.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
add_line
abstractmethod
async
¶
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
add_mate
async
¶
add_mate(component_a: str, component_b: str, entity_a: str = 'Front Plane', entity_b: str = 'Front Plane', mate_type: str = 'coincident', alignment: str = 'aligned', distance: float = 0.0, angle: float = 0.0, face_a: list[float] | None = None, face_b: list[float] | None = None) -> AdapterResult[dict[str, Any]]
Mate two components together in the active assembly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component_a
|
str
|
First component instance name. |
required |
component_b
|
str
|
Second component instance name. |
required |
entity_a
|
str
|
Named feature on the first component. Defaults to "Front Plane". |
'Front Plane'
|
entity_b
|
str
|
Named feature on the second component. Defaults to "Front Plane". |
'Front Plane'
|
mate_type
|
str
|
Mate type, e.g. |
'coincident'
|
alignment
|
str
|
|
'aligned'
|
distance
|
float
|
Distance in millimetres, for a distance mate. Defaults to 0.0. |
0.0
|
angle
|
float
|
Angle in degrees, for an angle mate. Defaults to 0.0. |
0.0
|
face_a
|
list[float] | None
|
A point on a face of the first
component, in its part coordinates (mm), used instead of
|
None
|
face_b
|
list[float] | None
|
The same for the second component. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Mate details, or error. |
Source code in src/solidworks_mcp/adapters/base.py
add_note
async
¶
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
add_polygon
async
¶
add_polygon(center_x: float, center_y: float, radius: float, sides: int, angle: float = 0.0) -> AdapterResult[str]
Add a regular polygon to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
center_x
|
float
|
The center x value. |
required |
center_y
|
float
|
The center y value. |
required |
radius
|
float
|
The radius value. |
required |
sides
|
int
|
The sides value. |
required |
angle
|
float
|
Degrees the first vertex is turned from +x. |
0.0
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_rectangle
abstractmethod
async
¶
add_rectangle(x1: float, y1: float, x2: float, y2: float, from_center: bool = False) -> AdapterResult[str]
Add a rectangle to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x1
|
float
|
The x1 value (the centre's, with |
required |
y1
|
float
|
The y1 value (the centre's, with |
required |
x2
|
float
|
The x2 value. |
required |
y2
|
float
|
The y2 value. |
required |
from_center
|
bool
|
|
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
add_sketch_chamfer
async
¶
add_sketch_chamfer(corners: list[list[float]], distance: float, distance2: float | None = None, angle: float | None = None) -> AdapterResult[dict[str, Any]]
Bevel sketch corners picked by point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
corners
|
list[list[float]]
|
|
required |
distance
|
float
|
Distance along the first side, mm. |
required |
distance2
|
float | None
|
Distance along the second side, mm. |
None
|
angle
|
float | None
|
Angle from the first side, degrees. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
Source code in src/solidworks_mcp/adapters/base.py
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
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
|
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
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
add_sketch_fillet
async
¶
Round sketch corners picked by point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
corners
|
list[list[float]]
|
|
required |
radius
|
float
|
Fillet radius in mm. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
Source code in src/solidworks_mcp/adapters/base.py
add_sketch_text
async
¶
add_sketch_text(text: str, x: float = 0.0, y: float = 0.0, height: float = 3.5, center_at: list[float] | None = None) -> AdapterResult[dict[str, Any]]
Add text to the current sketch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The text; |
required |
x
|
float
|
Start x in mm (sketch coordinates). |
0.0
|
y
|
float
|
Start y in mm (the baseline). |
0.0
|
height
|
float
|
Letter height in mm. |
3.5
|
center_at
|
list[float] | None
|
A model point [x, y, z] in mm for the text's middle. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
Source code in src/solidworks_mcp/adapters/base.py
add_slot
async
¶
add_slot(kind: str, width: float, start: list[float], end: list[float], center: list[float] | None = None) -> AdapterResult[str]
Draw a straight or arc slot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
str
|
|
required |
width
|
float
|
Slot width, mm. |
required |
start
|
list[float]
|
Straight: first arc centre; arc: start on the arc. |
required |
end
|
list[float]
|
Straight: second arc centre; arc: end on the arc. |
required |
center
|
list[float] | None
|
Arc slot: the arc's centre. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The slot's id. |
Source code in src/solidworks_mcp/adapters/base.py
add_spline
async
¶
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
arrange_dimensions
async
¶
Move drawing dimensions so none overlaps, then verify.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
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
auto_dimension_view
async
¶
Auto-dimension one drawing view.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
check_interference
async
¶
Check the active assembly for interfering components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Any
|
Optional settings; |
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
check_sketch_fully_defined
async
¶
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
close_model
abstractmethod
async
¶
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
connect
abstractmethod
async
¶
create_assembly
abstractmethod
async
¶
create_assembly(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]
Create a new assembly document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
template
|
str | None
|
Template file path. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_axis
async
¶
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
create_base_flange
async
¶
create_base_flange(thickness: float, bend_radius: float, k_factor: float = 0.5, depth: float | None = None, sketch: str | None = None, reverse: bool = False) -> AdapterResult[dict[str, Any]]
A sheet-metal base flange from a sketch.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
create_configuration
async
¶
create_configuration(name: str, parent: str | None = None, description: str = '', activate: bool = False) -> AdapterResult[dict[str, Any]]
Add a configuration to the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
create_cut
async
¶
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
create_cut_extrude
async
¶
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
create_detail_view
async
¶
create_detail_view(view: str, center: list[float], radius: float, position: list[float], scale: str = '2:1', label: str | None = None) -> AdapterResult[dict[str, Any]]
Add a detail view of a circle in a drawing view.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
create_drawing
abstractmethod
async
¶
create_drawing(name: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]
Create a new drawing document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
template
|
str | None
|
Template file path. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_drawing_view
async
¶
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
create_exploded_view
async
¶
Explode the active assembly, automatically or step by step, and show it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
steps
|
list[dict[str, Any]] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_extrusion
abstractmethod
async
¶
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
create_hole
async
¶
create_hole(face_point: list[float], hole_type: str, standard: str, size: str, end_condition: str = 'through_all', depth: float | None = None, positions: list[list[float]] | None = None, fastener: str | None = None) -> AdapterResult[dict[str, Any]]
Add a Hole Wizard hole at a point on a flat face.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
create_loft
abstractmethod
async
¶
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
create_part
abstractmethod
async
¶
create_part(name: str | None = None, units: str | None = None, template: str | None = None) -> AdapterResult[SolidWorksModel]
Create a new part document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | None
|
The name value. Defaults to None. |
None
|
units
|
str | None
|
The units value. Defaults to None. |
None
|
template
|
str | None
|
Template file path. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[SolidWorksModel]
|
AdapterResult[SolidWorksModel]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_reference_plane
async
¶
create_reference_plane(reference: str, offset: float = 0.0, angle: float = 0.0, flip: bool = False, axis: str | None = None, face_point: list[float] | None = None) -> AdapterResult[dict[str, Any]]
Create a reference plane offset from, angled to, or on a plane or face.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
Name of the reference plane. |
required |
offset
|
float
|
Offset distance in millimetres. Defaults to 0.0. |
0.0
|
angle
|
float
|
Angle in degrees about |
0.0
|
flip
|
bool
|
Reverse the offset or angle direction. Defaults to False. |
False
|
axis
|
str | None
|
Named axis to rotate about; needed with |
None
|
face_point
|
list[float] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The new plane's name and parameters, or error. |
Source code in src/solidworks_mcp/adapters/base.py
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
create_revolve
abstractmethod
async
¶
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
create_rib
async
¶
create_rib(sketch: str, thickness: float, both_sides: bool = True, flip_material: bool = False, normal_to_sketch: bool = False) -> AdapterResult[dict[str, Any]]
Add a rib from an open sketch.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
create_section_view
async
¶
create_section_view(view: str, line_start: list[float], line_end: list[float], position: list[float], label: str | None = None) -> AdapterResult[dict[str, Any]]
Add a section view cut along a line across a drawing view.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
create_shell
async
¶
create_shell(thickness: float, faces: list[list[float]], outward: bool = False) -> AdapterResult[dict[str, Any]]
Hollow the body to a wall thickness.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
create_sketch
abstractmethod
async
¶
create_sketch(plane: str | None, face_point: tuple[float, float, float] | None = None) -> AdapterResult[str]
Create a new sketch on a plane, or on the flat face at a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plane
|
str | None
|
The plane's name; None when |
required |
face_point
|
tuple[float, float, float] | None
|
|
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[str]
|
AdapterResult[str]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
create_sketched_bend
async
¶
create_sketched_bend(angle: float = 90.0, bend_radius: float | None = None, sketch: str | None = None, reverse: bool = False) -> AdapterResult[dict[str, Any]]
Bend the sheet along a sketched line.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
create_standard_drawing
async
¶
create_standard_drawing(model_path: str, output_dir: str | None = None, title: str | None = None, subtitle: str | None = None, drawing_number: str | None = None, author: str = '', revision: str = 'A', company: str = '', drawn_date: str | None = None, notes: list[str] | None = None, include_isometric: bool = True, write_model_properties: bool = True, title_block_text_height_mm: float | None = None, include_bom: bool = False) -> AdapterResult[dict[str, Any]]
Create a complete standard A3 drawing.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
create_sweep
abstractmethod
async
¶
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
create_technical_drawing
async
¶
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
delete_configuration
async
¶
Delete a configuration.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
delete_equation
async
¶
Delete the equation for name.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
delete_feature
async
¶
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
disconnect
abstractmethod
async
¶
drawing_report
async
¶
Read what check_drawing judges on the active drawing.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
exit_sketch
abstractmethod
async
¶
Exit sketch editing mode.
Returns:
| Type | Description |
|---|---|
AdapterResult[None]
|
AdapterResult[None]: The result produced by the operation. |
export_file
abstractmethod
async
¶
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
export_flat_pattern
async
¶
Export the active sheet-metal part's flat pattern.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
export_image
abstractmethod
async
¶
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
get_application_info
async
¶
Describe the connected SolidWorks without changing anything.
Only file names leave the adapter, never full paths, so the result
can be pasted into a public report. A value that cannot be read is
None, never guessed.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/base.py
get_custom_properties
async
¶
Read the custom properties of the active document.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
get_dimension
abstractmethod
async
¶
Get the value of a dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
Source code in src/solidworks_mcp/adapters/base.py
get_mass_properties
abstractmethod
async
¶
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
get_material
async
¶
get_material(configuration: str | None = None, material: str | None = None, database: str | None = None) -> AdapterResult[dict[str, Any]]
Read the active part's material and its properties, or a library material's.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
configuration
|
str | None
|
Configuration name; the active one when omitted. |
None
|
material
|
str | None
|
A library material to read instead of the part's. |
None
|
database
|
str | None
|
The library to look in first for |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
get_metrics ¶
Get adapter metrics.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: A dictionary containing the resulting values. |
get_model_geometry_summary
async
¶
Summarise the active part or assembly without changing it.
Must not rebuild the model, modify it, or clear the selection, so
callers can read it around a feature call. Values the adapter cannot
determine are None, never guessed.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/base.py
get_model_info
abstractmethod
async
¶
Get metadata for the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
get_selected_entities
async
¶
Report the faces/edges/vertices currently selected in the live UI.
Lets an agent see exactly what the user has clicked on in SolidWorks (e.g. "chamfer THIS face") instead of inferring it from a screenshot.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: One descriptor per selected |
AdapterResult[list[dict[str, Any]]]
|
entity. See the PyWin32 adapter's implementation for the field |
AdapterResult[list[dict[str, Any]]]
|
set (varies by entity type). |
Source code in src/solidworks_mcp/adapters/base.py
get_template_folders
async
¶
SolidWorks' document template folders and the active document's template extension.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
health_check
abstractmethod
async
¶
Get adapter health status.
Returns:
| Name | Type | Description |
|---|---|---|
AdapterHealth |
AdapterHealth
|
The result produced by the operation. |
insert_bom_table
async
¶
insert_bom_table(view_name: str, template_path: str | None = None, bom_type: str = 'top_level_only', x_mm: float | None = None, y_mm: float | None = None) -> AdapterResult[dict[str, Any]]
Insert a BOM table anchored to an assembly drawing view.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
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 |
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
insert_model_dimensions
async
¶
insert_model_dimensions(view_name: str | None = None, include_hole_wizard: bool = True) -> AdapterResult[dict[str, Any]]
Bring model dimensions into drawing views.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
is_connected
abstractmethod
¶
Check if connected to SolidWorks.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connected, otherwise False. |
list_available_materials
async
¶
List materials from the configured material libraries.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, str]]]
|
AdapterResult[list[dict[str, str]]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
list_components
async
¶
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
list_configurations
abstractmethod
async
¶
List configuration names for the active model.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[str]]
|
AdapterResult[list[str]]: The result produced by the operation. |
list_drawing_views
async
¶
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
list_equations
async
¶
List the active model's equations and global variables.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
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
list_hole_sizes
async
¶
list_hole_sizes(standard: str, hole_type: str, fastener: str | None = None, size: str | None = None) -> AdapterResult[dict[str, Any]]
List the Hole Wizard hole types and sizes of a standard.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
list_model_dimensions
async
¶
List every dimension in the active part or assembly.
Returns:
| Type | Description |
|---|---|
AdapterResult[list[dict[str, Any]]]
|
AdapterResult[list[dict[str, Any]]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
list_open_documents
async
¶
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]]]
|
( |
Source code in src/solidworks_mcp/adapters/base.py
measure_entities
async
¶
Measure one or two selected entities.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
mirror_components
async
¶
Mirror components about a plane, as instances of the same parts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
list[str]
|
Instance names. |
required |
plane
|
str
|
The plane's name. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
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
open_model
abstractmethod
async
¶
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
pack_and_go_assembly
async
¶
Copy an assembly and every file it uses into one folder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_path
|
str
|
The |
required |
target_dir
|
str
|
The folder to copy into. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
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 |
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
pattern_components
async
¶
pattern_components(components: list[str], axis: str, count: int, kind: str = 'linear', spacing: float | None = None, angle: float | None = None) -> AdapterResult[dict[str, Any]]
Repeat components along or around a reference axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
components
|
list[str]
|
The seed components' instance names. |
required |
axis
|
str
|
A reference axis's name. |
required |
count
|
int
|
Instances, the seeds included. |
required |
kind
|
str
|
|
'linear'
|
spacing
|
float | None
|
Linear spacing, mm. |
None
|
angle
|
float | None
|
Circular angle, degrees. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
pattern_linear
async
¶
pattern_linear(features: list[str], direction: list[float] | str, count: int, spacing: float, direction2: list[float] | str | None = None, count2: int = 1, spacing2: float = 0.0, reverse: bool = False, reverse2: bool = False) -> AdapterResult[dict[str, Any]]
Repeat features along one or two directions.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
rebuild_model
async
¶
Force a rebuild and report per-feature rebuild errors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
top_level_only
|
bool
|
Rebuild only the top level of an assembly. Defaults to False (full rebuild). |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
ERROR (still carrying |
AdapterResult[dict[str, Any]]
|
remains. |
Source code in src/solidworks_mcp/adapters/base.py
rename_feature
async
¶
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
replace_component
async
¶
replace_component(component: str, file_path: str, all_instances: bool = False) -> AdapterResult[dict[str, Any]]
Swap a component for another part or assembly file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
str
|
The instance name. |
required |
file_path
|
str
|
The part or assembly to put in its place. |
required |
all_instances
|
bool
|
Replace every instance of the same file. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
reset_circuit_breakers
async
¶
Re-open operations a circuit breaker paused.
An adapter without a circuit breaker has nothing paused; the breaker and the connection pool override this.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
operation
|
str | None
|
The operation to reset; |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, list[str]]]
|
AdapterResult[dict[str, list[str]]]: |
Source code in src/solidworks_mcp/adapters/base.py
save_as_template
async
¶
Save a copy of the active document as a template.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
The template's full path, with the document's template extension (.prtdot, .asmdot or .drwdot). |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
save_body_as_part
async
¶
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 |
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
save_copy
async
¶
Write a copy of the active document and keep the original open.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Where to write the copy. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
save_file
async
¶
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
select_face_edges
async
¶
select_face_edges(point: list[float] | None = None, side: str | None = None, plane: str | None = None, edge_type: str = 'all', append: bool = False) -> AdapterResult[dict[str, Any]]
Multi-select every edge bounding one face of the active part.
Exactly one of point/side/plane identifies the face.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
list[float] | None
|
|
None
|
side
|
str | None
|
|
None
|
plane
|
str | None
|
Reference plane name; the body face(s) lying on it. |
None
|
edge_type
|
str
|
|
'all'
|
append
|
bool
|
Add to the current selection. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
(one descriptor per selected edge) and |
Source code in src/solidworks_mcp/adapters/base.py
select_feature
async
¶
Select a named feature, sketch, plane or component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_name
|
str
|
The feature name, optionally |
required |
append
|
bool
|
Add to the current selection instead of replacing it. Defaults to False. |
False
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: On success |
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
|
AdapterResult[dict[str, Any]]
|
SUCCESS with |
Source code in src/solidworks_mcp/adapters/base.py
set_component_appearance
async
¶
set_component_appearance(component: str, visible: bool | None = None, transparent: bool | None = None) -> AdapterResult[dict[str, Any]]
Hide or show a component, and make it transparent or opaque.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
str
|
The instance name. |
required |
visible
|
bool | None
|
Show ( |
None
|
transparent
|
bool | None
|
Transparent or opaque. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
set_component_state
async
¶
set_component_state(component: str, fixed: bool | None = None, flexible: bool | None = None) -> AdapterResult[dict[str, Any]]
Fix or float a component, and make a sub-assembly rigid or flexible.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
component
|
str
|
Instance name, as |
required |
fixed
|
bool | None
|
True fixes it, False floats it. |
None
|
flexible
|
bool | None
|
True flexible, False rigid. |
None
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The state before and after, or error. |
Source code in src/solidworks_mcp/adapters/base.py
set_construction_geometry
async
¶
set_construction_geometry(entities: list[str], construction: bool = True) -> AdapterResult[dict[str, Any]]
Make sketch entities construction geometry, or normal again.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
entities
|
list[str]
|
Sketch entity ids. |
required |
construction
|
bool
|
|
True
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/base.py
set_custom_property
async
¶
set_custom_property(name: str, value: str, configuration: str | None = None) -> AdapterResult[dict[str, Any]]
Create or overwrite one custom property.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
set_dimension
abstractmethod
async
¶
set_dimension(name: str, value: float, configurations: str | list[str] = 'this') -> AdapterResult[dict[str, Any]]
Set the value of a dimension.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name value. |
required |
value
|
float
|
The value value. |
required |
configurations
|
str | list[str]
|
"this", "all" or names. |
'this'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
Source code in src/solidworks_mcp/adapters/base.py
set_equation
async
¶
set_equation(name: str, expression: str, configurations: str | list[str] = 'all') -> AdapterResult[dict[str, Any]]
Add an equation, or change the one name has.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
A global variable or a dimension ( |
required |
expression
|
str
|
The right-hand side. |
required |
configurations
|
str | list[str]
|
"all", "this" or names. |
'all'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
set_exploded_view
async
¶
Show the assembly's exploded view, or collapse it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exploded
|
bool
|
|
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The result produced by the operation. |
Source code in src/solidworks_mcp/adapters/base.py
set_flat_pattern
async
¶
Flatten the sheet-metal part, or fold it back.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
set_material
async
¶
set_material(material_name: str, database: str | None = None, configuration: str | None = None) -> AdapterResult[dict[str, Any]]
Assign a material to the active part.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
set_sheet_scale
async
¶
Set the active drawing sheet's scale.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Error unless the adapter implements it. |
Source code in src/solidworks_mcp/adapters/base.py
set_sketch_text
async
¶
Rewrite the text in a sketch, with the sketch open, then rebuild.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sketch_name
|
str
|
The sketch, e.g. |
required |
text
|
str
|
The new text. |
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
Source code in src/solidworks_mcp/adapters/base.py
set_units
async
¶
Set the active document's linear unit system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit_system
|
str
|
One of |
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
sketch_circular_pattern
async
¶
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
sketch_convert_entities
async
¶
sketch_convert_entities(edge_points: list[list[float]] | None = None, face_point: list[float] | None = None, construction: bool = False) -> AdapterResult[dict[str, Any]]
Copy model edges or a face outline into the open sketch.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
sketch_extend
async
¶
Extend a sketch entity from its end nearest a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
list[float]
|
|
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/base.py
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
sketch_mirror
async
¶
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
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
sketch_trim
async
¶
Trim the piece of a sketch entity nearest a point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
point
|
list[float]
|
|
required |
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: |
AdapterResult[dict[str, Any]]
|
|
Source code in src/solidworks_mcp/adapters/base.py
suppress_feature
async
¶
suppress_feature(name: str, suppress: bool = True, configurations: str | list[str] = 'this') -> AdapterResult[dict[str, Any]]
Suppress or unsuppress a named feature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Feature name. |
required |
suppress
|
bool
|
True to suppress, False to unsuppress. |
True
|
configurations
|
str | list[str]
|
"this", "all" or names. |
'this'
|
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: The resulting state, or error. |
Source code in src/solidworks_mcp/adapters/base.py
undo
async
¶
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
update_metrics ¶
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
update_sheet_format
async
¶
update_sheet_format(sheet_format: str, paper_size: str | None = None) -> AdapterResult[dict[str, Any]]
Change the active sheet's format and paper size, keeping its views.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
update_title_block
async
¶
Write title-block fields on the active drawing.
Returns:
| Type | Description |
|---|---|
AdapterResult[dict[str, Any]]
|
AdapterResult[dict[str, Any]]: Not implemented by this adapter. |
Source code in src/solidworks_mcp/adapters/base.py
SolidWorksDocsDiscovery ¶
SolidWorksDocsDiscovery(output_dir: Path | None = None, year: int | None = None, strict_year: bool = False)
Discover and index SolidWorks COM and VBA documentation.
The COM part is read from the registered SolidWorks type library, so it needs SolidWorks installed but never starts, attaches to or calls it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_dir
|
Path | None
|
Where the index is saved. Defaults to
|
None
|
year
|
int | None
|
The SolidWorks year whose type library to read; None for the newest installed. |
None
|
strict_year
|
bool
|
True when the caller asked for |
False
|
Attributes:
| Name | Type | Description |
|---|---|---|
output_dir |
Path
|
Where the index is saved. |
index |
dict[str, Any]
|
The index built so far, as saved. |
Initialize docs discovery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_dir
|
Path | None
|
Where the index is saved. |
None
|
year
|
int | None
|
The SolidWorks year to read, if any. |
None
|
strict_year
|
bool
|
True to fail when that year isn't installed. |
False
|
Source code in src/solidworks_mcp/tools/docs_discovery.py
Methods:¶
create_search_summary ¶
Summarize the index for a response.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Interface, method and property totals, the type |
dict[str, Any]
|
library version and the VBA libraries found. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
discover_all ¶
Run full discovery of COM and, optionally, VBA documentation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_vba
|
bool
|
Also scan the registry for VBA references. |
True
|
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: The complete index. |
Raises:
| Type | Description |
|---|---|
TypeLibraryUnavailable
|
No matching type library is registered. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
discover_com_objects ¶
Index every COM interface in the SolidWorks type library.
Also records which type library was read and the member totals.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Interface name -> its methods, properties and |
dict[str, Any]
|
member signatures, as saved. |
Raises:
| Type | Description |
|---|---|
TypeLibraryUnavailable
|
No matching type library is registered. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
discover_enums ¶
Index every enum in the constants library of the version just read.
Call after :meth:discover_com_objects. When the constants library
can't be loaded, the index has no enums and enums_note says why;
the other lookups are unaffected.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: Enum name -> its description and members, as saved. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
discover_vba_references ¶
Discover VBA/TypeLib references via the Windows Registry.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: The SolidWorks and Office/VBA type libraries |
dict[str, Any]
|
found; empty off Windows. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
save_index ¶
Save the index as compact JSON.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The file name inside |
'solidworks_docs_index.json'
|
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
The saved file. |
Raises:
| Type | Description |
|---|---|
ToolOperationError
|
The file could not be written. Lookups would otherwise rebuild the index on every call. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
ToolOperationError ¶
Bases: Exception
An adapter operation reported failure.
Attributes:
| Name | Type | Description |
|---|---|---|
execution_time |
The adapter's timing for the failed call, if any. |
|
data |
Diagnostic data that explains the failure (e.g. rebuild errors),
returned to the caller under |
Source code in src/solidworks_mcp/tools/tool_boundary.py
TypeLibraryUnavailable ¶
Bases: ToolOperationError
No SolidWorks type library could be loaded; the message says why.
Source code in src/solidworks_mcp/tools/tool_boundary.py
_IndexForLookup
dataclass
¶
_IndexForLookup(index: dict[str, Any], index_file: Path | None, status: IndexStatus, note: str | None = None, year: int | None = None)
The index a lookup answers from, and how it was obtained.
Attributes:
| Name | Type | Description |
|---|---|---|
index |
dict[str, Any]
|
The index; empty when |
index_file |
Path | None
|
The file it was read from or saved to. |
status |
IndexStatus
|
|
note |
str | None
|
Why the index is unavailable. |
year |
int | None
|
The year asked for, reported when the index doesn't name its type library (none could be built, or a caller's file lacks it). |
Methods:¶
annotate ¶
Add why no index could be built to a lookup result, when it couldn't.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
_LookupResultT
|
A lookup result. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
_LookupResultT |
_LookupResultT
|
The same result. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
payload ¶
The fields every lookup response carries about its index.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: |
dict[str, Any]
|
library that answered, |
Source code in src/solidworks_mcp/tools/docs_discovery.py
Functions:¶
_build_index ¶
_build_index(year: int | None, strict: bool, output_dir: Path | None = None, include_vba: bool = True) -> tuple[SolidWorksDocsDiscovery, Path]
Build the docs index from the type library and save it under its year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int | None
|
The SolidWorks year to read; None for the newest. |
required |
strict
|
bool
|
True when the caller asked for |
required |
output_dir
|
Path | None
|
Where to save; the default index folder if None. |
None
|
include_vba
|
bool
|
Also scan for VBA references. |
True
|
Returns:
| Type | Description |
|---|---|
SolidWorksDocsDiscovery
|
tuple[SolidWorksDocsDiscovery, Path]: The discovery holding the |
Path
|
index, and the saved file. |
Raises:
| Type | Description |
|---|---|
TypeLibraryUnavailable
|
No matching type library is registered. |
ToolOperationError
|
The index could not be saved. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_discover_vba_references_via_registry ¶
Enumerate VBA/TypeLib references via the Windows Registry.
Scans HKEY_CLASSES_ROOT\TypeLib for entries whose name matches SolidWorks or common Office/VBA libraries.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: |
dict[str, Any]
|
GUID, version and status; empty off Windows. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_extract_year ¶
Extract a 4-digit year (20xx) from a string such as an install path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str | None
|
The text to search. |
required |
Returns:
| Type | Description |
|---|---|
int | None
|
int | None: The year, or None when there isn't one. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_fallback_help_for_query ¶
Suggest MCP tools for a query, alongside or instead of API matches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The search words. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
dict[str, Any]: |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_find_index_file ¶
Find the saved index for a SolidWorks year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int
|
The type library's year. |
required |
Returns:
| Type | Description |
|---|---|
Path | None
|
Path | None: The first |
Path | None
|
index folders, or None. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_find_related_api_members ¶
Given an indexed interface or member name, return related members.
- An interface name -> its own members.
- A member name -> the other members of every interface that also exposes it (siblings commonly used together), plus name-substring matches elsewhere in the index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
dict[str, Any]
|
The index. |
required |
name
|
str
|
The interface or member name. |
required |
max_results
|
int
|
How many related members to keep. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
RelatedLookup |
RelatedLookup
|
The related members and how |
Source code in src/solidworks_mcp/tools/docs_discovery.py
1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | |
_index_dirs ¶
_index_for_lookup ¶
_index_for_lookup(requested_year: int | None, explicit_index_file: str | None, config: Any) -> _IndexForLookup
Find the saved index for the type library a lookup reads, or build it.
The index is found by the type library version the registry says would
be read, so it is built once and reused, whatever year was guessed. An
index in an older format, or from another type library version, is
rebuilt, never answered from. A usable explicit_index_file is
answered from directly, with no registry read.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requested_year
|
int | None
|
The year the caller asked for, if any. |
required |
explicit_index_file
|
str | None
|
An index file the caller named. |
required |
config
|
Any
|
Server configuration. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
_IndexForLookup |
_IndexForLookup
|
The index and how it was obtained. |
Raises:
| Type | Description |
|---|---|
ToolOperationError
|
A built index could not be saved. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_index_is_stale ¶
Whether an index file is older than max_age_days.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_file
|
Path | None
|
The file, if any. |
required |
max_age_days
|
int
|
The age limit in days. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True when the file exists and is older than the limit. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_load_index_file ¶
Read a saved index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_file
|
Path
|
The JSON file. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The index, or None when the file is missing |
dict[str, Any] | None
|
or isn't a JSON object. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_lookup_enum ¶
An enum's members and values, found by its name or a member's.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
dict[str, Any]
|
The index. |
required |
name
|
str
|
An enum or member name; case is ignored. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EnumLookup |
EnumLookup
|
The enum, or a no-match saying why. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_lookup_interface ¶
List an interface's methods and properties, or say it isn't indexed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
dict[str, Any]
|
The index. |
required |
interface
|
str
|
The interface name asked for. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
InterfaceLookup |
InterfaceLookup
|
Its member names and counts, or a no-match. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_lookup_method ¶
Look up a method or property's signature on an interface.
Matching ignores case, as COM late binding does; member is the name
as the type library spells it. Only the matched record is validated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
dict[str, Any]
|
The index. |
required |
interface
|
str
|
The interface name asked for. |
required |
method
|
str
|
The member name asked for. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
MemberLookup |
MemberLookup
|
The signature, or a no-match with a note. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_maybe_refresh_index ¶
_maybe_refresh_index(index: dict[str, Any], index_file: Path, year: int, config: Any) -> tuple[dict[str, Any], Path]
Rebuild a current index that is old, when the config allows.
A SolidWorks service pack can replace the type library in place, so an
index older than docs_index_max_age_days is rebuilt when
config.docs_index_auto_refresh is on. Any failure keeps the existing
index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
dict[str, Any]
|
The saved index. |
required |
index_file
|
Path
|
Its file. |
required |
year
|
int
|
The type library's year. |
required |
config
|
Any
|
Server configuration. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[str, Any], Path]
|
tuple[dict[str, Any], Path]: The (possibly rebuilt) index and file. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_rebuild_rag_index ¶
Rebuild the FAISS solidworks-api-docs namespace from a saved index.
Optional: it needs the faiss-cpu extra, and a failure here never
fails the discovery that triggered it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index_file
|
Path
|
The saved docs index. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True when the RAG index was rebuilt and saved. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_resolve_interface ¶
Find an interface by name, ignoring case.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
dict[str, Any]
|
The index. |
required |
name
|
str
|
The interface name asked for. |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, dict[str, Any]] | None
|
tuple[str, dict[str, Any]] | None: Its real name and record, or None. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_resolve_solidworks_year ¶
The year a call asked for, else the year the server was started with.
Never guessed from folder names: those can be missing, or left behind by an uninstalled version. None means "the newest installed".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
requested_year
|
int | None
|
The year the call asked for. |
required |
config
|
Any
|
Server configuration ( |
required |
Returns:
| Type | Description |
|---|---|
int | None
|
int | None: The year, or None. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
_search_index ¶
Search the index's interface, member and VBA library names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
dict[str, Any]
|
The index. |
required |
query
|
str
|
Words to look for; each word scores separately. |
required |
max_results
|
int
|
How many matches to keep. |
required |
Returns:
| Type | Description |
|---|---|
list[SearchMatch]
|
list[SearchMatch]: The best matches, highest score first. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
index_enums ¶
Index every enum in a type library, with its members' values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lib
|
TypeLibLike
|
An ITypeLib (or a fake with the same methods). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, ApiEnum]
|
dict[str, ApiEnum]: Enum name -> its record. |
Source code in src/solidworks_mcp/tools/type_library.py
index_type_library ¶
Index every dispatch interface in a type library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lib
|
TypeLibLike
|
An ITypeLib (or a fake with the same methods). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, ApiInterface]
|
dict[str, ApiInterface]: Interface name -> its record. |
Source code in src/solidworks_mcp/tools/type_library.py
load_constants_library ¶
Load SolidWorks' constants type library (swconst.tlb) at a version.
It is registered beside the main library, at the same version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
major
|
int
|
The main library's major version. |
required |
minor
|
int
|
Its minor version. |
required |
com
|
Any
|
The |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
The ITypeLib. |
Raises:
| Type | Description |
|---|---|
TypeLibraryUnavailable
|
Not on Windows with pywin32, or the constants library isn't registered at that version or won't load. |
Source code in src/solidworks_mcp/tools/type_library.py
load_type_library ¶
load_type_library(year: int | None = None, strict: bool = False, com: Any = None, registry: Any = None) -> tuple[Any, TypeLibraryInfo]
Load the registered SolidWorks type library for a year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int | None
|
The wanted SolidWorks year; None for the newest. |
None
|
strict
|
bool
|
True to fail when that year isn't installed. |
False
|
com
|
Any
|
The |
None
|
registry
|
Any
|
The |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Any, TypeLibraryInfo]
|
tuple[Any, TypeLibraryInfo]: The ITypeLib and where it came from. |
Raises:
| Type | Description |
|---|---|
TypeLibraryUnavailable
|
Not on Windows with pywin32, no matching type library is registered, or the registered one won't load. |
Source code in src/solidworks_mcp/tools/type_library.py
normalize_input ¶
Validate input_data as model_type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
Any
|
A |
required |
model_type
|
type[TModel]
|
The tool's pydantic input model. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
TModel |
TModel
|
The validated model. |
Raises:
| Type | Description |
|---|---|
InvalidInputError
|
Naming the offending field(s). |
Source code in src/solidworks_mcp/tools/tool_boundary.py
register_docs_discovery_tools
async
¶
register_docs_discovery_tools(mcp: FastMCP, adapter: SolidWorksAdapter, config: dict[str, Any]) -> int
Register the docs discovery and API lookup tools with FastMCP.
None of them use the adapter or SolidWorks itself: they read the installed type library.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mcp
|
FastMCP
|
The server to register on. |
required |
adapter
|
SolidWorksAdapter
|
Unused; kept for the registrar's uniform signature. |
required |
config
|
dict[str, Any]
|
Server configuration ( |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The number of tools registered. |
Source code in src/solidworks_mcp/tools/docs_discovery.py
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 | |
target_version ¶
target_version(year: int | None = None, strict: bool = False, registry: Any = None) -> tuple[int, int]
The type library version a load for year would read, without loading it.
Lookups use this to find the saved index for that version before deciding whether to build one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
year
|
int | None
|
The wanted SolidWorks year; None for the newest. |
None
|
strict
|
bool
|
True to fail when that year isn't installed. |
False
|
registry
|
Any
|
The |
None
|
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
tuple[int, int]: The |
Raises:
| Type | Description |
|---|---|
TypeLibraryUnavailable
|
Not on Windows, or no matching type library is registered. |
Source code in src/solidworks_mcp/tools/type_library.py
with_tool_boundary ¶
Return mcp wrapped in a :class:ToolRegistrar (typed as mcp).
The registrar duck-types the FastMCP surface the tool modules use
(tool() plus attribute forwarding), so modules keep their annotations.
Source code in src/solidworks_mcp/tools/tool_boundary.py
year_of ¶
The SolidWorks year a type library major version belongs to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
major
|
int
|
The type library major version, e.g. 34. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
The release year, e.g. 2026. |