@aithr-ai/mcp-server 1.1.4 → 1.1.6
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.
- package/index.js +51 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -212,7 +212,7 @@ class MCPServer {
|
|
|
212
212
|
},
|
|
213
213
|
{
|
|
214
214
|
name: 'aether_trigger_generation',
|
|
215
|
-
description: 'Trigger AI generation for an agent on the canvas. For orchestra mode, pass the orchestraContext from aether_orchestra_next to inject full context including upstream artifacts.',
|
|
215
|
+
description: 'Trigger AI generation for an agent on the canvas. For orchestra mode, pass the orchestraContext from aether_orchestra_next to inject full context including upstream artifacts. If generation times out (>300s), returns autoSplitAdvice with guidance on breaking the task into smaller pieces.',
|
|
216
216
|
inputSchema: {
|
|
217
217
|
type: 'object',
|
|
218
218
|
properties: {
|
|
@@ -228,6 +228,10 @@ class MCPServer {
|
|
|
228
228
|
type: 'object',
|
|
229
229
|
description: 'Orchestra context from aether_orchestra_next - includes sessionId, taskId, phase info, upstream artifacts, and plan excerpt. Pass this directly from the task object returned by orchestra_next.',
|
|
230
230
|
},
|
|
231
|
+
autoSplit: {
|
|
232
|
+
type: 'boolean',
|
|
233
|
+
description: 'If true (default), returns guidance on splitting task when timeout occurs. Set to false to get raw error.',
|
|
234
|
+
},
|
|
231
235
|
},
|
|
232
236
|
required: ['nodeId'],
|
|
233
237
|
},
|
|
@@ -1453,7 +1457,7 @@ class MCPServer {
|
|
|
1453
1457
|
}
|
|
1454
1458
|
|
|
1455
1459
|
async triggerGeneration(args) {
|
|
1456
|
-
const { nodeId, context, orchestraContext } = args;
|
|
1460
|
+
const { nodeId, context, orchestraContext, autoSplit = true } = args;
|
|
1457
1461
|
const projectId = config.projectId;
|
|
1458
1462
|
|
|
1459
1463
|
if (!projectId) {
|
|
@@ -1501,7 +1505,36 @@ class MCPServer {
|
|
|
1501
1505
|
: undefined,
|
|
1502
1506
|
};
|
|
1503
1507
|
} catch (e) {
|
|
1504
|
-
|
|
1508
|
+
const errorMsg = e.message || '';
|
|
1509
|
+
const isTimeout = errorMsg.includes('timed out') ||
|
|
1510
|
+
errorMsg.includes('timeout') ||
|
|
1511
|
+
errorMsg.includes('FUNCTION_INVOCATION_TIMEOUT') ||
|
|
1512
|
+
errorMsg.includes('504') ||
|
|
1513
|
+
errorMsg.includes('Task timed out');
|
|
1514
|
+
|
|
1515
|
+
// If timeout and autoSplit enabled, return guidance for splitting
|
|
1516
|
+
if (isTimeout && autoSplit) {
|
|
1517
|
+
return {
|
|
1518
|
+
success: false,
|
|
1519
|
+
error: 'Generation timed out (exceeded 300 second limit)',
|
|
1520
|
+
timeout: true,
|
|
1521
|
+
autoSplitAdvice: {
|
|
1522
|
+
shouldSplit: true,
|
|
1523
|
+
message: 'Task is too large. Split into smaller sub-tasks.',
|
|
1524
|
+
originalContext: context?.substring(0, 500) || 'No context provided',
|
|
1525
|
+
suggestedApproach: [
|
|
1526
|
+
'1. Break the task into 3-5 smaller focused tasks',
|
|
1527
|
+
'2. Create separate agents for each sub-task using aether_add_agent',
|
|
1528
|
+
'3. Run each sub-task individually',
|
|
1529
|
+
'4. Combine results at the end',
|
|
1530
|
+
],
|
|
1531
|
+
example: 'Instead of "Create all types for the app", do "Create User and Session types", then "Create Transcript and Claim types", etc.',
|
|
1532
|
+
},
|
|
1533
|
+
hint: 'The task was too complex for a single generation. Break it into smaller pieces and try again.',
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
return { success: false, error: errorMsg };
|
|
1505
1538
|
}
|
|
1506
1539
|
}
|
|
1507
1540
|
|
|
@@ -2909,7 +2942,21 @@ class MCPServer {
|
|
|
2909
2942
|
}
|
|
2910
2943
|
|
|
2911
2944
|
const response = await fetch(url, options);
|
|
2912
|
-
|
|
2945
|
+
|
|
2946
|
+
// Handle non-JSON responses gracefully
|
|
2947
|
+
let responseData;
|
|
2948
|
+
const responseText = await response.text();
|
|
2949
|
+
|
|
2950
|
+
try {
|
|
2951
|
+
responseData = JSON.parse(responseText);
|
|
2952
|
+
} catch (parseError) {
|
|
2953
|
+
// If response isn't valid JSON, wrap it in an error object
|
|
2954
|
+
if (!response.ok) {
|
|
2955
|
+
throw new Error(`API error ${response.status}: ${responseText.substring(0, 500)}`);
|
|
2956
|
+
}
|
|
2957
|
+
// Successful but non-JSON response (shouldn't happen but handle gracefully)
|
|
2958
|
+
responseData = { rawResponse: responseText };
|
|
2959
|
+
}
|
|
2913
2960
|
|
|
2914
2961
|
if (!response.ok) {
|
|
2915
2962
|
// Include hints and code in error message for better debugging
|