[Bug]: MCP tool output for task/template timestamps is tz-naive and violates the declared RFC3339 date-time schema
Bug type
Generation bug (slides/content incorrect)
Summary
MCP tools that return task status or template lists emit timestamps without a timezone
offset (e.g. 2026-09-25T14:02:03.123456) even though the OpenAPI schema declares them as
RFC 3339 date-time, so strict MCP clients reject the tool output.
Steps to reproduce
- Run Presenton via Docker (production compose), SQLite storage.
- Start any standard or smart presentation generation → note the async task id.
- Call the MCP tool that polls task status (
get_job_status), orGET /api/v1/ppt/async-task/{id}directly. - Inspect
created_at/updated_atin the response: the value has no timezone offset, e.g."2026-09-25T14:02:03.123456". - Run the same call through a strict MCP client that validates tool output against the
tool's JSON schema (
format: date-time) — validation fails.
Expected behavior
created_at / updated_at are returned as valid RFC 3339 date-time strings with a
timezone designator, e.g. "2026-09-25T14:02:03.123456+00:00", matching the
OpenAPI/JSON schema for AsyncTaskModel and TemplateListItem.
Actual behavior
The values are naive (no offset). SQLite does not preserve timezone info even though the
columns use DateTime(timezone=True), and neither AsyncTaskModel nor TemplateListItem
has a timestamp serializer, so Pydantic emits tz-naive ISO strings. This breaks MCP tools
whose schemas declare format: date-time (task polling is on the critical path of every
async generation job).
Presenton version
0.9.11-beta
Operating system
macOS (Docker Desktop)
How are you running Presenton?
Docker
LLM provider
Custom OpenAI-compatible API
Logs / screenshots
Response shows naive timestamps:
"created_at": "2026-09-25T14:02:03.123456" # no offset, violates format: date-time
Affected code on current main:
- servers/fastapi/models/sql/async_task.py
AsyncTaskModel.created_at / updated_at -> Column(DateTime(timezone=True), ...)
only a field_serializer for `status` exists; timestamps have no serializer.
- servers/fastapi/api/v1/ppt/endpoints/template.py
TemplateListItem.created_at / updated_at -> no timestamp serializer.
- servers/fastapi/mcp_server.py
FastMCP.from_openapi(...) over the static openai_spec.json, which declares these
fields as {"type":"string","format":"date-time"}; no output normalization.
Container log sample (with a local workaround serializer added on top of v0.9.11-beta):
pydantic_core._pydantic_core.PydanticSerializationError: Error serializing to JSON:
PydanticSerializationError: Error calling function `_serialize_timestamps`:
AttributeError: 'str' object has no attribute 'tzinfo'The traceback above comes from a local workaround serializer, not upstream code. Trim it if a strictly-upstream report is preferred; the naive-timestamp observation alone is sufficient to reproduce the schema violation.
Impact
- Affected: Anyone using the MCP server (and REST consumers relying on the OpenAPI schema)
- Severity: High
- Frequency: Always
- Consequence: MCP tools returning task/template timestamps fail schema validation in
strict clients; since standard/smart generation is async and polled via
get_job_status, this blocks the normal generation workflow over MCP.
Additional information
Suggested fix (option 1 recommended) — add a UTC-aware serializer to both models:
from datetime import timezone
from pydantic import field_serializer
@field_serializer("created_at", "updated_at")
def _serialize_timestamps(self, value: datetime | str) -> str:
if isinstance(value, str):
return value
if value.tzinfo is None:
value = value.replace(tzinfo=timezone.utc)
return value.isoformat()Apply to AsyncTaskModel and TemplateListItem. This fixes both the REST/OpenAPI mismatch
and the MCP output in one place.
Alternatives:
- Store/type timestamps as strings — loses schema semantics.
- Normalize only in
mcp_server.py— leaves the REST/OpenAPI mismatch in place.
Source: presenton/presenton