Skip to main content
Glama
asaficontact

Time MCP Server

by asaficontact

get_current_time

Retrieve the current time for any IANA timezone, enabling accurate time queries across global locations with automatic system timezone detection.

Instructions

Get current time in a specific timezones

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timezoneYesIANA timezone name (e.g., 'America/New_York', 'Europe/London'). Use 'Etc/UTC' as local timezone if no timezone provided by the user.

Implementation Reference

  • The core handler function implementing the get_current_time tool logic. It retrieves the current datetime in the specified timezone using zoneinfo.ZoneInfo, formats it, determines the day of the week and DST status, and returns a structured TimeResult object.
    def get_current_time(self, timezone_name: str) -> TimeResult:
        """Get current time in specified timezone"""
        timezone = get_zoneinfo(timezone_name)
        current_time = datetime.now(timezone)
    
        return TimeResult(
            timezone=timezone_name,
            datetime=current_time.isoformat(timespec="seconds"),
            day_of_week=current_time.strftime("%A"),
            is_dst=bool(current_time.dst()),
        )
  • Pydantic BaseModel defining the output schema for the get_current_time tool response, including timezone, ISO-formatted datetime, day of week, and DST status.
    class TimeResult(BaseModel):
        timezone: str
        datetime: str
        day_of_week: str
        is_dst: bool
  • Tool registration within the MCP server's list_tools() method, defining the tool name, description, and input schema requiring a 'timezone' parameter.
    Tool(
        name=TimeTools.GET_CURRENT_TIME.value,
        description="Get current time in a specific timezones",
        inputSchema={
            "type": "object",
            "properties": {
                "timezone": {
                    "type": "string",
                    "description": f"IANA timezone name (e.g., 'America/New_York', 'Europe/London'). Use '{local_tz}' as local timezone if no timezone provided by the user.",
                }
            },
            "required": ["timezone"],
        },
    ),
  • Dispatch logic in the MCP server's call_tool() method that handles invocation of get_current_time by extracting the timezone argument and calling the handler.
    match name:
        case TimeTools.GET_CURRENT_TIME.value:
            timezone = arguments.get("timezone")
            if not timezone:
                raise ValueError("Missing required argument: timezone")
    
            result = time_server.get_current_time(timezone)
  • Enum defining tool names as constants, used for registration and dispatching the get_current_time tool.
    class TimeTools(str, Enum):
        GET_CURRENT_TIME = "get_current_time"
        CONVERT_TIME = "convert_time"
Behavior3/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't mention error handling (e.g., invalid timezone), performance characteristics, or return format. The description doesn't contradict any annotations (none exist), but it provides minimal behavioral context beyond the basic operation.

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

Conciseness5/5

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

The description is a single, efficient sentence that states exactly what the tool does with zero wasted words. It's appropriately sized for a simple tool with one parameter and is perfectly front-loaded with the core functionality.

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 simple tool with 100% schema coverage and no output schema, the description provides the minimum viable information about what the tool does. However, it doesn't describe the return value format (e.g., ISO string, timestamp), error conditions, or how it differs from the sibling tool. The description is complete enough to understand the basic operation but lacks important contextual details.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema already fully documents the single 'timezone' parameter with its IANA format and default behavior. The description adds no additional parameter semantics beyond what's in the schema. Baseline score of 3 is appropriate when the schema does all the parameter documentation work.

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?

The description clearly states the verb ('Get') and resource ('current time') with the specific constraint 'in a specific timezone'. It distinguishes from the sibling 'convert_time' by focusing on current time retrieval rather than time conversion. However, it doesn't explicitly contrast with the sibling tool, which would be needed for a perfect score.

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

Usage Guidelines3/5

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

The description implies usage context ('in a specific timezone') but doesn't explicitly state when to use this tool versus the sibling 'convert_time'. No guidance on prerequisites, error conditions, or alternative approaches is provided. The usage is clear from the name and description but lacks explicit comparison with alternatives.

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/asaficontact/mcp-time'

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