Skip to main content
Glama

get_current_time

Read-only

Retrieve the current time in various formats and timezones to check or display accurate time information.

Instructions

지금 몇시|현재 시간|몇시야|what time|current time|time now - Get current time

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoTime format
timezoneNoTimezone (e.g., America/New_York, Asia/Seoul)

Implementation Reference

  • The handler function that implements the core logic of the 'get_current_time' tool, handling different time formats and timezones.
    export async function getCurrentTime(args: { format?: string; timezone?: string }): Promise<ToolResult> {
      const { format = 'iso', timezone } = args;
      const now = new Date();
      
      let timeResult: string;
      
      switch (format) {
        case 'iso':
          timeResult = now.toISOString();
          break;
        case 'local':
          timeResult = now.toLocaleString();
          break;
        case 'utc':
          timeResult = now.toUTCString();
          break;
        case 'timestamp':
          timeResult = Math.floor(now.getTime() / 1000).toString();
          break;
        case 'human':
          const options: Intl.DateTimeFormatOptions = {
            year: 'numeric',
            month: 'long',
            day: 'numeric',
            hour: '2-digit',
            minute: '2-digit',
            second: '2-digit',
            timeZone: timezone
          };
          timeResult = now.toLocaleString('en-US', options);
          break;
        default:
          timeResult = now.toISOString();
      }
      
      const currentTimeResult = {
        action: 'get_current_time',
        format,
        timezone: timezone || 'local',
        result: timeResult,
        timestamp: now.getTime(),
        status: 'success'
      };
      
      return {
        content: [{ type: 'text', text: `Time: ${timeResult}\nFormat: ${format}\nTimezone: ${timezone || 'local'}\nTimestamp: ${now.getTime()}` }]
      };
    }
  • The ToolDefinition object defining the schema, description, input parameters, and annotations for the 'get_current_time' tool.
    export const getCurrentTimeDefinition: ToolDefinition = {
      name: 'get_current_time',
      description: '지금 몇시|현재 시간|몇시야|what time|current time|time now - Get current time',
      inputSchema: {
        type: 'object',
        properties: {
          format: { type: 'string', description: 'Time format', enum: ['iso', 'local', 'utc', 'timestamp', 'human'] },
          timezone: { type: 'string', description: 'Timezone (e.g., America/New_York, Asia/Seoul)' }
        },
        required: []
      },
      annotations: {
        title: 'Get Current Time',
        audience: ['user', 'assistant'],
        readOnlyHint: true,
        destructiveHint: false,
        idempotentHint: false,
        openWorldHint: false
      }
    };
  • src/index.ts:90-90 (registration)
    Registration of the tool definition in the 'tools' array provided to the MCP server.
    getCurrentTimeDefinition,
  • src/index.ts:157-157 (registration)
    Registration of the handler function in the 'toolHandlers' dispatch map for dynamic tool execution.
    'get_current_time': getCurrentTime,
  • src/index.ts:28-28 (registration)
    Import statement bringing in the tool definition and handler implementation.
    import { getCurrentTimeDefinition, getCurrentTime } from './tools/time/getCurrentTime.js';
Behavior3/5

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

Annotations already provide readOnlyHint=true and destructiveHint=false, establishing this as a safe read operation. The description adds no behavioral context beyond what annotations provide - no information about rate limits, authentication needs, or specific behavioral traits. However, it doesn't contradict annotations either.

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 the core functionality. The natural language variations are efficiently packed, and every element serves a clear purpose for query matching without unnecessary elaboration.

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

Completeness4/5

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

For a simple time retrieval tool with good annotations and full parameter documentation, the description is reasonably complete. It states the core purpose clearly. The main gap is lack of output format information since there's no output schema, but for this simple tool, the description is adequate.

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?

With 100% schema description coverage, the schema fully documents both parameters (format with enum values and timezone). The description adds no parameter semantics beyond what's in the schema, meeting the baseline 3 for high schema coverage.

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 ('Get current time') and includes multiple natural language variations for query matching. However, it doesn't differentiate from siblings since there are no time-related sibling tools, so it can't earn the full 5 points for sibling differentiation.

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 there are no obvious time-related sibling tools, there's no explicit context about when this tool is appropriate versus other approaches for obtaining time information.

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/su-record/hi-ai'

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