Clocks, calendars and stateless models: fixing scheduling bugs

APIKeyClaudeFree · Updated 2026-11-22 · 9 min read

Clock and desk calendar next to a laptop
A model sees no clock unless your request includes one.

If you have built a scheduling assistant, a reminder bot or an MCP tool that books meetings, you have probably watched the model say "tomorrow" and pick the wrong day, or schedule a call at 9:00 in a time zone nobody asked for. This is not a bug in one model. It is a property of how all language models work: they predict text from their input, and nothing in that input tells them what time it is unless you put it there.

This article is for developers wiring models into calendars, task systems and agents. You will learn where the date confusion comes from, what context a model actually receives during a tool call, and a small set of patterns that make time handling boring and correct, whether you use a paid Claude key or a free model.

Frequently asked questions

Does a language model have access to a system clock?

No. A model only sees the tokens in its request. Some chat apps quietly insert the current date into a hidden system prompt, which is why chat feels date-aware, but a raw API call contains no time information unless your code adds it.

What is a training cutoff, and how does it differ from the current date?

The training cutoff is the point after which the model saw no new data. Without a date in the prompt, models tend to assume it is still around their cutoff, so relative phrases like "next Friday" get resolved against a stale calendar.

Why do MCP tool calls lack time context?

An MCP tool call is a JSON-RPC message with a tool name and arguments. It carries no ambient data such as the user's locale, clock or time zone. Whatever the model writes into the arguments is all the server receives.

Should the model or my code do date arithmetic?

Your code. Let the model extract intent, such as "two days after the launch", and let a date library compute the actual timestamp. Models are unreliable at counting days across month boundaries and daylight saving changes.

Is UTC enough, or do I need the user's time zone?

Store and transmit UTC, but you still need the user's IANA time zone, such as Europe/Berlin, to interpret phrases like "tomorrow morning" and to display results. UTC alone cannot tell you when someone's morning starts.

Does a stronger model fix date errors?

A stronger model makes fewer arithmetic slips, but it still cannot know the date by itself. Frontier models from Anthropic and others are better at reasoning about calendars; none of them can guess the time without being told.

How does the free-ai model handle dates?

Exactly like any other model: it has no clock. The keyless endpoint is stateless, so each request must include the current date and time zone if the task depends on them.

Where the date confusion really comes from

A language model is a function from input tokens to output tokens. It was trained on text up to some cutoff and then frozen. When you ask "what is the date next Tuesday?", the model has no internal calendar to consult. It produces the most plausible-looking answer, often anchored to dates that appeared frequently near the end of its training data.

Chat products hide this by injecting the date into a system message before your conversation. When developers move from the chat app to the API, that convenience disappears, and the same question suddenly gets a confident but wrong answer. That gap explains a lot of the surprise people report after their first agent prototype.

Relative phrases are the main trap

Absolute dates such as 2026-12-03 rarely cause trouble because the model only copies them. Relative phrases like "tomorrow", "end of the month" or "in two weeks" need an anchor. Without one, the model invents an anchor, and every later step inherits the error.

Time zones multiply the problem

Even with the right date, "9 am" is ambiguous. A user in Tokyo and a user in Chicago mean moments roughly half a day apart. If the request never states a zone, the model may default to UTC, to US Eastern time or to whatever appeared most in its training examples.

What an MCP tool call actually carries

Developers building MCP servers often discover that tools arrive with zero ambient context. The client sends a JSON-RPC tools/call message containing the tool name and the arguments the model wrote. There is no standard field for the user's clock, locale or calendar settings. If the model decided that "tomorrow" means a certain date, your server receives that date as a plain string and has no way to know it was guessed.

This is a design property, not an oversight. MCP servers are meant to be simple and reusable across clients, so they should not depend on hidden state. The fix is to make time explicit somewhere in the pipeline. For a deeper look at the message types, see what initialize, tools/list and tools/call do.

The server cannot ask the model what it meant

Once the call arrives, the reasoning is gone. Unless the arguments include the original phrase and the reference time, the server cannot detect that a date was resolved against the wrong anchor.

Clients differ in what they inject

Some desktop clients add the current date to their system prompt, others do not. A tool that works in one client and misfires in another is often seeing this difference, so do not rely on client behaviour you cannot control.

Envelope with a tag, symbolising a bare tool call
An MCP tool call arrives with arguments and nothing more.

Pattern one: put the clock in the prompt

The simplest fix is a single line at the start of the system message: the current time in ISO 8601 with offset, plus the user's IANA time zone. Generate it in code on every request. Never hard-code it into a template you edit by hand, because it will go stale the first time you forget.

Keep the format strict and unambiguous. Write 2026-11-22T14:05:00+01:00 (Europe/Berlin) rather than "Sunday afternoon". Models copy structured values well and interpret prose loosely.

Where the time zone comes from

In a web app, read it from the browser with Intl.DateTimeFormat().resolvedOptions().timeZone and send it with each request. In a bot, store it in the user profile. As a last resort, ask the user once and remember the answer in your own database, not in the model.

