rowan-mcp 1.0.1__py3-none-any.whl → 2.0.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.
Potentially problematic release.
This version of rowan-mcp might be problematic. Click here for more details.
- rowan_mcp/__init__.py +2 -2
- rowan_mcp/__main__.py +3 -5
- rowan_mcp/functions_v2/BENCHMARK.md +86 -0
- rowan_mcp/functions_v2/molecule_lookup.py +232 -0
- rowan_mcp/functions_v2/protein_management.py +141 -0
- rowan_mcp/functions_v2/submit_basic_calculation_workflow.py +195 -0
- rowan_mcp/functions_v2/submit_conformer_search_workflow.py +158 -0
- rowan_mcp/functions_v2/submit_descriptors_workflow.py +52 -0
- rowan_mcp/functions_v2/submit_docking_workflow.py +244 -0
- rowan_mcp/functions_v2/submit_fukui_workflow.py +114 -0
- rowan_mcp/functions_v2/submit_irc_workflow.py +58 -0
- rowan_mcp/functions_v2/submit_macropka_workflow.py +99 -0
- rowan_mcp/functions_v2/submit_pka_workflow.py +72 -0
- rowan_mcp/functions_v2/submit_protein_cofolding_workflow.py +88 -0
- rowan_mcp/functions_v2/submit_redox_potential_workflow.py +55 -0
- rowan_mcp/functions_v2/submit_scan_workflow.py +82 -0
- rowan_mcp/functions_v2/submit_solubility_workflow.py +157 -0
- rowan_mcp/functions_v2/submit_tautomer_search_workflow.py +51 -0
- rowan_mcp/functions_v2/workflow_management_v2.py +382 -0
- rowan_mcp/server.py +109 -144
- rowan_mcp/tests/basic_calculation_from_json.py +0 -0
- rowan_mcp/tests/basic_calculation_with_constraint.py +33 -0
- rowan_mcp/tests/basic_calculation_with_solvent.py +0 -0
- rowan_mcp/tests/bde.py +37 -0
- rowan_mcp/tests/benchmark_queries.md +120 -0
- rowan_mcp/tests/cofolding_screen.py +131 -0
- rowan_mcp/tests/conformer_dependent_redox.py +37 -0
- rowan_mcp/tests/conformers.py +31 -0
- rowan_mcp/tests/data.json +189 -0
- rowan_mcp/tests/docking_screen.py +157 -0
- rowan_mcp/tests/irc.py +24 -0
- rowan_mcp/tests/macropka.py +13 -0
- rowan_mcp/tests/multistage_opt.py +13 -0
- rowan_mcp/tests/optimization.py +21 -0
- rowan_mcp/tests/phenol_pka.py +36 -0
- rowan_mcp/tests/pka.py +36 -0
- rowan_mcp/tests/protein_cofolding.py +17 -0
- rowan_mcp/tests/scan.py +28 -0
- {rowan_mcp-1.0.1.dist-info → rowan_mcp-2.0.0.dist-info}/METADATA +49 -33
- rowan_mcp-2.0.0.dist-info/RECORD +42 -0
- rowan_mcp/functions/admet.py +0 -94
- rowan_mcp/functions/bde.py +0 -113
- rowan_mcp/functions/calculation_retrieve.py +0 -89
- rowan_mcp/functions/conformers.py +0 -80
- rowan_mcp/functions/descriptors.py +0 -92
- rowan_mcp/functions/docking.py +0 -340
- rowan_mcp/functions/docking_enhanced.py +0 -174
- rowan_mcp/functions/electronic_properties.py +0 -205
- rowan_mcp/functions/folder_management.py +0 -137
- rowan_mcp/functions/fukui.py +0 -219
- rowan_mcp/functions/hydrogen_bond_basicity.py +0 -94
- rowan_mcp/functions/irc.py +0 -125
- rowan_mcp/functions/macropka.py +0 -120
- rowan_mcp/functions/molecular_converter.py +0 -423
- rowan_mcp/functions/molecular_dynamics.py +0 -191
- rowan_mcp/functions/molecule_lookup.py +0 -57
- rowan_mcp/functions/multistage_opt.py +0 -171
- rowan_mcp/functions/pdb_handler.py +0 -200
- rowan_mcp/functions/pka.py +0 -137
- rowan_mcp/functions/redox_potential.py +0 -352
- rowan_mcp/functions/scan.py +0 -536
- rowan_mcp/functions/scan_analyzer.py +0 -347
- rowan_mcp/functions/solubility.py +0 -277
- rowan_mcp/functions/spin_states.py +0 -747
- rowan_mcp/functions/system_management.py +0 -368
- rowan_mcp/functions/tautomers.py +0 -91
- rowan_mcp/functions/workflow_management.py +0 -422
- rowan_mcp-1.0.1.dist-info/RECORD +0 -34
- {rowan_mcp-1.0.1.dist-info → rowan_mcp-2.0.0.dist-info}/WHEEL +0 -0
- {rowan_mcp-1.0.1.dist-info → rowan_mcp-2.0.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Rowan workflow management functions for MCP tool integration.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from typing import Optional, Dict, Any, Union, List, Literal
|
|
6
|
-
import rowan
|
|
7
|
-
|
|
8
|
-
def safe_get_attr(obj, attr: str, default=None):
|
|
9
|
-
"""Safely get an attribute from an object, returning default if it doesn't exist."""
|
|
10
|
-
try:
|
|
11
|
-
return getattr(obj, attr, default)
|
|
12
|
-
except (AttributeError, TypeError):
|
|
13
|
-
return default
|
|
14
|
-
|
|
15
|
-
def rowan_workflow_management(
|
|
16
|
-
action: Literal['create', 'retrieve', 'update', 'stop', 'status', 'is_finished', 'delete', 'list'],
|
|
17
|
-
workflow_uuid: Optional[str] = None,
|
|
18
|
-
name: Optional[str] = None,
|
|
19
|
-
workflow_type: Optional[str] = None,
|
|
20
|
-
initial_molecule: Optional[str] = None,
|
|
21
|
-
parent_uuid: Optional[str] = None,
|
|
22
|
-
notes: Optional[str] = None,
|
|
23
|
-
starred: Optional[bool] = None,
|
|
24
|
-
public: Optional[bool] = None,
|
|
25
|
-
email_when_complete: Optional[bool] = None,
|
|
26
|
-
workflow_data: Optional[Dict[str, Any]] = None,
|
|
27
|
-
name_contains: Optional[str] = None,
|
|
28
|
-
object_status: Optional[int] = None,
|
|
29
|
-
object_type: Optional[str] = None,
|
|
30
|
-
page: int = 0,
|
|
31
|
-
size: int = 50
|
|
32
|
-
) -> str:
|
|
33
|
-
"""Unified workflow management tool for all workflow operations. Available actions: create, retrieve, update, stop, status, is_finished, delete, list.
|
|
34
|
-
|
|
35
|
-
**Available Actions:**
|
|
36
|
-
- **create**: Create a new workflow (requires: name, workflow_type, initial_molecule)
|
|
37
|
-
- **retrieve**: retrieve workflow details (requires: workflow_uuid)
|
|
38
|
-
- **update**: Update workflow properties (requires: workflow_uuid, optional: name, parent_uuid, notes, starred, public, email_when_complete)
|
|
39
|
-
- **stop**: Stop a running workflow (requires: workflow_uuid)
|
|
40
|
-
- **status**: Check workflow status (requires: workflow_uuid)
|
|
41
|
-
- **is_finished**: Check if workflow is finished (requires: workflow_uuid)
|
|
42
|
-
- **delete**: Delete a workflow (requires: workflow_uuid)
|
|
43
|
-
- **list**: List workflows with filters (optional: name_contains, parent_uuid, starred, public, object_status, object_type, page, size)
|
|
44
|
-
|
|
45
|
-
Args:
|
|
46
|
-
action: Action to perform - must be one of: 'create', 'retrieve', 'update', 'stop', 'status', 'is_finished', 'delete', 'list'
|
|
47
|
-
workflow_uuid: UUID of the workflow (required for retrieve, update, stop, status, is_finished, delete)
|
|
48
|
-
name: Workflow name (required for create, optional for update)
|
|
49
|
-
workflow_type: Type of workflow (required for create)
|
|
50
|
-
initial_molecule: Initial molecule SMILES (required for create)
|
|
51
|
-
parent_uuid: Parent folder UUID (optional for create/update)
|
|
52
|
-
notes: Workflow notes (optional for create/update)
|
|
53
|
-
starred: Star the workflow (optional for create/update)
|
|
54
|
-
public: Make workflow public (optional for create/update)
|
|
55
|
-
email_when_complete: Email when complete (optional for create/update)
|
|
56
|
-
workflow_data: Additional workflow data (optional for create)
|
|
57
|
-
name_contains: Filter by name containing text (optional for list)
|
|
58
|
-
object_status: Filter by status (0=queued, 1=running, 2=completed, 3=failed, 4=stopped, optional for list)
|
|
59
|
-
object_type: Filter by workflow type (optional for list)
|
|
60
|
-
page: Page number for pagination (default: 1, for list)
|
|
61
|
-
size: Results per page (default: 50, for list)
|
|
62
|
-
|
|
63
|
-
Returns:
|
|
64
|
-
Results of the workflow operation
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
action = action.lower()
|
|
68
|
-
|
|
69
|
-
try:
|
|
70
|
-
if action == "create":
|
|
71
|
-
if not all([name, workflow_type, initial_molecule]):
|
|
72
|
-
return " Error: 'name', 'workflow_type', and 'initial_molecule' are required for creating a workflow"
|
|
73
|
-
|
|
74
|
-
# Validate workflow type
|
|
75
|
-
VALID_WORKFLOWS = {
|
|
76
|
-
"admet", "basic_calculation", "conformer_search", "descriptors",
|
|
77
|
-
"docking", "electronic_properties", "fukui",
|
|
78
|
-
"irc", "molecular_dynamics", "multistage_opt", "pka", "redox_potential",
|
|
79
|
-
"scan", "solubility", "spin_states", "tautomers"
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if workflow_type not in VALID_WORKFLOWS:
|
|
83
|
-
error_msg = f" Invalid workflow_type '{workflow_type}'.\n\n"
|
|
84
|
-
error_msg += " **Available Rowan Workflow Types:**\n"
|
|
85
|
-
error_msg += f"{', '.join(sorted(VALID_WORKFLOWS))}"
|
|
86
|
-
return error_msg
|
|
87
|
-
|
|
88
|
-
workflow = rowan.Workflow.create(
|
|
89
|
-
name=name,
|
|
90
|
-
workflow_type=workflow_type,
|
|
91
|
-
initial_molecule=initial_molecule,
|
|
92
|
-
parent_uuid=parent_uuid,
|
|
93
|
-
notes=notes or "",
|
|
94
|
-
starred=starred or False,
|
|
95
|
-
public=public or False,
|
|
96
|
-
email_when_complete=email_when_complete or False,
|
|
97
|
-
workflow_data=workflow_data or {}
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
formatted = f" Workflow '{name}' created successfully!\n\n"
|
|
101
|
-
formatted += f" UUID: {safe_get_attr(workflow, 'uuid', 'N/A')}\n"
|
|
102
|
-
formatted += f" Type: {workflow_type}\n"
|
|
103
|
-
formatted += f" Status: {safe_get_attr(workflow, 'object_status', 'Unknown')}\n"
|
|
104
|
-
formatted += f" Created: {safe_get_attr(workflow, 'created_at', 'N/A')}\n"
|
|
105
|
-
return formatted
|
|
106
|
-
|
|
107
|
-
elif action == "retrieve":
|
|
108
|
-
if not workflow_uuid:
|
|
109
|
-
return " Error: 'workflow_uuid' is required for retrieving a workflow"
|
|
110
|
-
|
|
111
|
-
try:
|
|
112
|
-
workflow = rowan.Workflow.retrieve(uuid=workflow_uuid)
|
|
113
|
-
except Exception as e:
|
|
114
|
-
return f" Error retrieving workflow: {str(e)}"
|
|
115
|
-
|
|
116
|
-
# Handle workflow as dictionary (which is what Rowan API returns)
|
|
117
|
-
def safe_get_dict_value(data, key, default='N/A'):
|
|
118
|
-
"""Safely get a value from a dictionary."""
|
|
119
|
-
if isinstance(data, dict):
|
|
120
|
-
return data.get(key, default)
|
|
121
|
-
return safe_get_attr(data, key, default)
|
|
122
|
-
|
|
123
|
-
# Get status and interpret it
|
|
124
|
-
status = safe_get_dict_value(workflow, 'object_status', 'Unknown')
|
|
125
|
-
status_names = {
|
|
126
|
-
0: "Queued",
|
|
127
|
-
1: "Running",
|
|
128
|
-
2: "Completed",
|
|
129
|
-
3: "Failed",
|
|
130
|
-
4: "Stopped",
|
|
131
|
-
5: "Awaiting Queue"
|
|
132
|
-
}
|
|
133
|
-
status_name = status_names.get(status, f"Unknown ({status})")
|
|
134
|
-
|
|
135
|
-
formatted = f" Workflow Details:\n\n"
|
|
136
|
-
formatted += f" Name: {safe_get_dict_value(workflow, 'name', 'N/A')}\n"
|
|
137
|
-
formatted += f" UUID: {safe_get_dict_value(workflow, 'uuid', 'N/A')}\n"
|
|
138
|
-
formatted += f" Type: {safe_get_dict_value(workflow, 'object_type', 'N/A')}\n"
|
|
139
|
-
formatted += f" Status: {status_name} ({status})\n"
|
|
140
|
-
formatted += f" Parent: {safe_get_dict_value(workflow, 'parent_uuid', 'Root')}\n"
|
|
141
|
-
formatted += f" Starred: {'Yes' if safe_get_dict_value(workflow, 'starred', False) else 'No'}\n"
|
|
142
|
-
formatted += f" Public: {'Yes' if safe_get_dict_value(workflow, 'public', False) else 'No'}\n"
|
|
143
|
-
formatted += f" Created: {safe_get_dict_value(workflow, 'created_at', 'N/A')}\n"
|
|
144
|
-
formatted += f" Elapsed: {safe_get_dict_value(workflow, 'elapsed', 0):.2f}s\n"
|
|
145
|
-
formatted += f" Credits: {safe_get_dict_value(workflow, 'credits_charged', 0)}\n"
|
|
146
|
-
formatted += f" Notes: {safe_get_dict_value(workflow, 'notes', 'None')}\n\n"
|
|
147
|
-
|
|
148
|
-
# If workflow is completed (status 2), extract and show results
|
|
149
|
-
if status == 2:
|
|
150
|
-
formatted += f" **Workflow Completed Successfully!**\n\n"
|
|
151
|
-
|
|
152
|
-
# Show basic completion details
|
|
153
|
-
credits_charged = safe_get_dict_value(workflow, 'credits_charged', 0)
|
|
154
|
-
elapsed_time = safe_get_dict_value(workflow, 'elapsed', 0)
|
|
155
|
-
if credits_charged or elapsed_time:
|
|
156
|
-
formatted += f" Workflow used {credits_charged} credits and ran for {elapsed_time:.2f}s\n\n"
|
|
157
|
-
|
|
158
|
-
# Debug: Show all available keys in the workflow dictionary
|
|
159
|
-
if isinstance(workflow, dict):
|
|
160
|
-
workflow_keys = list(workflow.keys())
|
|
161
|
-
formatted += f" **Debug - Available Workflow Keys:**\n"
|
|
162
|
-
formatted += f" {', '.join(workflow_keys)}\n\n"
|
|
163
|
-
else:
|
|
164
|
-
# Fallback for object-based workflows
|
|
165
|
-
workflow_attrs = []
|
|
166
|
-
for attr in dir(workflow):
|
|
167
|
-
if not attr.startswith('_'):
|
|
168
|
-
try:
|
|
169
|
-
value = getattr(workflow, attr)
|
|
170
|
-
if not callable(value):
|
|
171
|
-
workflow_attrs.append(attr)
|
|
172
|
-
except:
|
|
173
|
-
pass
|
|
174
|
-
formatted += f" **Debug - Available Workflow Attributes:**\n"
|
|
175
|
-
formatted += f" {', '.join(workflow_attrs)}\n\n"
|
|
176
|
-
|
|
177
|
-
# Extract actual results from object_data
|
|
178
|
-
object_data = safe_get_dict_value(workflow, 'object_data', {})
|
|
179
|
-
workflow_type = safe_get_dict_value(workflow, 'object_type', '')
|
|
180
|
-
|
|
181
|
-
formatted += f" **Results Analysis:**\n"
|
|
182
|
-
formatted += f" Workflow Type: {workflow_type}\n"
|
|
183
|
-
formatted += f" Object Data Present: {'Yes' if object_data else 'No'}\n"
|
|
184
|
-
|
|
185
|
-
if object_data:
|
|
186
|
-
formatted += f" Object Data Keys: {list(object_data.keys()) if isinstance(object_data, dict) else 'Not a dictionary'}\n\n"
|
|
187
|
-
formatted += extract_workflow_results(workflow_type, object_data)
|
|
188
|
-
else:
|
|
189
|
-
formatted += f" **No results data found in workflow object_data**\n"
|
|
190
|
-
formatted += f" This could mean:\n"
|
|
191
|
-
formatted += f" • The workflow completed but didn't generate data\n"
|
|
192
|
-
formatted += f" • The results are stored in a different attribute\n"
|
|
193
|
-
formatted += f" • There was an issue with the workflow execution\n"
|
|
194
|
-
|
|
195
|
-
elif status == 1: # Running
|
|
196
|
-
formatted += f" **Workflow is currently running...**\n"
|
|
197
|
-
formatted += f" Check back later or use `rowan_workflow_management(action='status', workflow_uuid='{workflow_uuid}')` for updates\n"
|
|
198
|
-
elif status == 0: # Queued
|
|
199
|
-
formatted += f" **Workflow is queued and waiting to start**\n"
|
|
200
|
-
formatted += f" Use `rowan_workflow_management(action='status', workflow_uuid='{workflow_uuid}')` to check progress\n"
|
|
201
|
-
elif status == 3: # Failed
|
|
202
|
-
formatted += f" **Workflow failed**\n"
|
|
203
|
-
formatted += f" Check the workflow details in the Rowan web interface for error messages\n"
|
|
204
|
-
elif status == 4: # Stopped
|
|
205
|
-
formatted += f" **Workflow was stopped**\n"
|
|
206
|
-
|
|
207
|
-
return formatted
|
|
208
|
-
|
|
209
|
-
elif action == "update":
|
|
210
|
-
if not workflow_uuid:
|
|
211
|
-
return " Error: 'workflow_uuid' is required for updating a workflow"
|
|
212
|
-
|
|
213
|
-
# Build update parameters according to Rowan API docs
|
|
214
|
-
update_params = {'uuid': workflow_uuid}
|
|
215
|
-
updates_made = []
|
|
216
|
-
|
|
217
|
-
if name is not None:
|
|
218
|
-
update_params['name'] = name
|
|
219
|
-
updates_made.append(f"name: {name}")
|
|
220
|
-
if parent_uuid is not None:
|
|
221
|
-
update_params['parent_uuid'] = parent_uuid
|
|
222
|
-
updates_made.append(f"parent_uuid: {parent_uuid}")
|
|
223
|
-
if notes is not None:
|
|
224
|
-
update_params['notes'] = notes
|
|
225
|
-
updates_made.append(f"notes: {notes}")
|
|
226
|
-
if starred is not None:
|
|
227
|
-
update_params['starred'] = starred
|
|
228
|
-
updates_made.append(f"starred: {starred}")
|
|
229
|
-
if public is not None:
|
|
230
|
-
update_params['public'] = public
|
|
231
|
-
updates_made.append(f"public: {public}")
|
|
232
|
-
if email_when_complete is not None:
|
|
233
|
-
update_params['email_when_complete'] = email_when_complete
|
|
234
|
-
updates_made.append(f"email_when_complete: {email_when_complete}")
|
|
235
|
-
|
|
236
|
-
if len(update_params) == 1: # Only UUID provided
|
|
237
|
-
return " Error: At least one field must be provided for updating (name, parent_uuid, notes, starred, public, email_when_complete)"
|
|
238
|
-
|
|
239
|
-
# Call Rowan API with correct parameter structure
|
|
240
|
-
workflow = rowan.Workflow.update(**update_params)
|
|
241
|
-
|
|
242
|
-
# Format response using the returned workflow object
|
|
243
|
-
formatted = f" Workflow updated successfully!\n\n"
|
|
244
|
-
formatted += f" UUID: {safe_get_attr(workflow, 'uuid', workflow_uuid)}\n"
|
|
245
|
-
formatted += f" Name: {safe_get_attr(workflow, 'name', 'N/A')}\n"
|
|
246
|
-
formatted += f" Type: {safe_get_attr(workflow, 'object_type', 'N/A')}\n"
|
|
247
|
-
formatted += f" Parent: {safe_get_attr(workflow, 'parent_uuid', 'Root')}\n"
|
|
248
|
-
formatted += f" Starred: {'Yes' if safe_get_attr(workflow, 'starred', False) else 'No'}\n"
|
|
249
|
-
formatted += f" Public: {'Yes' if safe_get_attr(workflow, 'public', False) else 'No'}\n"
|
|
250
|
-
formatted += f" Email on Complete: {'Yes' if safe_get_attr(workflow, 'email_when_complete', False) else 'No'}\n"
|
|
251
|
-
formatted += f" Notes: {safe_get_attr(workflow, 'notes', 'None')}\n\n"
|
|
252
|
-
|
|
253
|
-
formatted += f" **Updates Applied:**\n"
|
|
254
|
-
for update in updates_made:
|
|
255
|
-
formatted += f"• {update}\n"
|
|
256
|
-
|
|
257
|
-
return formatted
|
|
258
|
-
|
|
259
|
-
elif action in ["stop", "status", "is_finished"]:
|
|
260
|
-
if not workflow_uuid:
|
|
261
|
-
return f" Error: 'workflow_uuid' is required for {action} action"
|
|
262
|
-
|
|
263
|
-
if action == "stop":
|
|
264
|
-
result = rowan.Workflow.stop(uuid=workflow_uuid)
|
|
265
|
-
return f" Workflow stop request submitted. Result: {result}"
|
|
266
|
-
elif action == "status":
|
|
267
|
-
workflow = rowan.Workflow.retrieve(uuid=workflow_uuid)
|
|
268
|
-
|
|
269
|
-
# Handle workflow as dictionary
|
|
270
|
-
def safe_get_dict_value(data, key, default='N/A'):
|
|
271
|
-
if isinstance(data, dict):
|
|
272
|
-
return data.get(key, default)
|
|
273
|
-
return safe_get_attr(data, key, default)
|
|
274
|
-
|
|
275
|
-
status = safe_get_dict_value(workflow, 'object_status', 'Unknown')
|
|
276
|
-
status_names = {
|
|
277
|
-
0: "Queued",
|
|
278
|
-
1: "Running",
|
|
279
|
-
2: "Completed",
|
|
280
|
-
3: "Failed",
|
|
281
|
-
4: "Stopped",
|
|
282
|
-
5: "Awaiting Queue"
|
|
283
|
-
}
|
|
284
|
-
status_name = status_names.get(status, f"Unknown ({status})")
|
|
285
|
-
|
|
286
|
-
formatted = f" **Workflow Status**: {status_name} ({status})\n"
|
|
287
|
-
formatted += f" UUID: {workflow_uuid}\n"
|
|
288
|
-
formatted += f" Name: {safe_get_dict_value(workflow, 'name', 'N/A')}\n"
|
|
289
|
-
formatted += f" Elapsed: {safe_get_dict_value(workflow, 'elapsed', 0):.2f}s\n"
|
|
290
|
-
|
|
291
|
-
if status == 2:
|
|
292
|
-
formatted += f" **Completed successfully!** Use 'retrieve' action to get results.\n"
|
|
293
|
-
elif status == 1:
|
|
294
|
-
formatted += f" **Currently running...** Check back later for results.\n"
|
|
295
|
-
elif status == 0:
|
|
296
|
-
formatted += f" **Queued and waiting to start**\n"
|
|
297
|
-
elif status == 3:
|
|
298
|
-
formatted += f" **Failed** - Check workflow details for error information.\n"
|
|
299
|
-
elif status == 4:
|
|
300
|
-
formatted += f" **Stopped**\n"
|
|
301
|
-
|
|
302
|
-
return formatted
|
|
303
|
-
elif action == "is_finished":
|
|
304
|
-
workflow = rowan.Workflow.retrieve(uuid=workflow_uuid)
|
|
305
|
-
|
|
306
|
-
# Handle workflow as dictionary
|
|
307
|
-
def safe_get_dict_value(data, key, default='N/A'):
|
|
308
|
-
if isinstance(data, dict):
|
|
309
|
-
return data.get(key, default)
|
|
310
|
-
return safe_get_attr(data, key, default)
|
|
311
|
-
|
|
312
|
-
status = safe_get_dict_value(workflow, 'object_status', 'Unknown')
|
|
313
|
-
is_finished = status in [2, 3, 4] # Completed, Failed, or Stopped
|
|
314
|
-
|
|
315
|
-
formatted = f" **Workflow Finished Check**\n"
|
|
316
|
-
formatted += f" UUID: {workflow_uuid}\n"
|
|
317
|
-
formatted += f" Status: {status}\n"
|
|
318
|
-
formatted += f" Finished: {'Yes' if is_finished else 'No'}\n"
|
|
319
|
-
|
|
320
|
-
if is_finished:
|
|
321
|
-
if status == 2:
|
|
322
|
-
formatted += f" Use 'retrieve' action to get results\n"
|
|
323
|
-
elif status == 3:
|
|
324
|
-
formatted += f" Workflow failed - check details for error info\n"
|
|
325
|
-
elif status == 4:
|
|
326
|
-
formatted += f" Workflow was stopped\n"
|
|
327
|
-
else:
|
|
328
|
-
formatted += f" Workflow is still {['queued', 'running'][status] if status in [0, 1] else 'in progress'}\n"
|
|
329
|
-
|
|
330
|
-
return formatted
|
|
331
|
-
|
|
332
|
-
elif action == "delete":
|
|
333
|
-
if not workflow_uuid:
|
|
334
|
-
return " Error: 'workflow_uuid' is required for deleting a workflow"
|
|
335
|
-
|
|
336
|
-
result = rowan.Workflow.delete(uuid=workflow_uuid)
|
|
337
|
-
return f" Workflow deletion request submitted. Result: {result}"
|
|
338
|
-
|
|
339
|
-
elif action == "list":
|
|
340
|
-
# Build filters
|
|
341
|
-
filters = {
|
|
342
|
-
'page': page,
|
|
343
|
-
'size': min(size * 5, 250) # Get more workflows to sort properly, cap at 250
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if name_contains:
|
|
347
|
-
filters['name_contains'] = name_contains
|
|
348
|
-
if parent_uuid:
|
|
349
|
-
filters['parent_uuid'] = parent_uuid
|
|
350
|
-
if starred is not None:
|
|
351
|
-
filters['starred'] = starred
|
|
352
|
-
if public is not None:
|
|
353
|
-
filters['public'] = public
|
|
354
|
-
if object_status is not None:
|
|
355
|
-
filters['object_status'] = object_status
|
|
356
|
-
if object_type:
|
|
357
|
-
filters['object_type'] = object_type
|
|
358
|
-
|
|
359
|
-
workflows = rowan.Workflow.list(**filters)
|
|
360
|
-
|
|
361
|
-
# Sort workflows by created_at in descending order (most recent first)
|
|
362
|
-
if 'workflows' in workflows and workflows['workflows']:
|
|
363
|
-
from datetime import datetime
|
|
364
|
-
|
|
365
|
-
def parse_date(date_str):
|
|
366
|
-
try:
|
|
367
|
-
return datetime.fromisoformat(date_str.replace('Z', '+00:00'))
|
|
368
|
-
except:
|
|
369
|
-
return datetime.min
|
|
370
|
-
|
|
371
|
-
sorted_workflows = sorted(
|
|
372
|
-
workflows['workflows'],
|
|
373
|
-
key=lambda w: parse_date(w.get('created_at', '')),
|
|
374
|
-
reverse=True
|
|
375
|
-
)
|
|
376
|
-
|
|
377
|
-
# Remove object_logfile from each workflow and return only the requested number
|
|
378
|
-
cleaned_workflows = []
|
|
379
|
-
for workflow in sorted_workflows[:size]:
|
|
380
|
-
cleaned_workflow = {k: v for k, v in workflow.items() if k != 'object_logfile'}
|
|
381
|
-
cleaned_workflows.append(cleaned_workflow)
|
|
382
|
-
|
|
383
|
-
workflows['workflows'] = cleaned_workflows
|
|
384
|
-
|
|
385
|
-
return workflows
|
|
386
|
-
|
|
387
|
-
else:
|
|
388
|
-
return f" Error: Unknown action '{action}'. Available actions: create, retrieve, update, stop, status, is_finished, delete, list"
|
|
389
|
-
|
|
390
|
-
except Exception as e:
|
|
391
|
-
return f" Error in workflow management: {str(e)}"
|
|
392
|
-
|
|
393
|
-
def extract_workflow_results(workflow_type: str, object_data: Dict[str, Any]) -> str:
|
|
394
|
-
"""Extract and format workflow results - simple raw data display."""
|
|
395
|
-
|
|
396
|
-
formatted = f" **{workflow_type.replace('_', ' ').title()} Results:**\n\n"
|
|
397
|
-
|
|
398
|
-
import json
|
|
399
|
-
try:
|
|
400
|
-
# Pretty print the object_data as JSON
|
|
401
|
-
formatted += f"```json\n{json.dumps(object_data, indent=2, default=str)}\n```\n"
|
|
402
|
-
except Exception as e:
|
|
403
|
-
# Fallback if JSON serialization fails
|
|
404
|
-
formatted += f"Raw object_data:\n{str(object_data)}\n"
|
|
405
|
-
formatted += f"(JSON serialization failed: {e})\n"
|
|
406
|
-
|
|
407
|
-
return formatted
|
|
408
|
-
|
|
409
|
-
def test_rowan_workflow_management():
|
|
410
|
-
"""Test the workflow management function."""
|
|
411
|
-
try:
|
|
412
|
-
# Test list action
|
|
413
|
-
result = rowan_workflow_management("list", size=5)
|
|
414
|
-
print(" Workflow management test successful!")
|
|
415
|
-
print(f"Sample result: {result[:200]}...")
|
|
416
|
-
return True
|
|
417
|
-
except Exception as e:
|
|
418
|
-
print(f" Workflow management test failed: {e}")
|
|
419
|
-
return False
|
|
420
|
-
|
|
421
|
-
if __name__ == "__main__":
|
|
422
|
-
test_rowan_workflow_management()
|
rowan_mcp-1.0.1.dist-info/RECORD
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
rowan_mcp/__init__.py,sha256=P0K_WQJCQuyQtG4fNFto6Wutijtle32lG9sFB96cYiw,381
|
|
2
|
-
rowan_mcp/__main__.py,sha256=I7wCpoCPLrCx_tWozFBtCtnoL65lmgDiZnEumj3vijM,388
|
|
3
|
-
rowan_mcp/server.py,sha256=47MsJchxzqRVd4mFQXR81wYXBX8B8fFUkl7wDYB5uMs,7702
|
|
4
|
-
rowan_mcp/functions/admet.py,sha256=m_RD7OJ8GDocEInHw4zOmk4tBf2mWBGTL3LVt-vo_mU,2438
|
|
5
|
-
rowan_mcp/functions/bde.py,sha256=x6Wmnqzy3zRDvSM_AlxSm_0ksg9lI2zV1PiBzXjU_sU,3634
|
|
6
|
-
rowan_mcp/functions/calculation_retrieve.py,sha256=jL28RKvZX3QUeZ_qDlBfLdGG_Lsk6LyA1xjsHvPM-mg,3376
|
|
7
|
-
rowan_mcp/functions/conformers.py,sha256=2Bjim0v5xajWykVwRU9YPwtNyqIo6n2wiLDgR2_5wE8,2552
|
|
8
|
-
rowan_mcp/functions/descriptors.py,sha256=HJXsMZmgx-PdqfSe39D0BcMxzRYmR38gt98fXIMc69w,2747
|
|
9
|
-
rowan_mcp/functions/docking.py,sha256=J-bcgig_68x07eCpVPG1ZJKdUFsPVeDuvhoeM9Y9V9I,13954
|
|
10
|
-
rowan_mcp/functions/docking_enhanced.py,sha256=lwviIWg_26VW8VlITIlHd-Lbw8E25tnvNrLfzK6fLJs,5528
|
|
11
|
-
rowan_mcp/functions/electronic_properties.py,sha256=hBpUz0lP5ImRS8U8Cqd04tl_vzyoUSl3eP1sHKvG7Yg,8154
|
|
12
|
-
rowan_mcp/functions/folder_management.py,sha256=qPZ6cjC2AFxr1BhXpRsJk2AZAF7GV5ojy6oJDQjYKbw,4874
|
|
13
|
-
rowan_mcp/functions/fukui.py,sha256=7uz0kQ-Bt9_m4YXto4BlEJFbAknusnwZlfl67tWrwmg,7750
|
|
14
|
-
rowan_mcp/functions/hydrogen_bond_basicity.py,sha256=xH7czHEF_stKnQoh-F93b8G8936DCTYjkf6nTa7kmKo,3081
|
|
15
|
-
rowan_mcp/functions/irc.py,sha256=ulMfkpVTXoQDwFVzAJRcEbyZpFxM2LucO7Mq-XkgNTs,4096
|
|
16
|
-
rowan_mcp/functions/macropka.py,sha256=ze0D8R5-1-FLfOLXNe06I-BUAUKF9CHeWuTYw30sT1s,3985
|
|
17
|
-
rowan_mcp/functions/molecular_converter.py,sha256=j9YeCnaHZahwkhG2EZNPu5VVmGy2sqIHPB_qf1ojoec,17349
|
|
18
|
-
rowan_mcp/functions/molecular_dynamics.py,sha256=yzA03LeFv8K59Cg1SAnavWwmodl4_KW667pRHJQTXNw,6990
|
|
19
|
-
rowan_mcp/functions/molecule_lookup.py,sha256=Ff3ARljNbLlGgSinREl6OFxoJ-HVXtbXPxy-r_6CMKs,1467
|
|
20
|
-
rowan_mcp/functions/multistage_opt.py,sha256=lWwgXZgpXnWsjgonkA1toks4t01Cdxo822xmT2EOssM,6185
|
|
21
|
-
rowan_mcp/functions/pdb_handler.py,sha256=EnhRqxStnke5kiSnDaWOzcJT8fAHW6VVIhTaH6ODkWE,6241
|
|
22
|
-
rowan_mcp/functions/pka.py,sha256=EFGIFtq2HrtNzcU5-3-ncgmpiwIGnOE-vROjr_eC1Nk,5014
|
|
23
|
-
rowan_mcp/functions/redox_potential.py,sha256=NXU1sEkMqI-2-LD9qv7qaBhkmAvwU3dFGLQ988DG4cc,13114
|
|
24
|
-
rowan_mcp/functions/scan.py,sha256=LWr6YKwCG3gv0ZtyCbPaJ81NlQyFTHFZ4WnXvSRxmVg,24235
|
|
25
|
-
rowan_mcp/functions/scan_analyzer.py,sha256=vnAokCFOxYbv3Px3p9dEIxQXL7ot6UMjeUfMb_ZF6Ug,13479
|
|
26
|
-
rowan_mcp/functions/solubility.py,sha256=-duTeVLEhnhNtNkA0L_cBk8Xjqw5bbAXrrEFqtElg4I,11112
|
|
27
|
-
rowan_mcp/functions/spin_states.py,sha256=NG7uJjTi_Fx-E4Qr7RzjNhfFmKlHfIGMD0Uhyo7sKT4,31895
|
|
28
|
-
rowan_mcp/functions/system_management.py,sha256=UwdKD46FNEJh1zEPpvFW7-JBD6g8x-xSbmH7lrcubx0,20089
|
|
29
|
-
rowan_mcp/functions/tautomers.py,sha256=oXFUpMgCVtXy2JnyCb8G04vYj_anJj4WThD26ZGOsZ0,2694
|
|
30
|
-
rowan_mcp/functions/workflow_management.py,sha256=EqXRqj0EuJz7h2igqOHBpq23Qyo-KT9geWp39URacxw,21130
|
|
31
|
-
rowan_mcp-1.0.1.dist-info/METADATA,sha256=LMlceF8ZjrMjgaJdx7sxCEskrF7E2jMBQsnCyOVFZl0,6262
|
|
32
|
-
rowan_mcp-1.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
33
|
-
rowan_mcp-1.0.1.dist-info/entry_points.txt,sha256=QkmK3GHkTNA6gqyTIFrl2V2eVBm-VBdRAlDNsvi4Rl0,52
|
|
34
|
-
rowan_mcp-1.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|