Skip to main content
Glama
IBM

chuk-mcp-time

by IBM

get_local_time

Retrieve precise local time for any IANA timezone using NTP consensus. Compensates for latency to ensure accuracy.

Instructions

Get current time for a specific IANA timezone with high accuracy.

Uses NTP consensus for accurate UTC time, then converts to the requested
timezone using IANA tzdata. This provides authoritative local time independent
of system clock accuracy.

Args:
    timezone: IANA timezone identifier (e.g., "America/New_York", "Europe/London")
    mode: Accuracy mode - "fast" or "accurate"
    compensate_latency: If True, add query duration to timestamp (default: True)

Returns:
    LocalTimeResponse with local time and timezone metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timezoneYes
modeNofast
compensate_latencyNo

Implementation Reference

  • Main handler function for get_local_time tool. Uses NTP consensus for accurate UTC time, then converts to the requested IANA timezone using zoneinfo.
    @tool  # type: ignore[arg-type]
    async def get_local_time(
        timezone: str,
        mode: AccuracyMode = AccuracyMode.FAST,
        compensate_latency: bool = True,
    ) -> LocalTimeResponse:
        """Get current time for a specific IANA timezone with high accuracy.
    
        Uses NTP consensus for accurate UTC time, then converts to the requested
        timezone using IANA tzdata. This provides authoritative local time independent
        of system clock accuracy.
    
        Args:
            timezone: IANA timezone identifier (e.g., "America/New_York", "Europe/London")
            mode: Accuracy mode - "fast" or "accurate"
            compensate_latency: If True, add query duration to timestamp (default: True)
    
        Returns:
            LocalTimeResponse with local time and timezone metadata
        """
        # Get accurate UTC time
        time_response = await get_time_utc(mode=mode, compensate_latency=compensate_latency)  # type: ignore[misc]
    
        # Convert to local timezone
        utc_timestamp = time_response.epoch_ms / 1000.0
        utc_dt = datetime.fromtimestamp(utc_timestamp, tz=UTC)
    
        # Get timezone info
        tz_info = get_timezone_info_at_datetime(timezone, utc_dt)
    
        # Apply timezone
        from zoneinfo import ZoneInfo
    
        local_dt = utc_dt.astimezone(ZoneInfo(timezone))
    
        return LocalTimeResponse(
            local_datetime=local_dt.isoformat(),
            timezone=timezone,
            utc_offset_seconds=tz_info.utc_offset_seconds,
            is_dst=tz_info.is_dst,
            abbreviation=tz_info.abbreviation,
            source_utc=time_response.iso8601_time,
            tzdata_version=get_tzdata_version(),
            estimated_error_ms=time_response.estimated_error_ms,
        )
  • LocalTimeResponse Pydantic model - the response schema for get_local_time tool.
    class LocalTimeResponse(BaseModel):
        """Response for get_local_time tool."""
    
        local_datetime: str = Field(description="Local time in ISO 8601 format with timezone")
        timezone: str = Field(description="IANA timezone identifier")
        utc_offset_seconds: int = Field(description="UTC offset in seconds")
        is_dst: bool = Field(description="Whether daylight saving time is active")
        abbreviation: str = Field(description="Timezone abbreviation (e.g., EST, BST)")
        source_utc: str = Field(description="Source UTC time from consensus")
        tzdata_version: str = Field(description="IANA tzdata version")
        estimated_error_ms: float = Field(description="Estimated error from UTC consensus")
  • Registration of get_local_time in the public API (exported from __init__.py).
    from chuk_mcp_time.server import (
        compare_system_clock,
        convert_time,
        get_local_time,
        get_time_for_timezone,
        get_time_utc,
        get_timezone_info,
        list_timezones,
        main,
    )
    
    __all__ = [
        "get_time_utc",
        "get_time_for_timezone",
        "get_local_time",
        "compare_system_clock",
        "convert_time",
        "list_timezones",
        "get_timezone_info",
        "main",
        "__version__",
    ]
  • Registration of get_local_time in __all__ list.
    __all__ = [
        "get_time_utc",
        "get_time_for_timezone",
        "get_local_time",
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description provides good behavioral context: it mentions using NTP consensus for accuracy, conversion from UTC, and parameter effects. However, it does not explicitly state that the operation is read-only or non-destructive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with sections for description, parameter args, and returns. The information is front-loaded but the description is slightly verbose; each sentence is earned though.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 parameters and no output schema, the description covers usage but misses contextual cues like limitations (e.g., NTP dependency, internet requirement) or comparison with sibling tools. It mentions return type but no structure.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% parameter description coverage, but the description explains each parameter: timezone format, mode options (fast/accurate), and compensate_latency effect. However, 'mode' lacks details on what 'fast' versus 'accurate' entails.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states the tool gets current time for a specific IANA timezone with high accuracy. However, it does not distinguish from sibling tool 'get_time_for_timezone', which likely has a similar purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like 'get_time_for_timezone', 'get_time_utc', or 'convert_time'. The description implies use for high-accuracy local time but does not explicitly state when other tools might be preferred.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/IBM/chuk-mcp-time'

If you have feedback or need assistance with the MCP directory API, please join our Discord server