Skip to main content
Glama
jaejin0me

TypeScript MCP Server Boilerplate

by jaejin0me

time

Retrieve current date and time information with optional timezone and format settings for accurate timekeeping and scheduling applications.

Instructions

Get current date and time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoTime format (optional, defaults to full)
timezoneNoTimezone (optional, defaults to Asia/Seoul)

Implementation Reference

  • The handler function for the 'time' tool. It destructures timezone and format from args, uses Date and Intl APIs to format current time in Korean locale, supports formats 'full' (default), 'date', 'time', 'iso', includes timezone display, error handling, and returns MCP content.
    }, async (args) => {
        const { timezone = 'Asia/Seoul', format = 'full' } = args
        
        try {
            const now = new Date()
            
            let timeString: string
            
            switch (format) {
                case 'date':
                    timeString = now.toLocaleDateString('ko-KR', { 
                        timeZone: timezone,
                        year: 'numeric',
                        month: 'long',
                        day: 'numeric',
                        weekday: 'long'
                    })
                    break
                case 'time':
                    timeString = now.toLocaleTimeString('ko-KR', { 
                        timeZone: timezone,
                        hour12: false,
                        hour: '2-digit',
                        minute: '2-digit',
                        second: '2-digit'
                    })
                    break
                case 'iso':
                    timeString = now.toISOString()
                    break
                case 'full':
                default:
                    const dateStr = now.toLocaleDateString('ko-KR', { 
                        timeZone: timezone,
                        year: 'numeric',
                        month: 'long',
                        day: 'numeric',
                        weekday: 'long'
                    })
                    const timeStr = now.toLocaleTimeString('ko-KR', { 
                        timeZone: timezone,
                        hour12: false,
                        hour: '2-digit',
                        minute: '2-digit',
                        second: '2-digit'
                    })
                    timeString = `${dateStr} ${timeStr} (${timezone})`
                    break
            }
            
            return {
                content: [{ type: 'text', text: `현재 시간: ${timeString}` }]
            }
        } catch (error) {
            return {
                content: [{ 
                    type: 'text', 
                    text: `시간 조회 오류: ${error instanceof Error ? error.message : '알 수 없는 오류'}` 
                }]
            }
        }
    })
  • Zod input schema defining optional 'timezone' (string) and 'format' (enum: full/date/time/iso) parameters for the 'time' tool.
    timezone: z.string().optional().describe('Timezone (optional, defaults to Asia/Seoul)'),
    format: z.enum(['full', 'date', 'time', 'iso']).optional().describe('Time format (optional, defaults to full)')
  • src/index.ts:90-90 (registration)
    Registration of the 'time' tool via server.tool() with description 'Get current date and time'.
    server.tool('time', 'Get current date and time', {
  • src/index.ts:249-249 (registration)
    The 'time' tool is listed in the server capabilities within the server-info resource.
    tools: ['greeting', 'calculator', 'time'],
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states what the tool does but lacks details on traits like rate limits, error handling, or default behaviors beyond what's implied. For example, it doesn't specify if the tool returns a string or structured data, or if there are any constraints on timezone inputs.

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 extremely concise and front-loaded with a single, clear sentence that states the tool's purpose without any wasted words. It efficiently communicates the core functionality, making it easy to understand at a glance.

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?

Given the tool's low complexity (2 optional parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on output format or behavioral traits, which could be helpful for an agent. However, the simplicity of the tool means these gaps are less critical.

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?

The schema description coverage is 100%, with clear documentation for both parameters in the input schema. The description adds no additional meaning beyond the schema, such as explaining the implications of different formats or timezone choices. Since the schema does the heavy lifting, the baseline score of 3 is appropriate.

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 tool's purpose with a specific verb ('Get') and resource ('current date and time'), making it immediately understandable. However, it doesn't differentiate from sibling tools like 'calculator' or 'greeting', which is unnecessary here since the functionality is distinct by nature.

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?

The description provides no guidance on when to use this tool versus alternatives. While the tool's purpose is straightforward, it doesn't mention any context or prerequisites for usage, such as when timezone adjustments might be needed or if there are limitations.

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/jaejin0me/mcpServer_test'

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