get_guide
Get detailed information about a running guide, including FAQs and related tools, by specifying the guide slug.
Instructions
Get detailed information about a specific running guide including FAQs and related tools
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | Guide slug, e.g. "first-marathon-training", "couch-to-5k-complete-guide" |
Implementation Reference
- index.js:373-390 (handler)The handler function for the 'get_guide' tool. It fetches guide data from the RunDida API using a slug parameter, then formats the response with title, description, URL, category, related tools, FAQs, and language links.
// Tool: get_guide server.tool( 'get_guide', 'Get detailed information about a specific running guide including FAQs and related tools', { slug: z.string().describe('Guide slug, e.g. "first-marathon-training", "couch-to-5k-complete-guide"') }, async ({ slug }) => { const data = await fetchJSON(`${BASE_URL}/api/guides/${slug}.json`); const g = data.guide; let text = `## ${g.title}\n\n${g.description}\n\nURL: ${g.url}\nCategory: ${g.category}\n`; if (g.relatedTools.length) text += `\nRelated tools: ${g.relatedTools.join(', ')}`; if (g.faqs && g.faqs.length) { text += '\n\n### FAQs\n'; g.faqs.forEach(f => { text += `\n**Q: ${f.question}**\nA: ${f.answer}\n`; }); } text += `\nAvailable in: EN (${g.links.page}), ZH (${g.links.pageZh}), JA (${g.links.pageJa})`; return { content: [{ type: 'text', text }] }; } ); - index.js:374-377 (registration)Registration of the 'get_guide' tool on the MCP server with its description and schema (slug parameter of type string).
server.tool( 'get_guide', 'Get detailed information about a specific running guide including FAQs and related tools', { slug: z.string().describe('Guide slug, e.g. "first-marathon-training", "couch-to-5k-complete-guide"') }, - index.js:376-377 (schema)Input schema for the 'get_guide' tool: a single 'slug' string parameter described as 'Guide slug, e.g. "first-marathon-training", "couch-to-5k-complete-guide"'.
'Get detailed information about a specific running guide including FAQs and related tools', { slug: z.string().describe('Guide slug, e.g. "first-marathon-training", "couch-to-5k-complete-guide"') }, - index.js:13-22 (helper)The fetchJSON helper function used by the handler to fetch guide data from the RunDida API with caching support.
async function fetchJSON(url) { const cached = cache.get(url); if (cached && Date.now() - cached.ts < CACHE_TTL) return cached.data; const res = await fetch(url); if (!res.ok) throw new Error(`HTTP ${res.status}: ${url}`); const data = await res.json(); cache.set(url, { data, ts: Date.now() }); return data; }