Skip to main content
Glama
DSado88

DateTime MCP Server

by DSado88

get_current_date

Retrieve the current date in ISO, US, EU, or custom formats to ensure time-sensitive content uses accurate date information.

Instructions

Get only the current date

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
formatNoOutput format: 'iso' (YYYY-MM-DD), 'us' (MM/DD/YYYY), 'eu' (DD/MM/YYYY), or custom formatiso

Implementation Reference

  • Handler for the 'get_current_date' tool. Extracts the current date from 'now' (a new Date()), formats it based on the 'format' parameter ('iso', 'us', 'eu', or custom via formatDate helper), and returns it as text content.
    case "get_current_date": {
      const format = request.params.arguments?.format || "iso";
      
      let result: string;
      
      if (format === "iso") {
        result = now.toISOString().split('T')[0];
      } else if (format === "us") {
        result = `${(now.getMonth() + 1).toString().padStart(2, '0')}/${now.getDate().toString().padStart(2, '0')}/${now.getFullYear()}`;
      } else if (format === "eu") {
        result = `${now.getDate().toString().padStart(2, '0')}/${(now.getMonth() + 1).toString().padStart(2, '0')}/${now.getFullYear()}`;
      } else {
        result = formatDate(now, format as string);
      }
      
      return {
        content: [{
          type: "text",
          text: result
        }]
      };
    }
  • src/index.ts:44-57 (registration)
    Tool registration in ListTools handler, defining name, description, and input schema for 'get_current_date'.
    {
      name: "get_current_date",
      description: "Get only the current date",
      inputSchema: {
        type: "object",
        properties: {
          format: {
            type: "string",
            description: "Output format: 'iso' (YYYY-MM-DD), 'us' (MM/DD/YYYY), 'eu' (DD/MM/YYYY), or custom format",
            default: "iso"
          }
        }
      }
    },
  • Input schema definition for the 'get_current_date' tool, specifying the optional 'format' parameter.
    inputSchema: {
      type: "object",
      properties: {
        format: {
          type: "string",
          description: "Output format: 'iso' (YYYY-MM-DD), 'us' (MM/DD/YYYY), 'eu' (DD/MM/YYYY), or custom format",
          default: "iso"
        }
      }
    }
  • Helper function 'formatDate' used by 'get_current_date' (and others) for custom date formatting with placeholders like YYYY, MM, etc.
    function formatDate(date: Date, format: string): string {
      const replacements: { [key: string]: string } = {
        'YYYY': date.getFullYear().toString(),
        'MM': (date.getMonth() + 1).toString().padStart(2, '0'),
        'DD': date.getDate().toString().padStart(2, '0'),
        'HH': date.getHours().toString().padStart(2, '0'),
        'mm': date.getMinutes().toString().padStart(2, '0'),
        'ss': date.getSeconds().toString().padStart(2, '0'),
      };
      
      let result = format;
      for (const [key, value] of Object.entries(replacements)) {
        result = result.replace(new RegExp(key, 'g'), value);
      }
      
      return result;
    }
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It states the tool's function but doesn't disclose behavioral traits like whether it's read-only, requires authentication, has rate limits, or what the return format looks like. The description is accurate but minimal.

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 a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, clearly stating the tool's purpose without unnecessary elaboration.

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 simplicity (1 optional parameter, no output schema, no annotations), the description is complete enough to understand its basic function. However, it lacks details on return values or behavioral context, which could be helpful for an agent.

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, with the 'format' parameter fully documented. The description doesn't add any parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without extra value.

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 'Get only the current date' clearly states the verb ('Get') and resource ('current date'), distinguishing it from sibling tools like get_current_datetime and get_current_time by specifying 'only the current date' rather than including time components.

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

Usage Guidelines4/5

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

The description implies usage context by specifying 'only the current date', suggesting this tool should be used when only the date is needed versus siblings that include time. However, it doesn't explicitly state when not to use it or name alternatives, leaving some ambiguity.

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/DSado88/datetime-mcp'

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