Skip to main content
Glama

get-current-date

Retrieve the current date in Shanghai timezone (UTC+8) formatted as yyyy-MM-dd. Provides accurate date input for parsing relative dates like 'tomorrow' or 'next Wednesday' in railway ticket queries.

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 toZonedTime and formats it as 'yyyy-MM-dd' using format from date-fns libraries. Includes error handling.
    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.' }],
        };
      }
    }
  • Input schema for 'get-current-date' tool: no parameters required (empty object).
    {},
  • src/index.ts:570-589 (registration)
    Registration of the 'get-current-date' tool using server.tool, including name, description, empty input schema, and inline handler function.
    server.tool(
      '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.' }],
          };
        }
      }
    );
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: timezone specificity (Asia/Shanghai), return format (yyyy-MM-dd), and the tool's role in date parsing workflows. It doesn't mention performance characteristics or error conditions, but covers the essential operational behavior.

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?

Two well-structured sentences with zero waste. The first sentence states what the tool does (purpose, timezone, format). The second sentence explains when to use it (usage context). Every element serves a clear purpose.

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 about timezone, format, and usage scenarios. It doesn't need to explain return values since the format is specified. The only minor gap is lack of explicit mention about what happens on errors or edge cases.

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, so the baseline is 4. The description appropriately doesn't discuss parameters since none exist, focusing instead on the tool's output and usage context.

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 (Asia/Shanghai, UTC+8) and return format (yyyy-MM-dd). It distinguishes itself from sibling tools by focusing on date retrieval rather than train/ticket/station operations.

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?

Explicitly states when to use this tool: '主要用于解析用户提到的相对日期(如“明天”、“下周三”),为其他需要日期的接口提供准确的日期输入' (mainly used to parse relative dates mentioned by users like 'tomorrow' or 'next Wednesday', providing accurate date input for other interfaces that need dates). This gives clear context about its intended use case.

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

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