Skip to main content
Glama
wuunicorn

紫微斗数 MCP 服务器 (MCPIztro)

by wuunicorn

get_current_time

Retrieve current system time details for accurate Chinese Ziwei Doushu astrology chart calculations and horoscope analysis.

Instructions

获取当前系统时间,返回详细的时间信息

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The getCurrentTime function implements the core logic for the 'get_current_time' tool, retrieving the current date and time, formatting it into a structured object including year, month, day, hour, minute, second, datetime string, weekday in English and Chinese, and Unix timestamp.
    function getCurrentTime() { try { const now = new Date(); const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']; const result = { year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate(), hour: now.getHours(), minute: now.getMinutes(), second: now.getSeconds(), datetime_str: now.toISOString().slice(0, 19).replace('T', ' '), weekday: now.toLocaleDateString('en-US', { weekday: 'long' }), weekday_cn: weekdays[now.getDay()], timestamp: Math.floor(now.getTime() / 1000) }; return { success: true, data: result }; } catch (error) { return { success: false, error: error.message }; } }
  • The input schema for the 'get_current_time' tool, defining it as an object with no properties or required fields.
    name: "get_current_time", description: "获取当前系统时间,返回详细的时间信息", inputSchema: { type: "object", properties: {}, required: [] } },
  • The registration and dispatch handler in the tools/call switch case that invokes getCurrentTime() and formats the MCP response.
    case 'get_current_time': try { const result = getCurrentTime(); response = { jsonrpc: "2.0", id: request.id, result: { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], isError: false } }; } catch (error) { response = { jsonrpc: "2.0", id: request.id, result: { content: [{ type: "text", text: `获取时间错误: ${error.message}` }], isError: true } }; } break;
  • Tool registration in the tools/list response, listing the 'get_current_time' tool with its name, description, and schema.
    name: "get_current_time", description: "获取当前系统时间,返回详细的时间信息", inputSchema: { type: "object", properties: {}, required: [] } },

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/wuunicorn/MCPIztro'

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