get_current_time
Retrieve the current time in a specified timezone for accurate timestamping in Algorand blockchain transactions and operations.
Instructions
Get the current time in a specified timezone
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| timezone | No | Timezone identifier (e.g., "UTC", "America/New_York") |
Input Schema (JSON Schema)
{
"properties": {
"timezone": {
"description": "Timezone identifier (e.g., \"UTC\", \"America/New_York\")",
"type": "string"
}
},
"required": [],
"type": "object"
}
Implementation Reference
- src/index.ts:459-496 (handler)Executes the get_current_time tool: parses input arguments, retrieves current time in specified timezone (default UTC), formats it, and returns as text response or error if invalid timezone.case 'get_current_time': { const parsed = GetTimeArgsSchema.parse(args); const timezone = parsed.timezone || 'UTC'; try { const now = new Date(); const timeString = now.toLocaleString('en-US', { timeZone: timezone, weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit', second: '2-digit', timeZoneName: 'short', }); return { content: [ { type: 'text', text: `Current time in ${timezone}: ${timeString}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error: Invalid timezone "${timezone}" - ${error}`, }, ], isError: true, }; } }
- src/index.ts:128-141 (registration)Registers the get_current_time tool in the TOOLS array with name, description, and inputSchema definition.{ name: 'get_current_time', description: 'Get the current time in a specified timezone', inputSchema: { type: 'object', properties: { timezone: { type: 'string', description: 'Timezone identifier (e.g., "UTC", "America/New_York")', }, }, required: [], }, },
- src/index.ts:29-31 (schema)Zod schema for validating input arguments of the get_current_time tool (optional timezone string).const GetTimeArgsSchema = z.object({ timezone: z.string().optional(), });