# Deterministic Cron Engine MCP

> Deterministic Cron Schedule Engine gives your AI client precise scheduling math. It translates complex cron strings into plain English and back. You can also calculate the exact future date when any schedule will run next. Stop relying on general LLM logic for time; use this MCP to handle all job timing calculations deterministically.

## Overview
- **Category:** utilities
- **Price:** Free
- **Tags:** cron, schedule, parser, automation, zero-dependency, deterministic

## Description

Scheduling tasks requires dealing with messy syntax, like `0 15 10 * *`. Writing out exactly when a system needs to run is hard enough without needing an AI to calculate the next tick. This connector solves that math problem. It handles translating standard cron strings into human-readable sentences—and vice versa. If you need to ask your agent, 'When exactly will this job fire again?' and get a precise date back, not a guess, this is what you use. You can offload the difficult scheduling logic entirely. By connecting it via Vinkius, your AI client gets reliable access to a dedicated algorithm built purely for time math.

## Tools

### cron_to_text
Converts cryptic scheduling code into clear, readable natural language text.

### calculate_next_execution
Determines the exact future date and time when a given cron schedule will run next.

### text_to_cron
Translates plain English descriptions of schedules into mathematically valid cron syntax.

## Prompt Examples

**Prompt:** 
```
Translate '0 0 * * 1' so I can show it in my user dashboard.
```

**Response:** 
```
Using the translate_cron_to_text tool: The schedule means 'Every week on Monday at 00:00'.
```

**Prompt:** 
```
When exactly will the schedule '0 * * * *' run next from right now?
```

**Response:** 
```
Using the calculate_next_execution tool: The exact next tick will be at 2024-10-15T14:00:00.000Z.
```

## Capabilities

### Calculate Next Run Time
You ask it for a specific cron schedule and get the precise date and time of its next execution.

### Cron to English Text
It takes cryptic scheduling code and translates it into clear, everyday language.

### English Text to Cron
You describe the schedule in plain words (e.g., 'Every weekday at 5am'), and it returns valid cron syntax.

## Use Cases

### Debugging Misaligned Schedules
A developer is debugging why a nightly report didn't run on time. They feed the cron string into `calculate_next_execution`, which immediately tells them the schedule was set incorrectly, pointing to a missed date.

### Building User-Friendly Forms
A product manager needs users to input recurrence rules. Instead of writing complex instructions, they use `text_to_cron` to take 'Every two weeks on the 1st' and generate valid cron syntax for the backend.

### Documentation Generation
A technical writer needs to document a system job. They pass the raw schedule code through `cron_to_text` and get 'Every third Sunday of the month,' which they can copy directly into release notes.

### Validating Business Logic
A data scientist needs to confirm if a complex, multi-stage workflow will hit its next checkpoint on time. They use `calculate_next_execution` against the system's job schedule to get a guaranteed future timestamp.

## Benefits

- Stop guessing on dates. Use `calculate_next_execution` to get the exact next run time for any cron schedule, eliminating scheduling risk.
- Simplify communication. Send a raw cron string to `cron_to_text` and instantly generate clear language for user dashboards.
- Build better forms. Instead of asking users for code, use `text_to_cron` so they can just write 'every Monday at 9am' and get the correct syntax back.
- Save compute cycles. The engine uses pure JavaScript loops to handle time math, keeping the process fast and dependency-free.
- Improve reliability. You aren't trusting an LLM's internal calendar logic; you're calling a dedicated algorithm for absolute accuracy.

## How It Works

The bottom line is that you get reliable, mathematically verified scheduling data every time.

1. Pass the scheduling expression—either a raw cron string or a natural language description—to your AI client.
2. The MCP runs the request through its internal V8 JavaScript algorithm to perform the calculation or translation.
3. Your agent receives the deterministic output: either the next execution date or the correctly formatted syntax.

## Frequently Asked Questions

**How does calculate_next_execution work?**
It takes any valid cron schedule and returns the exact date and time of its next scheduled tick. It uses a dedicated algorithm to ensure the calculation is mathematically perfect, period.

**Can I use text_to_cron for custom schedules?**
Yes. You can describe nearly any recurring schedule in natural language (e.g., 'every other day starting today'), and `text_to_cron` will convert it into valid cron syntax.

**What is the difference between cron_to_text and text_to_cron?**
They are opposites. `cron_to_text` takes code to plain words, while `text_to_cron` takes plain words and generates the correct code.

**Does this MCP handle time zones?**
The engine provides precise temporal calculations necessary for scheduling. Always confirm your expected timezone offset when calling any of the three tools to ensure accuracy across environments.

**If I use text_to_cron with ambiguous natural language, how does it handle errors?**
It validates inputs mathematically before running. If your description is unclear or doesn't map to a valid cron structure, the MCP returns an explicit error detailing which part of the phrasing caused the failure.

**Can calculate_next_execution process non-standard or proprietary scheduling syntax?**
No. This MCP requires standard, established cron expressions to work correctly. It relies on a robust V8 JavaScript algorithm designed specifically for traditional 5-field cron notation.

**Does cron_to_text have any performance overhead or external dependencies?**
Absolutely not. The engine is built purely using native JavaScript temporal loops and has zero external dependencies, ensuring fast, reliable conversion without slowdowns.

**When I run cron_to_text, what specific details does the natural language output include?**
The resulting text provides a clear, readable sentence that translates the technical frequency and time. It converts numerical fields into plain English, avoiding jargon like 'day of week' or 'minute marker'.

**Why use an MCP for cron translation?**
Because AI models predict text probabilistically. They often invent invalid cron configurations or fail to understand exactly when a specific combination (like `* * 1 * *`) will trigger next. An algorithmic check provides certainty.

**Does it support the standard 5-part cron format?**
Yes. It perfectly parses the standard 5-part expression (Minute, Hour, Day of Month, Month, Day of Week) heavily used in Unix/Linux and SaaS orchestrators.