solidworks-mcp-python 1.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- solidworks_mcp/__init__.py +57 -0
- solidworks_mcp/adapters/__init__.py +40 -0
- solidworks_mcp/adapters/base.py +1882 -0
- solidworks_mcp/adapters/circuit_breaker.py +2052 -0
- solidworks_mcp/adapters/com_executor.py +252 -0
- solidworks_mcp/adapters/complexity_analyzer.py +272 -0
- solidworks_mcp/adapters/connection_pool.py +1884 -0
- solidworks_mcp/adapters/factory.py +366 -0
- solidworks_mcp/adapters/intelligent_router.py +218 -0
- solidworks_mcp/adapters/mock_adapter.py +4016 -0
- solidworks_mcp/adapters/pywin32_adapter.py +2842 -0
- solidworks_mcp/adapters/solidworks/__init__.py +17 -0
- solidworks_mcp/adapters/solidworks/bitmap.py +180 -0
- solidworks_mcp/adapters/solidworks/com_utils.py +56 -0
- solidworks_mcp/adapters/solidworks/dimension_layout.py +753 -0
- solidworks_mcp/adapters/solidworks/documentation.py +1476 -0
- solidworks_mcp/adapters/solidworks/drawing_standard.py +1993 -0
- solidworks_mcp/adapters/solidworks/face_selection.py +392 -0
- solidworks_mcp/adapters/solidworks/features.py +3362 -0
- solidworks_mcp/adapters/solidworks/io.py +3649 -0
- solidworks_mcp/adapters/solidworks/rebuild_diagnostics.py +269 -0
- solidworks_mcp/adapters/solidworks/rebuild_inspector.py +146 -0
- solidworks_mcp/adapters/solidworks/selection.py +308 -0
- solidworks_mcp/adapters/solidworks/sketch.py +2545 -0
- solidworks_mcp/adapters/sw_feature_errors.py +66 -0
- solidworks_mcp/adapters/sw_type_info.py +317 -0
- solidworks_mcp/adapters/vba_adapter.py +318 -0
- solidworks_mcp/adapters/vba_macro_executor.py +215 -0
- solidworks_mcp/agents/__init__.py +68 -0
- solidworks_mcp/agents/design_knowledge/assembly_patterns.md +127 -0
- solidworks_mcp/agents/design_knowledge/hinges.md +118 -0
- solidworks_mcp/agents/design_knowledge/snap_fits.md +93 -0
- solidworks_mcp/agents/design_knowledge/solidworks_basics.md +3 -0
- solidworks_mcp/agents/design_knowledge/tolerancing.md +128 -0
- solidworks_mcp/agents/harness.py +216 -0
- solidworks_mcp/agents/history_db.py +1508 -0
- solidworks_mcp/agents/retrieval_index.py +164 -0
- solidworks_mcp/agents/schemas.py +165 -0
- solidworks_mcp/agents/smoke_test.py +285 -0
- solidworks_mcp/agents/soc_exporter.py +650 -0
- solidworks_mcp/agents/soc_pickup.py +332 -0
- solidworks_mcp/agents/soc_rewind.py +221 -0
- solidworks_mcp/agents/vector_rag.py +665 -0
- solidworks_mcp/cache/__init__.py +5 -0
- solidworks_mcp/cache/response_cache.py +164 -0
- solidworks_mcp/config.py +729 -0
- solidworks_mcp/exceptions.py +37 -0
- solidworks_mcp/security/__init__.py +68 -0
- solidworks_mcp/security/auth.py +128 -0
- solidworks_mcp/security/cors.py +27 -0
- solidworks_mcp/security/rate_limiting.py +90 -0
- solidworks_mcp/security/runtime.py +155 -0
- solidworks_mcp/server.py +777 -0
- solidworks_mcp/server_cli_fixed.py +120 -0
- solidworks_mcp/setup/__init__.py +1 -0
- solidworks_mcp/setup/cli.py +399 -0
- solidworks_mcp/setup/clients.py +157 -0
- solidworks_mcp/setup/config_file.py +230 -0
- solidworks_mcp/setup/handshake.py +202 -0
- solidworks_mcp/setup/launcher.py +102 -0
- solidworks_mcp/setup/legacy.py +100 -0
- solidworks_mcp/setup/registration.py +193 -0
- solidworks_mcp/setup/solidworks.py +49 -0
- solidworks_mcp/tools/__init__.py +64 -0
- solidworks_mcp/tools/analysis.py +723 -0
- solidworks_mcp/tools/automation.py +578 -0
- solidworks_mcp/tools/docs_discovery.py +1476 -0
- solidworks_mcp/tools/drawing.py +1015 -0
- solidworks_mcp/tools/drawing_analysis.py +456 -0
- solidworks_mcp/tools/drawing_automation.py +627 -0
- solidworks_mcp/tools/engineering_data.py +466 -0
- solidworks_mcp/tools/error_classifier.py +232 -0
- solidworks_mcp/tools/export.py +833 -0
- solidworks_mcp/tools/file_facts.py +40 -0
- solidworks_mcp/tools/file_management.py +1473 -0
- solidworks_mcp/tools/input_compat.py +17 -0
- solidworks_mcp/tools/macro_recording.py +464 -0
- solidworks_mcp/tools/modeling.py +2360 -0
- solidworks_mcp/tools/sketching.py +1422 -0
- solidworks_mcp/tools/template_management.py +367 -0
- solidworks_mcp/tools/tool_boundary.py +280 -0
- solidworks_mcp/tools/vba_generation.py +1145 -0
- solidworks_mcp/ui/__init__.py +9 -0
- solidworks_mcp/ui/local_llm.py +725 -0
- solidworks_mcp/ui/routers/__init__.py +10 -0
- solidworks_mcp/ui/routers/checkpoint.py +24 -0
- solidworks_mcp/ui/routers/docs.py +47 -0
- solidworks_mcp/ui/routers/llm.py +83 -0
- solidworks_mcp/ui/routers/local_model.py +69 -0
- solidworks_mcp/ui/routers/model.py +75 -0
- solidworks_mcp/ui/routers/preview.py +38 -0
- solidworks_mcp/ui/routers/session.py +161 -0
- solidworks_mcp/ui/routers/viewer.py +154 -0
- solidworks_mcp/ui/schemas.py +502 -0
- solidworks_mcp/ui/server.py +298 -0
- solidworks_mcp/ui/service.py +481 -0
- solidworks_mcp/ui/services/__init__.py +136 -0
- solidworks_mcp/ui/services/_utils.py +958 -0
- solidworks_mcp/ui/services/checkpoint_service.py +1110 -0
- solidworks_mcp/ui/services/docs_service.py +282 -0
- solidworks_mcp/ui/services/llm_service.py +956 -0
- solidworks_mcp/ui/services/model_service.py +459 -0
- solidworks_mcp/ui/services/parameter_repair_service.py +314 -0
- solidworks_mcp/ui/services/preview_service.py +489 -0
- solidworks_mcp/ui/services/session_service.py +1389 -0
- solidworks_mcp/utils/__init__.py +9 -0
- solidworks_mcp/utils/feature_tree_classifier.py +342 -0
- solidworks_mcp/utils/logging.py +76 -0
- solidworks_mcp/utils/validation.py +77 -0
- solidworks_mcp/version.py +8 -0
- solidworks_mcp_python-1.5.0.dist-info/METADATA +410 -0
- solidworks_mcp_python-1.5.0.dist-info/RECORD +115 -0
- solidworks_mcp_python-1.5.0.dist-info/WHEEL +4 -0
- solidworks_mcp_python-1.5.0.dist-info/entry_points.txt +3 -0
- solidworks_mcp_python-1.5.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
"""Advanced Drawing Analysis tools for SolidWorks MCP Server.
|
|
2
|
+
|
|
3
|
+
Provides advanced analysis capabilities for drawing documents including dimension
|
|
4
|
+
analysis, view analysis, annotation checking, and compliance verification.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from fastmcp import FastMCP
|
|
10
|
+
from pydantic import Field
|
|
11
|
+
|
|
12
|
+
from ..adapters.base import SolidWorksAdapter
|
|
13
|
+
from .file_facts import file_fact_snapshot
|
|
14
|
+
from .input_compat import CompatInput
|
|
15
|
+
from .tool_boundary import (
|
|
16
|
+
InvalidInputError,
|
|
17
|
+
ToolOperationError,
|
|
18
|
+
UnsupportedOperationError,
|
|
19
|
+
require_capability,
|
|
20
|
+
require_success,
|
|
21
|
+
with_tool_boundary,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Input schemas for drawing analysis
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class DrawingAnalysisInput(CompatInput):
|
|
28
|
+
"""Input schema for drawing analysis operations.
|
|
29
|
+
|
|
30
|
+
Attributes:
|
|
31
|
+
analysis_depth (str): The analysis depth value.
|
|
32
|
+
analysis_type (str): The analysis type value.
|
|
33
|
+
drawing_path (str): The drawing path value.
|
|
34
|
+
generate_report (bool): The generate report value.
|
|
35
|
+
standards_check (bool): The standards check value.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
drawing_path: str = Field(description="Path to drawing file (.slddrw)")
|
|
39
|
+
analysis_type: str = Field(
|
|
40
|
+
default="comprehensive",
|
|
41
|
+
description="Analysis type (comprehensive, dimensions, views, annotations)",
|
|
42
|
+
)
|
|
43
|
+
analysis_depth: str = Field(default="Basic", description="Analysis depth level")
|
|
44
|
+
standards_check: bool = Field(
|
|
45
|
+
default=True, description="Check against drafting standards"
|
|
46
|
+
)
|
|
47
|
+
generate_report: bool = Field(default=True, description="Generate detailed report")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class DimensionAnalysisInput(CompatInput):
|
|
51
|
+
"""Input schema for dimension analysis.
|
|
52
|
+
|
|
53
|
+
Attributes:
|
|
54
|
+
check_completeness (bool): The check completeness value.
|
|
55
|
+
check_precision (bool): The check precision value.
|
|
56
|
+
check_tolerances (bool): The check tolerances value.
|
|
57
|
+
drawing_path (str): The drawing path value.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
drawing_path: str = Field(description="Path to drawing file")
|
|
61
|
+
check_precision: bool = Field(
|
|
62
|
+
default=True, description="Check dimension precision consistency"
|
|
63
|
+
)
|
|
64
|
+
check_tolerances: bool = Field(
|
|
65
|
+
default=True, description="Check tolerance formatting"
|
|
66
|
+
)
|
|
67
|
+
check_completeness: bool = Field(
|
|
68
|
+
default=True, description="Check dimension completeness"
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
class AnnotationAnalysisInput(CompatInput):
|
|
73
|
+
"""Input schema for annotation analysis.
|
|
74
|
+
|
|
75
|
+
Attributes:
|
|
76
|
+
check_annotations (bool): The check annotations value.
|
|
77
|
+
check_notes (bool): The check notes value.
|
|
78
|
+
check_symbols (bool): The check symbols value.
|
|
79
|
+
check_text_styles (bool): The check text styles value.
|
|
80
|
+
drawing_path (str): The drawing path value.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
drawing_path: str = Field(description="Path to drawing file")
|
|
84
|
+
check_notes: bool = Field(
|
|
85
|
+
default=True, description="Check note formatting and content"
|
|
86
|
+
)
|
|
87
|
+
check_symbols: bool = Field(
|
|
88
|
+
default=True, description="Check symbol usage and placement"
|
|
89
|
+
)
|
|
90
|
+
check_text_styles: bool = Field(
|
|
91
|
+
default=True, description="Check text style consistency"
|
|
92
|
+
)
|
|
93
|
+
check_annotations: bool = Field(default=True, description="Alias used by tests")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class ComplianceCheckInput(CompatInput):
|
|
97
|
+
"""Input schema for standards compliance checking.
|
|
98
|
+
|
|
99
|
+
Attributes:
|
|
100
|
+
check_sheet_format (bool): The check sheet format value.
|
|
101
|
+
check_title_block (bool): The check title block value.
|
|
102
|
+
drawing_path (str): The drawing path value.
|
|
103
|
+
standard (str): The standard value.
|
|
104
|
+
standards_to_check (list[str]): The standards to check value.
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
drawing_path: str = Field(description="Path to drawing file")
|
|
108
|
+
standard: str = Field(
|
|
109
|
+
default="ISO", description="Standard to check against (ISO, ANSI, DIN)"
|
|
110
|
+
)
|
|
111
|
+
standards_to_check: list[str] = Field(
|
|
112
|
+
default_factory=lambda: ["ISO"], description="Standards list alias"
|
|
113
|
+
)
|
|
114
|
+
check_title_block: bool = Field(
|
|
115
|
+
default=True, description="Check title block compliance"
|
|
116
|
+
)
|
|
117
|
+
check_sheet_format: bool = Field(
|
|
118
|
+
default=True, description="Check sheet format compliance"
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
async def register_drawing_analysis_tools(
|
|
123
|
+
mcp: FastMCP, adapter: SolidWorksAdapter, config: Any
|
|
124
|
+
) -> int:
|
|
125
|
+
"""Register advanced drawing analysis tools with FastMCP.
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
mcp (FastMCP): The mcp value.
|
|
129
|
+
adapter (SolidWorksAdapter): Adapter instance used for the operation.
|
|
130
|
+
config (Any): Configuration values for the operation.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
int: The computed numeric result.
|
|
134
|
+
|
|
135
|
+
Example:
|
|
136
|
+
>>> tool_count = await register_drawing_analysis_tools(mcp, adapter, config)
|
|
137
|
+
"""
|
|
138
|
+
mcp = with_tool_boundary(mcp)
|
|
139
|
+
tool_count = 0
|
|
140
|
+
|
|
141
|
+
@mcp.tool()
|
|
142
|
+
async def analyze_drawing_comprehensive(
|
|
143
|
+
input_data: DrawingAnalysisInput,
|
|
144
|
+
) -> dict[str, Any]:
|
|
145
|
+
"""Handle analyze drawing comprehensive.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
input_data (DrawingAnalysisInput): The input data value.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
152
|
+
|
|
153
|
+
Example:
|
|
154
|
+
>>> result = await analyze_drawing_comprehensive(analysis_input)
|
|
155
|
+
"""
|
|
156
|
+
require_capability(
|
|
157
|
+
adapter,
|
|
158
|
+
"analyze_drawing_comprehensive",
|
|
159
|
+
"Active adapter does not support "
|
|
160
|
+
"analyze_drawing_comprehensive; no analysis of "
|
|
161
|
+
f"{input_data.drawing_path} was performed.",
|
|
162
|
+
)
|
|
163
|
+
result = await adapter.analyze_drawing_comprehensive(input_data.model_dump())
|
|
164
|
+
require_success(result, "Failed to analyze drawing")
|
|
165
|
+
return {
|
|
166
|
+
"status": "success",
|
|
167
|
+
"message": "Comprehensive drawing analysis completed",
|
|
168
|
+
"data": result.data,
|
|
169
|
+
"execution_time": result.execution_time,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@mcp.tool()
|
|
173
|
+
async def analyze_drawing_dimensions(
|
|
174
|
+
input_data: DimensionAnalysisInput,
|
|
175
|
+
) -> dict[str, Any]:
|
|
176
|
+
"""Analyze dimensions in a SolidWorks drawing for consistency and completeness.
|
|
177
|
+
|
|
178
|
+
This tool performs detailed dimensional analysis including precision, tolerances, and
|
|
179
|
+
completeness checking.
|
|
180
|
+
|
|
181
|
+
Args:
|
|
182
|
+
input_data (DimensionAnalysisInput): The input data value.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
186
|
+
|
|
187
|
+
Example:
|
|
188
|
+
>>> result = await analyze_drawing_dimensions(dimension_input)
|
|
189
|
+
"""
|
|
190
|
+
|
|
191
|
+
require_capability(
|
|
192
|
+
adapter,
|
|
193
|
+
"analyze_drawing_dimensions",
|
|
194
|
+
"Active adapter does not support analyze_drawing_dimensions; "
|
|
195
|
+
f"no analysis of {input_data.drawing_path} was performed.",
|
|
196
|
+
)
|
|
197
|
+
result = await adapter.analyze_drawing_dimensions(input_data.model_dump())
|
|
198
|
+
require_success(result, "Failed to analyze dimensions")
|
|
199
|
+
return {
|
|
200
|
+
"status": "success",
|
|
201
|
+
"message": "Dimension analysis completed",
|
|
202
|
+
"data": result.data,
|
|
203
|
+
"execution_time": result.execution_time,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@mcp.tool()
|
|
207
|
+
async def analyze_drawing_annotations(
|
|
208
|
+
input_data: AnnotationAnalysisInput,
|
|
209
|
+
) -> dict[str, Any]:
|
|
210
|
+
"""Analyze drawing annotations and notes quality.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
input_data (AnnotationAnalysisInput): The input data value.
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
217
|
+
|
|
218
|
+
Example:
|
|
219
|
+
>>> result = await analyze_drawing_annotations(annotation_input)
|
|
220
|
+
"""
|
|
221
|
+
"""
|
|
222
|
+
Analyze annotations in a SolidWorks drawing for consistency and standards compliance.
|
|
223
|
+
|
|
224
|
+
This tool examines notes, symbols, and text formatting for quality and compliance.
|
|
225
|
+
"""
|
|
226
|
+
require_capability(
|
|
227
|
+
adapter,
|
|
228
|
+
"analyze_drawing_annotations",
|
|
229
|
+
"Active adapter does not support analyze_drawing_annotations; "
|
|
230
|
+
f"no analysis of {input_data.drawing_path} was performed.",
|
|
231
|
+
)
|
|
232
|
+
result = await adapter.analyze_drawing_annotations(input_data.model_dump())
|
|
233
|
+
require_success(result, "Failed to analyze annotations")
|
|
234
|
+
return {
|
|
235
|
+
"status": "success",
|
|
236
|
+
"message": "Annotation analysis completed",
|
|
237
|
+
"data": result.data,
|
|
238
|
+
"execution_time": result.execution_time,
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
@mcp.tool()
|
|
242
|
+
async def check_drawing_compliance(
|
|
243
|
+
input_data: ComplianceCheckInput,
|
|
244
|
+
) -> dict[str, Any]:
|
|
245
|
+
"""Check drawing compliance with company standards.
|
|
246
|
+
|
|
247
|
+
Args:
|
|
248
|
+
input_data (ComplianceCheckInput): The input data value.
|
|
249
|
+
|
|
250
|
+
Returns:
|
|
251
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
252
|
+
|
|
253
|
+
Example:
|
|
254
|
+
>>> result = await check_drawing_compliance(compliance_input)
|
|
255
|
+
"""
|
|
256
|
+
"""
|
|
257
|
+
Check drawing compliance against specified drafting standards.
|
|
258
|
+
|
|
259
|
+
This tool verifies compliance with ISO, ANSI, DIN, or other drafting standards.
|
|
260
|
+
"""
|
|
261
|
+
require_capability(
|
|
262
|
+
adapter,
|
|
263
|
+
"check_drawing_compliance",
|
|
264
|
+
"Active adapter does not support check_drawing_compliance; "
|
|
265
|
+
f"no {input_data.standard} compliance check was performed.",
|
|
266
|
+
)
|
|
267
|
+
result = await adapter.check_drawing_compliance(input_data.model_dump())
|
|
268
|
+
require_success(result, "Compliance check failed")
|
|
269
|
+
return {
|
|
270
|
+
"status": "success",
|
|
271
|
+
"message": f"Standards compliance check completed for {input_data.standard}",
|
|
272
|
+
"data": result.data,
|
|
273
|
+
"execution_time": result.execution_time,
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
@mcp.tool()
|
|
277
|
+
async def analyze_drawing_views(input_data: dict[str, Any]) -> dict[str, Any]:
|
|
278
|
+
"""Analyze drawing views arrangement and quality.
|
|
279
|
+
|
|
280
|
+
Args:
|
|
281
|
+
input_data (dict[str, Any]): The input data value.
|
|
282
|
+
|
|
283
|
+
Returns:
|
|
284
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
285
|
+
|
|
286
|
+
Example:
|
|
287
|
+
>>> result = await analyze_drawing_views(view_input)
|
|
288
|
+
"""
|
|
289
|
+
"""
|
|
290
|
+
Analyze drawing views for clarity, completeness, and optimal presentation.
|
|
291
|
+
|
|
292
|
+
This tool examines view selection, placement, and clarity.
|
|
293
|
+
"""
|
|
294
|
+
if hasattr(adapter, "analyze_drawing_views"):
|
|
295
|
+
result = await adapter.analyze_drawing_views(input_data)
|
|
296
|
+
require_success(result, "Failed to analyze drawing views")
|
|
297
|
+
return {
|
|
298
|
+
"status": "success",
|
|
299
|
+
"message": "Drawing view analysis completed",
|
|
300
|
+
"data": result.data,
|
|
301
|
+
"execution_time": result.execution_time,
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
drawing_path = input_data.get("drawing_path", "")
|
|
305
|
+
|
|
306
|
+
raise UnsupportedOperationError(
|
|
307
|
+
"Active adapter does not support analyze_drawing_views; "
|
|
308
|
+
f"no analysis of {drawing_path} was performed."
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
@mcp.tool()
|
|
312
|
+
async def generate_drawing_report(input_data: dict[str, Any]) -> dict[str, Any]:
|
|
313
|
+
"""Generate comprehensive drawing analysis report.
|
|
314
|
+
|
|
315
|
+
Args:
|
|
316
|
+
input_data (dict[str, Any]): The input data value.
|
|
317
|
+
|
|
318
|
+
Returns:
|
|
319
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
320
|
+
|
|
321
|
+
Example:
|
|
322
|
+
>>> result = await generate_drawing_report(report_input)
|
|
323
|
+
"""
|
|
324
|
+
"""
|
|
325
|
+
Generate a comprehensive quality report for a drawing.
|
|
326
|
+
|
|
327
|
+
This tool creates a detailed report combining all analysis results.
|
|
328
|
+
"""
|
|
329
|
+
if hasattr(adapter, "generate_drawing_report"):
|
|
330
|
+
result = await adapter.generate_drawing_report(input_data)
|
|
331
|
+
require_success(result, "Failed to generate drawing report")
|
|
332
|
+
return {
|
|
333
|
+
"status": "success",
|
|
334
|
+
"message": "Drawing quality report generated successfully",
|
|
335
|
+
"data": result.data,
|
|
336
|
+
"execution_time": result.execution_time,
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
drawing_path = input_data.get("drawing_path", "")
|
|
340
|
+
|
|
341
|
+
raise UnsupportedOperationError(
|
|
342
|
+
"Active adapter does not support generate_drawing_report; "
|
|
343
|
+
f"no report for {drawing_path} was generated."
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
@mcp.tool()
|
|
347
|
+
async def compare_drawing_versions(input_data: dict[str, Any]) -> dict[str, Any]:
|
|
348
|
+
"""Compare different versions of drawing files.
|
|
349
|
+
|
|
350
|
+
Args:
|
|
351
|
+
input_data (dict[str, Any]): The input data value.
|
|
352
|
+
|
|
353
|
+
Returns:
|
|
354
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
355
|
+
|
|
356
|
+
Example:
|
|
357
|
+
>>> result = await compare_drawing_versions(version_input)
|
|
358
|
+
"""
|
|
359
|
+
"""
|
|
360
|
+
Compare two drawing files on disk using real filesystem facts.
|
|
361
|
+
|
|
362
|
+
This tool cannot parse SLDDRW internals (no SolidWorks session is
|
|
363
|
+
opened), so it does not report geometric/dimension/annotation
|
|
364
|
+
differences. It reports what it can honestly determine from the
|
|
365
|
+
filesystem: whether each file exists, its size, modified time, and
|
|
366
|
+
whether the two files are byte-for-byte identical.
|
|
367
|
+
"""
|
|
368
|
+
drawing_v1 = input_data.get("drawing_version_1", "")
|
|
369
|
+
drawing_v2 = input_data.get("drawing_version_2", "")
|
|
370
|
+
|
|
371
|
+
if not drawing_v1 or not drawing_v2:
|
|
372
|
+
raise InvalidInputError(
|
|
373
|
+
"compare_drawing_versions requires both "
|
|
374
|
+
"drawing_version_1 and drawing_version_2 paths."
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
file_1 = file_fact_snapshot(drawing_v1)
|
|
378
|
+
file_2 = file_fact_snapshot(drawing_v2)
|
|
379
|
+
|
|
380
|
+
missing = [
|
|
381
|
+
path
|
|
382
|
+
for path, snapshot in ((drawing_v1, file_1), (drawing_v2, file_2))
|
|
383
|
+
if snapshot is None
|
|
384
|
+
]
|
|
385
|
+
if missing:
|
|
386
|
+
raise ToolOperationError(
|
|
387
|
+
"Cannot compare drawing versions; file(s) not found "
|
|
388
|
+
f"on disk: {', '.join(missing)}. No SolidWorks-level "
|
|
389
|
+
"diff was performed."
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
assert file_1 is not None
|
|
393
|
+
assert file_2 is not None
|
|
394
|
+
identical = file_1["sha256"] == file_2["sha256"]
|
|
395
|
+
|
|
396
|
+
return {
|
|
397
|
+
"status": "success",
|
|
398
|
+
"message": (
|
|
399
|
+
"Drawing files are byte-identical"
|
|
400
|
+
if identical
|
|
401
|
+
else "Drawing files differ on disk"
|
|
402
|
+
),
|
|
403
|
+
"comparison": {
|
|
404
|
+
"file_1": file_1,
|
|
405
|
+
"file_2": file_2,
|
|
406
|
+
"identical": identical,
|
|
407
|
+
"size_delta_bytes": file_2["size_bytes"] - file_1["size_bytes"],
|
|
408
|
+
},
|
|
409
|
+
"note": (
|
|
410
|
+
"This is a filesystem-level comparison only; no "
|
|
411
|
+
"SolidWorks session was opened, so geometric, "
|
|
412
|
+
"dimension, and annotation differences were not "
|
|
413
|
+
"analyzed."
|
|
414
|
+
),
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
@mcp.tool()
|
|
418
|
+
async def validate_drawing_completeness(
|
|
419
|
+
input_data: dict[str, Any],
|
|
420
|
+
) -> dict[str, Any]:
|
|
421
|
+
"""Validate drawing completeness for production readiness.
|
|
422
|
+
|
|
423
|
+
Args:
|
|
424
|
+
input_data (dict[str, Any]): The input data value.
|
|
425
|
+
|
|
426
|
+
Returns:
|
|
427
|
+
dict[str, Any]: A dictionary containing the resulting values.
|
|
428
|
+
|
|
429
|
+
Example:
|
|
430
|
+
>>> result = await validate_drawing_completeness(validation_input)
|
|
431
|
+
"""
|
|
432
|
+
"""
|
|
433
|
+
Validate that a drawing contains all necessary information for manufacturing.
|
|
434
|
+
|
|
435
|
+
This tool checks for completeness from a manufacturing perspective.
|
|
436
|
+
"""
|
|
437
|
+
drawing_path = input_data.get("drawing_path", "")
|
|
438
|
+
|
|
439
|
+
require_capability(
|
|
440
|
+
adapter,
|
|
441
|
+
"validate_drawing_completeness",
|
|
442
|
+
"Active adapter does not support "
|
|
443
|
+
"validate_drawing_completeness; no validation of "
|
|
444
|
+
f"{drawing_path} was performed.",
|
|
445
|
+
)
|
|
446
|
+
result = await adapter.validate_drawing_completeness(input_data)
|
|
447
|
+
require_success(result, "Failed to validate completeness")
|
|
448
|
+
return {
|
|
449
|
+
"status": "success",
|
|
450
|
+
"message": "Drawing completeness validation completed",
|
|
451
|
+
"data": result.data,
|
|
452
|
+
"execution_time": result.execution_time,
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
tool_count = 8 # Legacy count expected by tests
|
|
456
|
+
return tool_count
|