Skip to main content
Glama
ampcome-mcps

Time MCP Server

by ampcome-mcps

days_in_month

Calculate the number of days in any month. Specify a date or use current month to get accurate day counts for planning and scheduling.

Instructions

Get the number of days in a month. If no date is provided, get the number of days in the current month.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoThe date to get the days in month. Format: YYYY-MM-DD

Implementation Reference

  • Handler for the 'days_in_month' tool within the CallToolRequestSchema request handler. Validates arguments, computes days using getDaysInMonth, and formats the response.
    case 'days_in_month': {
      if (!checkDaysInMonthArgs(args)) {
        throw new Error(`Invalid arguments for tool: [${name}]`);
      }
    
      const date = args.date;
      const result = getDaysInMonth(date);
      return {
        success: true,
        content: [
          {
            type: 'text',
            text: `The number of days in month is ${result}.`,
          },
        ],
      };
    }
  • Tool schema definition for 'days_in_month', including name, description, and input schema.
    export const DAYS_IN_MONTH: Tool = {
      name: 'days_in_month',
      description: 'Get the number of days in a month. If no date is provided, get the number of days in the current month.',
      inputSchema: {
        type: 'object',
        properties: {
          date: {
            type: 'string',
            description: 'The date to get the days in month. Format: YYYY-MM-DD',
          },
        },
      },
    };
  • src/index.ts:30-34 (registration)
    Registers the DAYS_IN_MONTH tool (among others) in the ListToolsRequestSchema handler for tool discovery.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [CURRENT_TIME, RELATIVE_TIME, DAYS_IN_MONTH, GET_TIMESTAMP, CONVERT_TIME, GET_WEEK_YEAR],
      };
    });
  • Helper function that calculates the number of days in a specified month (or current month) using dayjs.
    function getDaysInMonth(date?: string) {
      return date ? dayjs(date).daysInMonth() : dayjs().daysInMonth();
    }
  • Helper function to validate input arguments for the days_in_month tool.
    function checkDaysInMonthArgs(args: unknown): args is { date: string } {
      return (
        typeof args === 'object' &&
        args !== null &&
        'date' in args &&
        typeof args.date === 'string'
      );
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden. It explains the default behavior (current month when no date given) but doesn't disclose error handling, format validation, timezone considerations, or what the return value looks like (just a number or structured response).

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 clear, efficient sentences with zero waste. The first states the core purpose, the second explains the default behavior - perfectly front-loaded and appropriately sized for this simple tool.

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?

For a simple calculation tool with 1 parameter and 100% schema coverage, the description is adequate but has gaps. No output schema exists, so the description should ideally mention what gets returned (e.g., 'Returns an integer'). The behavioral context is minimal but sufficient for basic use.

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?

Schema description coverage is 100%, so the schema already documents the single parameter completely. The description adds marginal value by explaining the default behavior when no date is provided, but doesn't add meaning beyond what the schema provides about the parameter itself.

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 specific verb ('Get') and resource ('number of days in a month'), and distinguishes it from siblings by focusing on month-day calculation rather than time conversion, timestamp retrieval, or relative time operations.

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 provides clear context about when to use the tool ('If no date is provided, get the number of days in the current month'), but doesn't explicitly mention when not to use it or name alternatives among the sibling tools.

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/ampcome-mcps/time-mcp'

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