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'
      );
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4/5.0
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 of behavioral disclosure. It describes the default behavior (current month if no date) and the basic operation, but doesn't mention error handling, format validation for the date parameter, or what happens with invalid dates. It adds some context beyond the schema but lacks comprehensive behavioral traits.

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 appropriately sized with two clear, front-loaded sentences that directly state the tool's function and default behavior. There is zero waste or redundancy, and every sentence earns its place by providing essential information efficiently.

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?

Given the tool's low complexity (single optional parameter, simple calculation), no annotations, and no output schema, the description is reasonably complete. It covers the purpose, usage, and default behavior adequately, though it could benefit from mentioning error cases or output format to fully compensate for the lack of structured fields.

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 fully documents the single parameter 'date' with its format. The description adds marginal value by mentioning the default behavior (current month if no date provided), which implies the parameter is optional, but doesn't provide additional semantic details beyond what the schema specifies.

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 with specific verbs ('Get the 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. It explicitly defines the resource (days in a month) and scope (current month if no date provided).

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 for when to use this tool (to get days in a month, with current month as default) but doesn't explicitly mention when not to use it or name alternatives among siblings like 'convert_time' or 'get_timestamp'. It implies usage for date-based month calculations but lacks explicit exclusions or comparisons.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.