list_marathons
List all marathon events tracked by RunDida, including dates and locations.
Instructions
List all marathon events tracked by RunDida with dates and locations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- index.js:157-173 (handler)The async handler function that executes the list_marathons tool logic. It fetches marathon data from the API, sorts by date, formats the list with names, dates, cities, and tier indicators, and returns a formatted text response.
async () => { const data = await fetchJSON(`${BASE_URL}/api/marathons.json`); const list = data.active .sort((a, b) => a.date.localeCompare(b.date)) .map(m => { const tierLabel = m.tier === 1 ? ' ★' : ''; const idHint = m.slug || m.id; return `- ${m.name.en}${tierLabel} — ${m.date} — ${m.city} [${idHint}]`; }) .join('\n'); return { content: [{ type: 'text', text: `RunDida tracks ${data.meta.totalActive} upcoming marathons:\n\n${list}\n\nUse get_marathon with an ID or slug (e.g. "tokyo", "boston2026") for details.\n★ = World Major / Flagship race`, }], }; } - index.js:155-156 (schema)Empty schema object (no input parameters required) for the list_marathons tool.
'List all marathon events tracked by RunDida with dates and locations', {}, - index.js:152-174 (registration)Tool registration using server.tool() with name 'list_marathons' and description 'List all marathon events tracked by RunDida with dates and locations'.
// Tool: list_marathons server.tool( 'list_marathons', 'List all marathon events tracked by RunDida with dates and locations', {}, async () => { const data = await fetchJSON(`${BASE_URL}/api/marathons.json`); const list = data.active .sort((a, b) => a.date.localeCompare(b.date)) .map(m => { const tierLabel = m.tier === 1 ? ' ★' : ''; const idHint = m.slug || m.id; return `- ${m.name.en}${tierLabel} — ${m.date} — ${m.city} [${idHint}]`; }) .join('\n'); return { content: [{ type: 'text', text: `RunDida tracks ${data.meta.totalActive} upcoming marathons:\n\n${list}\n\nUse get_marathon with an ID or slug (e.g. "tokyo", "boston2026") for details.\n★ = World Major / Flagship race`, }], }; } );