Skip to main content
Glama
onion-ai

onion-mcp-server

Official
by onion-ai

sys_time

Retrieve current date and time for any specified timezone, with customizable format for output.

Instructions

获取当前日期和时间,支持指定时区。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timezoneNo时区名称,如 Asia/Shanghai、UTC、America/New_York(默认 UTC)UTC
formatNo时间格式字符串(默认 %Y-%m-%d %H:%M:%S)%Y-%m-%d %H:%M:%S

Implementation Reference

  • The _sys_time function is the core handler for the sys_time tool. It takes a timezone name (default UTC) and format string (default %Y-%m-%d %H:%M:%S), retrieves the current time using ZoneInfo, and returns formatted output including the time, UTC offset, Unix timestamp, and ISO 8601 representation.
    def _sys_time(args: dict) -> list[types.TextContent]:
        tz_name = args.get("timezone", "UTC")
        fmt     = args.get("format", "%Y-%m-%d %H:%M:%S")
    
        try:
            tz = ZoneInfo(tz_name)
        except ZoneInfoNotFoundError:
            return [types.TextContent(
                type="text",
                text=f"❌ 未知时区: {tz_name}\n示例: Asia/Shanghai, UTC, America/New_York",
            )]
    
        now = datetime.now(tz)
        return [types.TextContent(type="text", text=(
            f"🕐 当前时间\n\n"
            f"时区:     {tz_name}\n"
            f"时间:     {now.strftime(fmt)}\n"
            f"UTC偏移:  {now.strftime('%z')}\n"
            f"Unix时间: {int(now.timestamp())}\n"
            f"ISO 8601: {now.isoformat()}"
        ))]
  • The inputSchema for sys_time defines two optional parameters: 'timezone' (string, default UTC) and 'format' (string, default %Y-%m-%d %H:%M:%S). This schema is registered as part of the SYSTEM_TOOLS list.
    description="获取当前日期和时间,支持指定时区。",
    inputSchema={
        "type": "object",
        "properties": {
            "timezone": {
                "type":        "string",
                "description": "时区名称,如 Asia/Shanghai、UTC、America/New_York(默认 UTC)",
                "default":     "UTC",
            },
            "format": {
                "type":        "string",
                "description": "时间格式字符串(默认 %Y-%m-%d %H:%M:%S)",
                "default":     "%Y-%m-%d %H:%M:%S",
            },
        },
    },
  • The sys_time tool name is mapped to the handle_system dispatch function in the server's routing table. The registration iterates over SYSTEM_TOOLS and assigns handle_system as the handler for each tool name (including sys_time).
    for _t in SYSTEM_TOOLS: 
        _HANDLERS[_t.name] = handle_system
  • The handle_system dispatch function routes the 'sys_time' name to the _sys_time handler via a dictionary lookup. This is the intermediate routing layer between the server and the tool implementation.
    async def handle_system(name: str, arguments: dict) -> list[types.TextContent]:
        handlers = {
            "sys_time":       _sys_time,
            "sys_uuid":       _sys_uuid,
            "sys_hash":       _sys_hash,
            "sys_base64":     _sys_base64,
            "sys_url_encode": _sys_url_encode,
            "sys_json_valid": _sys_json_valid,
        }
        fn = handlers.get(name)
        if fn is None:
            raise ValueError(f"未知 system 工具: {name}")
        return fn(arguments)
Behavior3/5

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

No annotations are provided, so the description must carry the burden. It describes a simple read operation without mentioning potential traits like time source, accuracy, or errors. It is minimal but not misleading.

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?

The description is a single concise sentence. It could be improved by adding the default format explicitly, but it is not overly verbose.

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

Completeness2/5

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

Given the simplicity of the tool (2 optional params, no output schema), the description fails to mention the return value format. An agent needs to infer that it returns a formatted datetime string, which is not stated.

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 documents both parameters. The description adds no new meaning beyond 'supports specifying timezone.' Baseline score of 3 is appropriate.

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

Purpose5/5

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

The description clearly states the tool retrieves the current date and time, with support for timezone specification. It is specific and distinct from sibling tools like sys_uuid or sys_hash.

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 for current time queries but does not explicitly state when to use or not use this tool. No alternatives are mentioned, though none directly compete. It is adequate but lacks explicit guidance.

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/onion-ai/mcp-server'

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