Skip to main content
Glama

get_current_time

Retrieve the current time in various formats and timezones for accurate timestamping and scheduling needs.

Instructions

what time|current time|time now|get time - Get current time

Input Schema

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

Implementation Reference

  • The main execution handler for the get_current_time tool. Handles different time formats (iso, local, utc, timestamp, human) and optional timezone, returning formatted time in MCP ToolResult format.
    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()}` }]
      };
    }
  • ToolDefinition object defining the schema, name, description, input parameters (format enum and optional timezone), and annotations for the get_current_time tool.
    export const getCurrentTimeDefinition: ToolDefinition = {
      name: 'get_current_time',
      description: 'what time|current time|time now|get time - 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']
      }
    };
  • src/index.ts:606-607 (registration)
    Tool handler registration in the central executeToolCall switch dispatcher, mapping 'get_current_time' calls to the getCurrentTime function.
    case 'get_current_time':
      return await getCurrentTime(args as any) as CallToolResult;
  • src/index.ts:106-106 (registration)
    Registers the tool definition in the 'tools' array used for MCP listTools endpoint, enabling tool discovery.
    getCurrentTimeDefinition,
  • src/index.ts:25-25 (registration)
    Imports the handler function and tool definition from the implementation file.
    import { getCurrentTime, getCurrentTimeDefinition } from './tools/time/getCurrentTime.js';
Behavior3/5

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

Annotations only provide a title ('Get Current Time'), with no hints on read-only or destructive behavior. The description adds minimal behavioral context by implying it retrieves real-time data, but doesn't disclose rate limits, authentication needs, or output format. With low annotation coverage, the description carries more burden but offers only basic operational insight.

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, using a single phrase with synonyms to convey the core function without unnecessary details. Every word earns its place, making it efficient and easy to parse, though this conciseness comes at the cost of depth in other dimensions.

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 (simple time retrieval), no output schema, and rich schema coverage, the description is minimally adequate. It covers the basic purpose but lacks details on return values, error handling, or integration context. With annotations sparse, it should do more to compensate, but the simplicity of the tool keeps it from being severely incomplete.

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 input schema has 100% description coverage, documenting both parameters (format with enum, timezone). The description adds no parameter-specific information beyond what the schema provides, such as default behaviors or examples. Since schema coverage is high, the baseline score of 3 is appropriate, as the description doesn't compensate with additional semantics.

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 specific verbs ('get current time') and synonyms ('what time', 'time now'), making it unambiguous. However, it doesn't differentiate from siblings since there are no other time-related tools in the sibling list, so it doesn't need to distinguish from alternatives.

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. It lists synonyms but doesn't mention context, prerequisites, or exclusions. Given the sibling tools are unrelated (e.g., analyze_complexity, save_memory), there's no explicit comparison, leaving usage unclear beyond the basic purpose.

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/ssdeanx/ssd-ai'

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