Skip to main content
Glama

get-current-date

Retrieve the current date in Shanghai timezone (UTC+8) formatted as yyyy-MM-dd for accurate relative date parsing in ticket searches.

Instructions

获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 "yyyy-MM-dd"。主要用于解析用户提到的相对日期(如“明天”、“下周三”),提供准确的日期输入。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get-current-date' tool. It retrieves the current date in the Asia/Shanghai timezone using date-fns-tz.toZonedTime and date-fns.format, and returns it formatted as 'yyyy-MM-dd' in the MCP response format.
            try {
                const timeZone = 'Asia/Shanghai';
                const nowInShanghai = toZonedTime(new Date(), timeZone);
                const formattedDate = format(nowInShanghai, 'yyyy-MM-dd');
                return {
                    content: [{ type: 'text', text: formattedDate }],
                };
            } catch (error) {
                console.error('Error getting current date:', error);
                return {
                    content: [
                        {
                            type: 'text',
                            text: 'Error: Failed to get current date.',
                        },
                    ],
                };
            }
        }
    );
  • src/index.ts:816-840 (registration)
    Registration of the 'get-current-date' tool on the McpServer instance, including name, description, empty input schema ({}), and the handler function.
        'get-current-date',
        '获取当前日期,以上海时区(Asia/Shanghai, UTC+8)为准,返回格式为 "yyyy-MM-dd"。主要用于解析用户提到的相对日期(如“明天”、“下周三”),提供准确的日期输入。',
        {},
        async () => {
            try {
                const timeZone = 'Asia/Shanghai';
                const nowInShanghai = toZonedTime(new Date(), timeZone);
                const formattedDate = format(nowInShanghai, 'yyyy-MM-dd');
                return {
                    content: [{ type: 'text', text: formattedDate }],
                };
            } catch (error) {
                console.error('Error getting current date:', error);
                return {
                    content: [
                        {
                            type: 'text',
                            text: 'Error: Failed to get current date.',
                        },
                    ],
                };
            }
        }
    );
  • Empty input schema for the 'get-current-date' tool, indicating no parameters are required.
    async () => {
Behavior4/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes key behavioral traits: it returns the current date (not time), uses Shanghai timezone (Asia/Shanghai, UTC+8), and returns in 'yyyy-MM-dd' format. It doesn't mention error conditions or performance characteristics, but for a simple date retrieval tool, this is reasonably complete.

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 perfectly concise and well-structured: one sentence states the core functionality with timezone and format details, a second sentence explains the primary use case. Every sentence earns its place with no wasted words.

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 0-parameter tool with no output schema, the description provides excellent context: purpose, timezone, format, and use case. It doesn't need to explain return values since the format is specified. The only minor gap is lack of explicit mention that this is a read-only operation, but that's implied by '获取' (get).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage. The description appropriately doesn't waste space discussing non-existent parameters. Baseline for 0 parameters is 4, and the description correctly focuses on what the tool does rather than parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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 date) with specific details about timezone (Shanghai/Asia/Shanghai, UTC+8) and return format ('yyyy-MM-dd'). It distinguishes itself from sibling tools (which are all about train/station data) by focusing solely on date retrieval.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool: '主要用于解析用户提到的相对日期(如“明天”、“下周三”),提供准确的日期输入' (mainly used to parse user-mentioned relative dates like 'tomorrow' or 'next Wednesday' to provide accurate date input). This gives clear context about its intended application versus alternatives.

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/Joooook/12306-mcp'

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