Skip to main content
Glama

get_week_year

Retrieve the week and ISO week of the year for a specific date using this tool. Enhance time-sensitive applications by accurately determining week-based temporal data.

Instructions

Get the week and isoWeek of the year.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNoThe date to get the week and isoWeek of the year. e.g. 2025-03-23

Implementation Reference

  • Core handler function that computes the week and ISO week of the year for the given date or current date using dayjs.week() and dayjs.isoWeek().
    function getWeekOfYear(date?: string) {
      const week =  date ? dayjs(date).week() : dayjs().week();
      const isoWeek = date ? dayjs(date).isoWeek() : dayjs().isoWeek();
      return {
        week,
        isoWeek,
      };
  • Defines the tool's metadata: name, description, and input schema (optional date string).
    export const GET_WEEK_YEAR: Tool = {
      name: 'get_week_year',
      description: 'Get the week and isoWeek of the year.',
      inputSchema: {
        type: 'object',
        properties: {
          date: {
            type: 'string',
            description: 'The date to get the week and isoWeek of the year. e.g. 2025-03-23',
          },
        },
      },
    };
  • Tool call dispatcher case: validates arguments, calls getWeekOfYear, and formats the response.
    case 'get_week_year': {
      if (!checkWeekOfYearArgs(args)) {
        throw new Error(`Invalid arguments for tool: [${name}]`);
      }
      const { date } = args;
      const { week, isoWeek } = getWeekOfYear(date);
      return {
        success: true,
        content: [
          {
            type: 'text',
            text: `The week of the year is ${week}, and the isoWeek of the year is ${isoWeek}.`,
          },
        ],
      };
    }
  • src/index.ts:30-34 (registration)
    Registers the tool in the ListToolsRequestHandler by including it in the tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [CURRENT_TIME, RELATIVE_TIME, DAYS_IN_MONTH, GET_TIMESTAMP, CONVERT_TIME, GET_WEEK_YEAR],
      };
    });
  • Input validation helper for get_week_year tool arguments (checks if date is string or absent).
    function checkWeekOfYearArgs(args: unknown): args is { date: string } {
      return (
        typeof args === 'object' &&
        args !== null &&
        ('date' in args ? typeof args.date === 'string' : true)
      );
    }
Behavior2/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 of behavioral disclosure. It states the tool 'Get[s] the week and isoWeek of the year,' implying a read-only operation, but it doesn't disclose any behavioral traits such as error handling, format of return values, or performance considerations. For a tool with no annotation coverage, this is a significant gap in transparency.

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 extremely concise and front-loaded, consisting of a single sentence: 'Get the week and isoWeek of the year.' Every word earns its place, with no wasted information, making it easy for an agent to parse quickly and understand the core purpose without unnecessary detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (simple date calculation), the description is incomplete. There's no output schema, and the description doesn't explain return values (e.g., what 'week' and 'isoWeek' mean or their format). With no annotations and minimal behavioral context, the agent lacks sufficient information to fully understand how to use the tool effectively beyond basic input.

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 description adds no parameter semantics beyond what the input schema provides. The schema has 100% description coverage, with the 'date' parameter fully documented, so the baseline score is 3. The description doesn't compensate with additional context, such as examples or constraints, but it doesn't need to since the schema is comprehensive.

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

Purpose4/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 the week and isoWeek of the year.' It specifies the verb ('Get') and the resource ('week and isoWeek of the year'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'convert_time' or 'get_timestamp', which might also handle date-related operations.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any context, prerequisites, or exclusions, and it doesn't reference sibling tools like 'convert_time' or 'get_timestamp' that might serve similar or overlapping purposes. This leaves the agent without clear usage instructions.

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

Related 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/yokingma/time-mcp'

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