@cronicorn/mcp-server 1.6.1 → 1.7.1
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/README.md +144 -0
- package/dist/docs/core-concepts.md +0 -6
- package/dist/docs/developers/quick-start.md +0 -5
- package/dist/docs/developers/workspace-structure.md +0 -5
- package/dist/docs/introduction.md +34 -50
- package/dist/docs/mcp-server.md +127 -0
- package/dist/docs/quick-start.md +0 -13
- package/dist/docs/technical/configuration-and-constraints.md +0 -6
- package/dist/docs/technical/coordinating-multiple-endpoints.md +0 -6
- package/dist/docs/technical/how-ai-adaptation-works.md +0 -6
- package/dist/docs/technical/how-scheduling-works.md +0 -6
- package/dist/docs/technical/reference.md +0 -8
- package/dist/docs/technical/system-architecture.md +0 -8
- package/dist/docs/use-cases.md +208 -0
- package/dist/index.js +630 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/docs/mcp-server/troubleshooting.md +0 -82
package/dist/index.js
CHANGED
|
@@ -12566,6 +12566,635 @@ function loadConfig() {
|
|
|
12566
12566
|
return result.data;
|
|
12567
12567
|
}
|
|
12568
12568
|
|
|
12569
|
+
// src/prompts/index.ts
|
|
12570
|
+
init_esm_shims();
|
|
12571
|
+
|
|
12572
|
+
// src/prompts/setup-first-job.ts
|
|
12573
|
+
init_esm_shims();
|
|
12574
|
+
function registerSetupFirstJobPrompt(server) {
|
|
12575
|
+
server.registerPrompt(
|
|
12576
|
+
"setup-first-job",
|
|
12577
|
+
{
|
|
12578
|
+
title: "Set Up Your First Job",
|
|
12579
|
+
description: "Interactive guide to create your first scheduled job in Cronicorn",
|
|
12580
|
+
argsSchema: {
|
|
12581
|
+
task_description: external_exports.string().optional().describe('What should this job do? (e.g., "check API health every 5 minutes")'),
|
|
12582
|
+
endpoint_url: external_exports.string().url().optional().describe("The HTTP endpoint URL to call"),
|
|
12583
|
+
schedule_type: external_exports.enum(["interval", "cron"]).optional().describe("Preferred schedule type: interval (fixed delay) or cron (time-based)")
|
|
12584
|
+
}
|
|
12585
|
+
},
|
|
12586
|
+
({ task_description, endpoint_url, schedule_type }) => {
|
|
12587
|
+
const hasTask = !!task_description;
|
|
12588
|
+
const hasUrl = !!endpoint_url;
|
|
12589
|
+
const hasSchedule = !!schedule_type;
|
|
12590
|
+
return {
|
|
12591
|
+
messages: [
|
|
12592
|
+
{
|
|
12593
|
+
role: "assistant",
|
|
12594
|
+
content: {
|
|
12595
|
+
type: "text",
|
|
12596
|
+
text: `# Welcome to Cronicorn! \u{1F984}
|
|
12597
|
+
|
|
12598
|
+
I'll help you set up your first scheduled job. Cronicorn is an HTTP-first cron scheduler with AI-powered adaptive scheduling.
|
|
12599
|
+
|
|
12600
|
+
## What You'll Create
|
|
12601
|
+
|
|
12602
|
+
${hasTask ? `**Task:** ${task_description}` : "**Task:** We'll define this together"}
|
|
12603
|
+
${hasUrl ? `**Endpoint:** ${endpoint_url}` : "**Endpoint:** We'll set up your HTTP endpoint"}
|
|
12604
|
+
${hasSchedule ? `**Schedule Type:** ${schedule_type}` : "**Schedule Type:** Choose between interval or cron"}
|
|
12605
|
+
|
|
12606
|
+
---
|
|
12607
|
+
|
|
12608
|
+
## Key Concepts
|
|
12609
|
+
|
|
12610
|
+
### Jobs vs Endpoints
|
|
12611
|
+
- **Job**: A container for related scheduled tasks (e.g., "Payment Processing")
|
|
12612
|
+
- **Endpoint**: The actual HTTP URL that gets called on schedule (e.g., "Process Queue")
|
|
12613
|
+
|
|
12614
|
+
A job can have multiple endpoints that coordinate together.
|
|
12615
|
+
|
|
12616
|
+
### Baseline Schedule
|
|
12617
|
+
Your desired execution frequency:
|
|
12618
|
+
- **Interval**: Fixed delay between runs (e.g., every 5 minutes)
|
|
12619
|
+
- **Cron**: Time-based schedule (e.g., "0 */5 * * *" = every 5 minutes)
|
|
12620
|
+
|
|
12621
|
+
### AI Hints (Optional)
|
|
12622
|
+
The AI can dynamically adjust your schedule based on:
|
|
12623
|
+
- Response body metrics (queue depth, error rate, load)
|
|
12624
|
+
- Execution patterns (failures, performance)
|
|
12625
|
+
- Coordination signals (from other endpoints)
|
|
12626
|
+
|
|
12627
|
+
### Safety Constraints
|
|
12628
|
+
- **minIntervalMs**: Fastest the endpoint can run (prevents runaway execution)
|
|
12629
|
+
- **maxIntervalMs**: Slowest the endpoint can run (ensures timely execution)
|
|
12630
|
+
|
|
12631
|
+
---
|
|
12632
|
+
|
|
12633
|
+
## Step-by-Step Setup
|
|
12634
|
+
|
|
12635
|
+
### 1. Create a Job Container
|
|
12636
|
+
|
|
12637
|
+
First, create a job to hold your endpoint:
|
|
12638
|
+
|
|
12639
|
+
\`\`\`
|
|
12640
|
+
Use the create_job tool:
|
|
12641
|
+
- name: "${hasTask ? task_description.slice(0, 50) : "My First Job"}"
|
|
12642
|
+
- description: "${hasTask ? task_description : "Description of what this job does"}"
|
|
12643
|
+
\`\`\`
|
|
12644
|
+
|
|
12645
|
+
### 2. Add an Endpoint
|
|
12646
|
+
|
|
12647
|
+
After creating the job, add an endpoint with your HTTP URL:
|
|
12648
|
+
|
|
12649
|
+
\`\`\`
|
|
12650
|
+
Use the add_endpoint tool:
|
|
12651
|
+
- name: "Main Endpoint"
|
|
12652
|
+
- url: "${hasUrl ? endpoint_url : "https://your-api.com/endpoint"}"
|
|
12653
|
+
- method: "GET" (or POST/PUT/etc.)
|
|
12654
|
+
${schedule_type === "interval" ? `- baselineIntervalMs: 300000 (5 minutes in milliseconds)` : ""}
|
|
12655
|
+
${schedule_type === "cron" ? `- baselineCron: "0 */5 * * *" (every 5 minutes)` : ""}
|
|
12656
|
+
${!hasSchedule ? `- Choose either baselineIntervalMs OR baselineCron (not both)` : ""}
|
|
12657
|
+
\`\`\`
|
|
12658
|
+
|
|
12659
|
+
### 3. Set Safety Constraints (Optional but Recommended)
|
|
12660
|
+
|
|
12661
|
+
Prevent runaway execution with constraints:
|
|
12662
|
+
|
|
12663
|
+
\`\`\`
|
|
12664
|
+
In the add_endpoint call, also include:
|
|
12665
|
+
- minIntervalMs: 60000 (minimum 1 minute between runs)
|
|
12666
|
+
- maxIntervalMs: 600000 (maximum 10 minutes between runs)
|
|
12667
|
+
\`\`\`
|
|
12668
|
+
|
|
12669
|
+
### 4. Structure Your Endpoint Response (For AI Adaptation)
|
|
12670
|
+
|
|
12671
|
+
To enable AI scheduling, return JSON with metrics:
|
|
12672
|
+
|
|
12673
|
+
\`\`\`json
|
|
12674
|
+
{
|
|
12675
|
+
"queue_depth": 150,
|
|
12676
|
+
"processing_rate_per_min": 80,
|
|
12677
|
+
"error_rate_pct": 2.5,
|
|
12678
|
+
"healthy": true,
|
|
12679
|
+
"last_success_at": "2025-11-05T14:30:00Z"
|
|
12680
|
+
}
|
|
12681
|
+
\`\`\`
|
|
12682
|
+
|
|
12683
|
+
The AI looks for field names like: queue, latency, error, rate, count, healthy, status.
|
|
12684
|
+
|
|
12685
|
+
### 5. Verify It's Working
|
|
12686
|
+
|
|
12687
|
+
After setup, check execution:
|
|
12688
|
+
|
|
12689
|
+
\`\`\`
|
|
12690
|
+
Use get_endpoint_health_summary tool to see:
|
|
12691
|
+
- Success rate
|
|
12692
|
+
- Average duration
|
|
12693
|
+
- Failure streak
|
|
12694
|
+
- Last run info
|
|
12695
|
+
\`\`\`
|
|
12696
|
+
|
|
12697
|
+
---
|
|
12698
|
+
|
|
12699
|
+
## Common Patterns
|
|
12700
|
+
|
|
12701
|
+
### Health Check Endpoint
|
|
12702
|
+
\`\`\`
|
|
12703
|
+
Interval: Every 1 minute
|
|
12704
|
+
URL: https://api.example.com/health
|
|
12705
|
+
Response: { "status": "healthy", "latency_ms": 45 }
|
|
12706
|
+
AI behavior: Tighten to 30s if unhealthy, relax to 5min when stable
|
|
12707
|
+
\`\`\`
|
|
12708
|
+
|
|
12709
|
+
### Data Sync Endpoint
|
|
12710
|
+
\`\`\`
|
|
12711
|
+
Interval: Every 5 minutes
|
|
12712
|
+
URL: https://api.example.com/sync
|
|
12713
|
+
Response: { "queue_depth": 50, "pending_count": 12 }
|
|
12714
|
+
AI behavior: Tighten to 1min when queue grows, relax to 10min when empty
|
|
12715
|
+
\`\`\`
|
|
12716
|
+
|
|
12717
|
+
### Daily Cleanup
|
|
12718
|
+
\`\`\`
|
|
12719
|
+
Cron: "0 2 * * *" (2 AM daily)
|
|
12720
|
+
URL: https://api.example.com/cleanup
|
|
12721
|
+
Response: { "records_deleted": 1500, "duration_ms": 3200 }
|
|
12722
|
+
AI behavior: Run immediately if previous run failed
|
|
12723
|
+
\`\`\`
|
|
12724
|
+
|
|
12725
|
+
---
|
|
12726
|
+
|
|
12727
|
+
## Next Steps
|
|
12728
|
+
|
|
12729
|
+
${!hasTask ? "1. Tell me what task you want to schedule" : ""}
|
|
12730
|
+
${!hasUrl ? `${!hasTask ? "2" : "1"}. Provide your HTTP endpoint URL` : ""}
|
|
12731
|
+
${!hasSchedule ? `${!hasTask && !hasUrl ? "3" : !hasTask || !hasUrl ? "2" : "1"}. Choose interval or cron scheduling` : ""}
|
|
12732
|
+
|
|
12733
|
+
Then I'll help you create the job and endpoint using the available tools!
|
|
12734
|
+
`
|
|
12735
|
+
}
|
|
12736
|
+
}
|
|
12737
|
+
]
|
|
12738
|
+
};
|
|
12739
|
+
}
|
|
12740
|
+
);
|
|
12741
|
+
}
|
|
12742
|
+
|
|
12743
|
+
// src/prompts/troubleshoot-failures.ts
|
|
12744
|
+
init_esm_shims();
|
|
12745
|
+
function registerTroubleshootFailuresPrompt(server) {
|
|
12746
|
+
server.registerPrompt(
|
|
12747
|
+
"troubleshoot-failures",
|
|
12748
|
+
{
|
|
12749
|
+
title: "Troubleshoot Endpoint Failures",
|
|
12750
|
+
description: "Debug failing job executions and identify solutions",
|
|
12751
|
+
argsSchema: {
|
|
12752
|
+
job_or_endpoint_name: external_exports.string().optional().describe("Name or ID of the failing job or endpoint"),
|
|
12753
|
+
error_description: external_exports.string().optional().describe("What error are you seeing? (e.g., timeout, 500 status, connection refused)"),
|
|
12754
|
+
when_started: external_exports.enum(["just-now", "today", "this-week", "longer"]).optional().describe("When did the failures start?")
|
|
12755
|
+
}
|
|
12756
|
+
},
|
|
12757
|
+
({ job_or_endpoint_name, error_description, when_started }) => {
|
|
12758
|
+
const hasIdentifier = !!job_or_endpoint_name;
|
|
12759
|
+
const hasError = !!error_description;
|
|
12760
|
+
const hasTimeline = !!when_started;
|
|
12761
|
+
return {
|
|
12762
|
+
messages: [
|
|
12763
|
+
{
|
|
12764
|
+
role: "assistant",
|
|
12765
|
+
content: {
|
|
12766
|
+
type: "text",
|
|
12767
|
+
text: `# Troubleshooting Endpoint Failures \u{1F50D}
|
|
12768
|
+
|
|
12769
|
+
I'll help you debug and fix failing job executions.
|
|
12770
|
+
|
|
12771
|
+
${hasIdentifier ? `**Endpoint:** ${job_or_endpoint_name}` : "**Endpoint:** We'll identify the failing endpoint first"}
|
|
12772
|
+
${hasError ? `**Error:** ${error_description}` : "**Error:** What symptoms are you seeing?"}
|
|
12773
|
+
${hasTimeline ? `**Timeline:** Started ${when_started}` : "**Timeline:** When did this start?"}
|
|
12774
|
+
|
|
12775
|
+
---
|
|
12776
|
+
|
|
12777
|
+
## Diagnostic Approach
|
|
12778
|
+
|
|
12779
|
+
We'll investigate in this order:
|
|
12780
|
+
1. **Identify the endpoint** - Find the exact endpoint having issues
|
|
12781
|
+
2. **Review run history** - Look for patterns in failures
|
|
12782
|
+
3. **Analyze error details** - Understand what's actually failing
|
|
12783
|
+
4. **Check AI hints** - See if adaptive scheduling is causing issues
|
|
12784
|
+
5. **Inspect response bodies** - Look for metric anomalies
|
|
12785
|
+
6. **Apply fixes** - Adjust configuration or pause endpoint
|
|
12786
|
+
|
|
12787
|
+
---
|
|
12788
|
+
|
|
12789
|
+
## Step 1: Find the Failing Endpoint
|
|
12790
|
+
|
|
12791
|
+
${hasIdentifier ? `Since you mentioned **${job_or_endpoint_name}**, let's start there.` : "First, we need to identify which endpoint is failing."}
|
|
12792
|
+
|
|
12793
|
+
\`\`\`
|
|
12794
|
+
Use list_jobs tool to see all your jobs
|
|
12795
|
+
Then use list_endpoints tool with the job ID to see endpoints
|
|
12796
|
+
Look for endpoints with high failure counts or recent errors
|
|
12797
|
+
\`\`\`
|
|
12798
|
+
|
|
12799
|
+
**Red flags to watch for:**
|
|
12800
|
+
- \`failureCount > 0\` - Consecutive failures
|
|
12801
|
+
- \`pausedUntil\` set - Endpoint is paused
|
|
12802
|
+
- \`nextRunAt\` far in future - Exponential backoff active
|
|
12803
|
+
|
|
12804
|
+
---
|
|
12805
|
+
|
|
12806
|
+
## Step 2: Review Run History
|
|
12807
|
+
|
|
12808
|
+
Once you've identified the endpoint, check its execution history:
|
|
12809
|
+
|
|
12810
|
+
\`\`\`
|
|
12811
|
+
Use list_runs tool:
|
|
12812
|
+
- endpointId: "<endpoint-id>"
|
|
12813
|
+
- status: "failure" (to see only failures)
|
|
12814
|
+
- limit: 10 (recent failures)
|
|
12815
|
+
\`\`\`
|
|
12816
|
+
|
|
12817
|
+
**Look for patterns:**
|
|
12818
|
+
- **All failures**: Endpoint configuration issue (URL, auth, timeout)
|
|
12819
|
+
- **Intermittent failures**: External service instability
|
|
12820
|
+
- **Recent failures only**: Something changed (deployment, API update)
|
|
12821
|
+
- **Time-based failures**: Rate limiting or scheduled downtime
|
|
12822
|
+
|
|
12823
|
+
---
|
|
12824
|
+
|
|
12825
|
+
## Step 3: Analyze Failure Details
|
|
12826
|
+
|
|
12827
|
+
Get detailed information about specific failed runs:
|
|
12828
|
+
|
|
12829
|
+
\`\`\`
|
|
12830
|
+
Use get_run_details tool:
|
|
12831
|
+
- runId: "<run-id-from-history>"
|
|
12832
|
+
\`\`\`
|
|
12833
|
+
|
|
12834
|
+
**What to check in the response:**
|
|
12835
|
+
|
|
12836
|
+
### Status Code
|
|
12837
|
+
- \`statusCode: 500\` - Server error (check your endpoint logs)
|
|
12838
|
+
- \`statusCode: 404\` - Wrong URL or endpoint removed
|
|
12839
|
+
- \`statusCode: 401/403\` - Authentication/authorization issue
|
|
12840
|
+
- \`statusCode: 429\` - Rate limited (need to slow down)
|
|
12841
|
+
- \`statusCode: null\` - Network/timeout issue (didn't reach server)
|
|
12842
|
+
|
|
12843
|
+
### Error Message
|
|
12844
|
+
- \`"ECONNREFUSED"\` - Service is down or unreachable
|
|
12845
|
+
- \`"ETIMEDOUT"\` - Request took too long (increase timeoutMs)
|
|
12846
|
+
- \`"ENOTFOUND"\` - DNS resolution failed (check URL)
|
|
12847
|
+
- \`"Certificate error"\` - SSL/TLS issue
|
|
12848
|
+
|
|
12849
|
+
### Duration
|
|
12850
|
+
- Very short duration + failure = Connection issue
|
|
12851
|
+
- Long duration near timeout = Slow endpoint (increase timeout)
|
|
12852
|
+
- Varies widely = Inconsistent performance
|
|
12853
|
+
|
|
12854
|
+
### Response Body
|
|
12855
|
+
- Check if error details are in the response
|
|
12856
|
+
- Look for API error messages
|
|
12857
|
+
- Verify expected JSON structure
|
|
12858
|
+
|
|
12859
|
+
---
|
|
12860
|
+
|
|
12861
|
+
## Step 4: Check Scheduling State
|
|
12862
|
+
|
|
12863
|
+
Investigate if AI hints or scheduling are causing issues:
|
|
12864
|
+
|
|
12865
|
+
\`\`\`
|
|
12866
|
+
Use get_endpoint tool to see full configuration:
|
|
12867
|
+
- Check aiHintIntervalMs - AI might be running too frequently
|
|
12868
|
+
- Check aiHintExpiresAt - Old hint might be interfering
|
|
12869
|
+
- Check pausedUntil - Endpoint might be paused
|
|
12870
|
+
- Check failureCount - Exponential backoff in effect
|
|
12871
|
+
\`\`\`
|
|
12872
|
+
|
|
12873
|
+
**Common scheduling issues:**
|
|
12874
|
+
|
|
12875
|
+
### Exponential Backoff
|
|
12876
|
+
When \`failureCount > 0\`, interval-based endpoints use exponential backoff:
|
|
12877
|
+
- 1 failure: 2x interval
|
|
12878
|
+
- 2 failures: 4x interval
|
|
12879
|
+
- 3 failures: 8x interval
|
|
12880
|
+
- etc.
|
|
12881
|
+
|
|
12882
|
+
This prevents hammering a failing service, but means execution gets slower.
|
|
12883
|
+
|
|
12884
|
+
**Fix:** Reset failure count after addressing the issue
|
|
12885
|
+
\`\`\`
|
|
12886
|
+
Use reset_failure_count tool
|
|
12887
|
+
\`\`\`
|
|
12888
|
+
|
|
12889
|
+
### Aggressive AI Hints
|
|
12890
|
+
AI might have tightened the interval too much (< minIntervalMs), causing rate limits.
|
|
12891
|
+
|
|
12892
|
+
**Fix:** Clear AI hints to revert to baseline
|
|
12893
|
+
\`\`\`
|
|
12894
|
+
Use clear_ai_hints tool
|
|
12895
|
+
\`\`\`
|
|
12896
|
+
|
|
12897
|
+
### Min/Max Constraints
|
|
12898
|
+
If \`minIntervalMs\` is too aggressive for your endpoint, you'll hit rate limits.
|
|
12899
|
+
|
|
12900
|
+
**Fix:** Update endpoint constraints
|
|
12901
|
+
\`\`\`
|
|
12902
|
+
Use update_endpoint tool:
|
|
12903
|
+
- minIntervalMs: 300000 (increase minimum to 5 minutes)
|
|
12904
|
+
\`\`\`
|
|
12905
|
+
|
|
12906
|
+
---
|
|
12907
|
+
|
|
12908
|
+
## Step 5: Inspect Response Bodies
|
|
12909
|
+
|
|
12910
|
+
Check recent successful runs for metric anomalies:
|
|
12911
|
+
|
|
12912
|
+
\`\`\`
|
|
12913
|
+
Use list_runs tool:
|
|
12914
|
+
- status: "success"
|
|
12915
|
+
- limit: 5
|
|
12916
|
+
Then get_run_details for each to see response bodies
|
|
12917
|
+
\`\`\`
|
|
12918
|
+
|
|
12919
|
+
**What to look for:**
|
|
12920
|
+
- **Missing response bodies** - Endpoint not returning JSON (can't adapt)
|
|
12921
|
+
- **Error indicators** - High error rates, queue depths, latency spikes
|
|
12922
|
+
- **Changing patterns** - Metrics that suddenly shifted
|
|
12923
|
+
- **Threshold crossings** - Values exceeding expected ranges
|
|
12924
|
+
|
|
12925
|
+
---
|
|
12926
|
+
|
|
12927
|
+
## Common Issues & Solutions
|
|
12928
|
+
|
|
12929
|
+
### Issue: Timeout Errors
|
|
12930
|
+
**Symptoms:**
|
|
12931
|
+
- \`statusCode: null\`
|
|
12932
|
+
- \`errorMessage: "ETIMEDOUT"\`
|
|
12933
|
+
- \`durationMs\` near or at timeout value
|
|
12934
|
+
|
|
12935
|
+
**Solutions:**
|
|
12936
|
+
1. Increase timeout:
|
|
12937
|
+
\`\`\`
|
|
12938
|
+
Use update_endpoint tool:
|
|
12939
|
+
- timeoutMs: 30000 (increase to 30 seconds)
|
|
12940
|
+
\`\`\`
|
|
12941
|
+
|
|
12942
|
+
2. Optimize your endpoint to respond faster
|
|
12943
|
+
|
|
12944
|
+
3. If endpoint legitimately takes long, increase \`maxExecutionTimeMs\`:
|
|
12945
|
+
\`\`\`
|
|
12946
|
+
Use update_endpoint tool:
|
|
12947
|
+
- maxExecutionTimeMs: 120000 (2 minutes)
|
|
12948
|
+
\`\`\`
|
|
12949
|
+
|
|
12950
|
+
---
|
|
12951
|
+
|
|
12952
|
+
### Issue: Rate Limiting (429 Errors)
|
|
12953
|
+
**Symptoms:**
|
|
12954
|
+
- \`statusCode: 429\`
|
|
12955
|
+
- Error message about rate limits
|
|
12956
|
+
- Happens when AI tightens interval
|
|
12957
|
+
|
|
12958
|
+
**Solutions:**
|
|
12959
|
+
1. Increase minimum interval:
|
|
12960
|
+
\`\`\`
|
|
12961
|
+
Use update_endpoint tool:
|
|
12962
|
+
- minIntervalMs: 60000 (minimum 1 minute between runs)
|
|
12963
|
+
\`\`\`
|
|
12964
|
+
|
|
12965
|
+
2. Clear aggressive AI hints:
|
|
12966
|
+
\`\`\`
|
|
12967
|
+
Use clear_ai_hints tool
|
|
12968
|
+
\`\`\`
|
|
12969
|
+
|
|
12970
|
+
3. Pause endpoint temporarily:
|
|
12971
|
+
\`\`\`
|
|
12972
|
+
Use pause_resume_endpoint tool:
|
|
12973
|
+
- pausedUntil: "2025-11-05T16:00:00Z" (pause until 4 PM)
|
|
12974
|
+
\`\`\`
|
|
12975
|
+
|
|
12976
|
+
---
|
|
12977
|
+
|
|
12978
|
+
### Issue: Service Unavailable (500/503 Errors)
|
|
12979
|
+
**Symptoms:**
|
|
12980
|
+
- \`statusCode: 500 or 503\`
|
|
12981
|
+
- Error messages about server errors
|
|
12982
|
+
- May be intermittent
|
|
12983
|
+
|
|
12984
|
+
**Solutions:**
|
|
12985
|
+
1. Check your endpoint's health separately (outside Cronicorn)
|
|
12986
|
+
|
|
12987
|
+
2. Pause endpoint while investigating:
|
|
12988
|
+
\`\`\`
|
|
12989
|
+
Use pause_resume_endpoint tool:
|
|
12990
|
+
- pausedUntil: "2025-11-05T17:00:00Z"
|
|
12991
|
+
- reason: "Investigating service issues"
|
|
12992
|
+
\`\`\`
|
|
12993
|
+
|
|
12994
|
+
3. If endpoint needs maintenance, pause indefinitely:
|
|
12995
|
+
\`\`\`
|
|
12996
|
+
Use pause_resume_endpoint tool:
|
|
12997
|
+
- pausedUntil: "2025-12-31T23:59:59Z"
|
|
12998
|
+
- reason: "Under maintenance"
|
|
12999
|
+
\`\`\`
|
|
13000
|
+
|
|
13001
|
+
4. Resume when fixed:
|
|
13002
|
+
\`\`\`
|
|
13003
|
+
Use pause_resume_endpoint tool:
|
|
13004
|
+
- pausedUntil: null (resume immediately)
|
|
13005
|
+
\`\`\`
|
|
13006
|
+
|
|
13007
|
+
---
|
|
13008
|
+
|
|
13009
|
+
### Issue: Wrong URL or Authentication
|
|
13010
|
+
**Symptoms:**
|
|
13011
|
+
- \`statusCode: 404\` (not found)
|
|
13012
|
+
- \`statusCode: 401/403\` (unauthorized)
|
|
13013
|
+
- Consistent failures from the start
|
|
13014
|
+
|
|
13015
|
+
**Solutions:**
|
|
13016
|
+
1. Update endpoint URL:
|
|
13017
|
+
\`\`\`
|
|
13018
|
+
Use update_endpoint tool:
|
|
13019
|
+
- url: "https://correct-url.com/endpoint"
|
|
13020
|
+
\`\`\`
|
|
13021
|
+
|
|
13022
|
+
2. Add or fix authentication headers:
|
|
13023
|
+
\`\`\`
|
|
13024
|
+
Use update_endpoint tool:
|
|
13025
|
+
- headersJson: {
|
|
13026
|
+
"Authorization": "Bearer your-token-here",
|
|
13027
|
+
"X-API-Key": "your-api-key"
|
|
13028
|
+
}
|
|
13029
|
+
\`\`\`
|
|
13030
|
+
|
|
13031
|
+
---
|
|
13032
|
+
|
|
13033
|
+
### Issue: Response Body Issues
|
|
13034
|
+
**Symptoms:**
|
|
13035
|
+
- Runs succeed but AI doesn't adapt
|
|
13036
|
+
- Response bodies are null or empty
|
|
13037
|
+
- Response bodies are too large
|
|
13038
|
+
|
|
13039
|
+
**Solutions:**
|
|
13040
|
+
1. Ensure endpoint returns JSON with metrics:
|
|
13041
|
+
\`\`\`json
|
|
13042
|
+
{
|
|
13043
|
+
"status": "healthy",
|
|
13044
|
+
"queue_depth": 50,
|
|
13045
|
+
"error_rate_pct": 1.2,
|
|
13046
|
+
"latency_ms": 145
|
|
13047
|
+
}
|
|
13048
|
+
\`\`\`
|
|
13049
|
+
|
|
13050
|
+
2. If responses are too large, increase limit:
|
|
13051
|
+
\`\`\`
|
|
13052
|
+
Use update_endpoint tool:
|
|
13053
|
+
- maxResponseSizeKb: 100 (increase to 100KB)
|
|
13054
|
+
\`\`\`
|
|
13055
|
+
|
|
13056
|
+
3. Or modify your endpoint to return smaller summaries
|
|
13057
|
+
|
|
13058
|
+
---
|
|
13059
|
+
|
|
13060
|
+
### Issue: Intermittent Network Failures
|
|
13061
|
+
**Symptoms:**
|
|
13062
|
+
- \`errorMessage: "ECONNREFUSED" or "ENOTFOUND"\`
|
|
13063
|
+
- Works sometimes, fails other times
|
|
13064
|
+
- No pattern to failures
|
|
13065
|
+
|
|
13066
|
+
**Solutions:**
|
|
13067
|
+
1. Check if endpoint is behind a firewall or VPN
|
|
13068
|
+
|
|
13069
|
+
2. Verify DNS is stable (try IP address instead of domain)
|
|
13070
|
+
|
|
13071
|
+
3. Add retry logic by relying on Cronicorn's natural retry:
|
|
13072
|
+
- Failed runs increment \`failureCount\`
|
|
13073
|
+
- Next run uses exponential backoff
|
|
13074
|
+
- Successful run resets \`failureCount\`
|
|
13075
|
+
|
|
13076
|
+
4. For critical endpoints, keep \`minIntervalMs\` low to retry faster
|
|
13077
|
+
|
|
13078
|
+
---
|
|
13079
|
+
|
|
13080
|
+
## Step 6: Monitor After Fixes
|
|
13081
|
+
|
|
13082
|
+
After applying fixes, verify the endpoint recovers:
|
|
13083
|
+
|
|
13084
|
+
\`\`\`
|
|
13085
|
+
Use get_endpoint_health_summary tool:
|
|
13086
|
+
- endpointId: "<endpoint-id>"
|
|
13087
|
+
- hours: 1 (last hour since fix)
|
|
13088
|
+
\`\`\`
|
|
13089
|
+
|
|
13090
|
+
**Healthy indicators:**
|
|
13091
|
+
- Success rate improving (> 95%)
|
|
13092
|
+
- Failure count decreasing
|
|
13093
|
+
- Average duration stable
|
|
13094
|
+
- No recent failures
|
|
13095
|
+
|
|
13096
|
+
**Still problematic:**
|
|
13097
|
+
- Success rate still low (< 80%)
|
|
13098
|
+
- Failure streak continuing
|
|
13099
|
+
- Errors persisting
|
|
13100
|
+
|
|
13101
|
+
If issues continue, we may need to:
|
|
13102
|
+
- Pause endpoint for deeper investigation
|
|
13103
|
+
- Review endpoint implementation (your code)
|
|
13104
|
+
- Check external dependencies
|
|
13105
|
+
- Adjust expectations (maybe 100% success isn't realistic)
|
|
13106
|
+
|
|
13107
|
+
---
|
|
13108
|
+
|
|
13109
|
+
## Emergency Actions
|
|
13110
|
+
|
|
13111
|
+
### Pause Immediately
|
|
13112
|
+
If endpoint is causing problems (cost, cascading failures, etc.):
|
|
13113
|
+
|
|
13114
|
+
\`\`\`
|
|
13115
|
+
Use pause_resume_endpoint tool:
|
|
13116
|
+
- pausedUntil: "2099-12-31T23:59:59Z"
|
|
13117
|
+
- reason: "Emergency pause - investigating critical issue"
|
|
13118
|
+
\`\`\`
|
|
13119
|
+
|
|
13120
|
+
### Delete Endpoint
|
|
13121
|
+
If endpoint is no longer needed or completely broken:
|
|
13122
|
+
|
|
13123
|
+
\`\`\`
|
|
13124
|
+
Use delete_endpoint tool:
|
|
13125
|
+
- endpointId: "<endpoint-id>"
|
|
13126
|
+
WARNING: This deletes all run history!
|
|
13127
|
+
\`\`\`
|
|
13128
|
+
|
|
13129
|
+
### Clear Everything and Start Fresh
|
|
13130
|
+
Reset endpoint to baseline state:
|
|
13131
|
+
|
|
13132
|
+
1. Clear AI hints: \`clear_ai_hints\`
|
|
13133
|
+
2. Reset failures: \`reset_failure_count\`
|
|
13134
|
+
3. Resume if paused: \`pause_resume_endpoint\` with \`null\`
|
|
13135
|
+
4. Update configuration: \`update_endpoint\` with corrected values
|
|
13136
|
+
|
|
13137
|
+
---
|
|
13138
|
+
|
|
13139
|
+
## Proactive Monitoring
|
|
13140
|
+
|
|
13141
|
+
To catch issues early, regularly check:
|
|
13142
|
+
|
|
13143
|
+
\`\`\`
|
|
13144
|
+
Use get_dashboard_stats tool to see overview:
|
|
13145
|
+
- Total runs today
|
|
13146
|
+
- Success rate
|
|
13147
|
+
- Failing endpoints
|
|
13148
|
+
- Recent activity
|
|
13149
|
+
\`\`\`
|
|
13150
|
+
|
|
13151
|
+
Set up external alerts based on:
|
|
13152
|
+
- Success rate drops below 90%
|
|
13153
|
+
- Failure count > 3
|
|
13154
|
+
- No successful runs in last hour (for frequent endpoints)
|
|
13155
|
+
|
|
13156
|
+
---
|
|
13157
|
+
|
|
13158
|
+
## Next Steps
|
|
13159
|
+
|
|
13160
|
+
${!hasIdentifier ? "1. Tell me which job or endpoint is failing" : ""}
|
|
13161
|
+
${!hasError ? `${!hasIdentifier ? "2" : "1"}. Describe the error symptoms you're seeing` : ""}
|
|
13162
|
+
${!hasTimeline ? `${!hasIdentifier && !hasError ? "3" : !hasIdentifier || !hasError ? "2" : "1"}. When did the failures start?` : ""}
|
|
13163
|
+
|
|
13164
|
+
Then I'll help you run the diagnostic tools and apply the appropriate fixes!
|
|
13165
|
+
|
|
13166
|
+
---
|
|
13167
|
+
|
|
13168
|
+
\u{1F4DA} **Resources:**
|
|
13169
|
+
- How Scheduling Works: https://docs.cronicorn.com/technical/how-scheduling-works
|
|
13170
|
+
- How AI Adaptation Works: https://docs.cronicorn.com/technical/how-ai-adaptation-works
|
|
13171
|
+
- Configuration Guide: https://docs.cronicorn.com/technical/configuration-and-constraints
|
|
13172
|
+
- Bundled Docs: file:///docs/technical/how-scheduling-works.md
|
|
13173
|
+
|
|
13174
|
+
\u{1F4A1} **Available Tools:**
|
|
13175
|
+
- list_jobs, list_endpoints - Find failing endpoints
|
|
13176
|
+
- list_runs, get_run_details - Review execution history
|
|
13177
|
+
- get_endpoint_health_summary - Health metrics
|
|
13178
|
+
- update_endpoint - Fix configuration
|
|
13179
|
+
- pause_resume_endpoint - Temporarily stop execution
|
|
13180
|
+
- clear_ai_hints - Reset AI scheduling
|
|
13181
|
+
- reset_failure_count - Clear backoff
|
|
13182
|
+
- delete_endpoint - Remove endpoint (permanent)
|
|
13183
|
+
`
|
|
13184
|
+
}
|
|
13185
|
+
}
|
|
13186
|
+
]
|
|
13187
|
+
};
|
|
13188
|
+
}
|
|
13189
|
+
);
|
|
13190
|
+
}
|
|
13191
|
+
|
|
13192
|
+
// src/prompts/index.ts
|
|
13193
|
+
function registerPrompts(server) {
|
|
13194
|
+
registerSetupFirstJobPrompt(server);
|
|
13195
|
+
registerTroubleshootFailuresPrompt(server);
|
|
13196
|
+
}
|
|
13197
|
+
|
|
12569
13198
|
// src/resources/index.ts
|
|
12570
13199
|
init_esm_shims();
|
|
12571
13200
|
import matter from "gray-matter";
|
|
@@ -14390,6 +15019,7 @@ async function main() {
|
|
|
14390
15019
|
}
|
|
14391
15020
|
registerTools(server, env.CRONICORN_API_URL, credentials);
|
|
14392
15021
|
await registerResources(server);
|
|
15022
|
+
registerPrompts(server);
|
|
14393
15023
|
const transport = new StdioServerTransport();
|
|
14394
15024
|
await server.connect(transport);
|
|
14395
15025
|
console.error("\u2705 Cronicorn MCP Server running");
|