from datetime import datetime
from zoneinfo import ZoneInfo
from openai import OpenAI

client = OpenAI(base_url="https://api.apikeyclaudefree.com/v1", api_key="not-needed")

user_tz = "Europe/Berlin"
now = datetime.now(ZoneInfo(user_tz)).isoformat(timespec="minutes")

system = (
    f"Current local time: {now} ({user_tz}). "
    "Resolve relative dates against this time. "
    "Always answer with ISO 8601 timestamps including the offset."
)

resp = client.chat.completions.create(
    model="free-ai",
    messages=[
        {"role": "system", "content": system},
        {"role": "user", "content": "Remind me about the invoice the day after tomorrow at 10."},
    ],
)
print(resp.choices[0].message.content)

Pattern two: let code do the arithmetic

Putting the date in the prompt helps, but models still slip on calculations such as "the last business day of next month" or anything crossing a daylight saving switch. A sturdier design splits the job: the model extracts a structured intent, and deterministic code turns it into a timestamp.

In practice this means asking for JSON like {"anchor": "today", "offset_days": 2, "time": "10:00"} and computing the result with a date library. The model does what it is good at, understanding language, and your code does what it is good at, counting.

Keep the original phrase

Store the user's exact words alongside the computed timestamp. When something goes wrong, you can see whether the model misread the intent or your code miscalculated, which halves debugging time.

Validate before acting

Reject results in the past, results more than a year away, or times outside working hours when the task implies them. A cheap sanity check catches most bad resolutions before they reach a calendar.

Calculator and notebook on a desk
Let code count the days; let the model read the intent.

Pattern three: design tools that accept time zones

If you write the MCP server or function tool, make time zone a required argument instead of an implicit default. A tool schema with start_local and timezone fields forces the model to state both, and your server can convert to UTC with no guessing.

Also consider offering a tiny get_current_time tool that returns the server's clock and, if known, the user's zone. Agents can call it before planning. It costs one round trip and removes a whole class of errors.

Describe the arguments for small models

Smaller models follow tool descriptions literally. A description that says "timezone: IANA name such as America/Chicago, required" works far better than a bare field name, a point covered further in writing prompts small models follow.

  • Require IANA zone names, not abbreviations like CST that map to several zones.
  • Return timestamps with explicit offsets so the model can echo them back correctly.
  • Document in the tool description that relative dates must be resolved before calling.
  • Log the raw arguments so you can audit what the model sent.

Handling dates in long agent runs

Agents that run for many minutes or across several sessions have an extra issue: the time injected at the start becomes outdated. A task that started at 23:50 UTC may finish after midnight, and "today" silently changes meaning halfway through.

Refresh the timestamp on each model call rather than once per session. If your agent framework builds the system prompt once, add a short user-side note with the current time before each step. This is cheap, a dozen tokens, and keeps every decision anchored.

Freeze the reference when consistency matters

Sometimes you want the opposite: a report that says "this week" should use one fixed anchor for all its parts. In that case, compute the reference once, store it, and pass the same value to every step explicitly.

Watch for stored conversations

If you replay saved history to a stateless API, older messages may contain stale dates. Mark them with their own timestamps so the model does not confuse when something was said with when it is now.

Three wall clocks showing different times
Long agent runs need a fresh timestamp at each step.

Testing time handling before users do

Date bugs hide well because they appear only on certain days. Build a small set of test prompts and run them with a fake clock: the last day of a month, the night of a daylight saving change, a leap day and a New Year's Eve request from a zone far ahead of UTC.

Compare the model's structured output against expected values computed in code. Because the endpoint you test against may change over time, keep these cases in your repository and rerun them whenever you switch models or prompts.

  • "Tomorrow at 9" sent at 23:30 local time.
  • "Next Monday" sent on a Monday.
  • "In 30 days" crossing a month with 28 or 31 days.
  • "Same time next week" across a clock change.

Free model or paid Claude for scheduling agents?

For extraction tasks like turning a sentence into a structured intent, a mid-sized open model is often enough, especially when code does the arithmetic. The free-ai model behind this site's keyless endpoint, an independent open-weight model of roughly 35B parameters, works for prototypes of this kind. It is not Claude, and this site is not affiliated with Anthropic.

Where Claude and other frontier models clearly win is in messy, multi-constraint planning: juggling several calendars, conflicting preferences and long email threads. If that is your product, a paid key from Anthropic's console is the sound choice. Either way, avoid keys posted in public threads; they belong to someone else and get revoked. Whatever model you pick, the patterns above still apply, because no model knows the time on its own.

Remember the request limits

The free endpoint allows about one request per second per IP and two in parallel. An agent that calls a time tool before every step will feel this, so batch small lookups where you can.

Statelessness is a feature here

Because nothing is remembered between requests, you are forced to pass the clock each time, which is exactly the habit that prevents date bugs. See also how much context a task really needs.

Server rack beside an hourglass
Any model, free or paid, needs the time passed in.
Try the free API

Send a test prompt to the keyless free-ai endpoint from the chat box on the home page, no sign-up or key required.

Read also