Skip to main content
Glama

marathon_countdown

Calculate the time remaining until a marathon event. Enter the marathon ID or slug to see the countdown.

Instructions

Get a countdown to a specific marathon event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesMarathon ID or slug, e.g. "tokyo", "boston", "kobe2026"

Implementation Reference

  • Tool handler for marathon_countdown: fetches marathon data from the API, calculates days/hours until race day, and returns formatted countdown text. Includes fallback logic to strip year from slug if initial fetch fails.
      async ({ id }) => {
        let data;
        try {
          data = await fetchJSON(`${BASE_URL}/api/marathons/${id}.json`);
        } catch {
          const slug = id.replace(/\d{4}$/, '');
          data = await fetchJSON(`${BASE_URL}/api/marathons/${slug}.json`);
        }
        const m = data.marathon;
        const raceDate = new Date(m.date);
        const now = new Date();
        const diff = raceDate - now;
    
        if (diff <= 0) {
          return { content: [{ type: 'text', text: `${m.name.en} has already taken place on ${m.date}.` }] };
        }
    
        const days = Math.floor(diff / (1000 * 60 * 60 * 24));
        const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    
        let text = `${m.name.en} Countdown\n\n`;
        text += `${days} days, ${hours} hours until race day\n`;
        text += `Date: ${m.date}\nCity: ${m.city}\n`;
        text += `\nLive countdown: ${m.links.countdown}`;
        return { content: [{ type: 'text', text }] };
      }
    );
  • Schema definition for marathon_countdown tool: expects a single string parameter 'id' which is a marathon ID or slug (e.g. 'tokyo', 'boston', 'kobe2026').
    { id: z.string().describe('Marathon ID or slug, e.g. "tokyo", "boston", "kobe2026"') },
  • index.js:324-354 (registration)
    Registration of 'marathon_countdown' tool on the MCP server using server.tool() with description 'Get a countdown to a specific marathon event'.
    server.tool(
      'marathon_countdown',
      'Get a countdown to a specific marathon event',
      { id: z.string().describe('Marathon ID or slug, e.g. "tokyo", "boston", "kobe2026"') },
      async ({ id }) => {
        let data;
        try {
          data = await fetchJSON(`${BASE_URL}/api/marathons/${id}.json`);
        } catch {
          const slug = id.replace(/\d{4}$/, '');
          data = await fetchJSON(`${BASE_URL}/api/marathons/${slug}.json`);
        }
        const m = data.marathon;
        const raceDate = new Date(m.date);
        const now = new Date();
        const diff = raceDate - now;
    
        if (diff <= 0) {
          return { content: [{ type: 'text', text: `${m.name.en} has already taken place on ${m.date}.` }] };
        }
    
        const days = Math.floor(diff / (1000 * 60 * 60 * 24));
        const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    
        let text = `${m.name.en} Countdown\n\n`;
        text += `${days} days, ${hours} hours until race day\n`;
        text += `Date: ${m.date}\nCity: ${m.city}\n`;
        text += `\nLive countdown: ${m.links.countdown}`;
        return { content: [{ type: 'text', text }] };
      }
    );
Behavior2/5

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

No annotations provided, so description must carry full burden. Only says 'Get a countdown', lacks details on behavior like whether it returns time until start, format, or error handling.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, concise and front-loaded. However, it is very brief and could benefit from a bit more detail to enhance usefulness.

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 is simple with one parameter and no output schema, the description is minimally adequate but doesn't explain the output format or behavior, which would be helpful for completeness.

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% with clear examples for the id parameter. The description adds no extra parameter info, baseline 3 applies.

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?

Clearly states it gets a countdown to a marathon event. Distinguishes from siblings like get_marathon (details) and predict_race (prediction).

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?

Does not provide any context on when to use this tool versus alternatives. No exclusions or conditions mentioned.

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/XWeaponX7/rundida-mcp'

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