get_match_detail
Retrieve detailed match data including score, status, timeline, and lineups by providing the sport and match slug from SportScore results.
Instructions
Get detailed data for a single match by its slug (e.g. 'manchester-united-vs-liverpool'): score, status, timeline, lineups. Slugs come from get_matches results or match URLs on sportscore.com.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sport | Yes | Sport to query. One of football, basketball, cricket, tennis. | |
| slug | Yes | Match slug, e.g. 'manchester-united-vs-liverpool'. |
Implementation Reference
- src/index.js:68-82 (registration)Tool registration definition in the TOOLS array: name 'get_match_detail', description, inputSchema (sport + slug), API path '/api/widget/match/', and paramMap that maps args to query params.
{ name: "get_match_detail", description: "Get detailed data for a single match by its slug (e.g. 'manchester-united-vs-liverpool'): score, status, timeline, lineups. Slugs come from get_matches results or match URLs on sportscore.com.", inputSchema: { type: "object", properties: { sport: sportSchema, slug: { type: "string", description: "Match slug, e.g. 'manchester-united-vs-liverpool'." }, }, required: ["sport", "slug"], }, path: "/api/widget/match/", paramMap: (args) => ({ sport: args.sport, slug: args.slug }), }, - src/index.js:46-50 (schema)The sportSchema enum validating the sport parameter (football, basketball, cricket, tennis) used by get_match_detail's input schema.
const sportSchema = { type: "string", enum: SPORTS, description: "Sport to query. One of football, basketball, cricket, tennis.", }; - src/index.js:228-270 (handler)Generic CallToolRequestSchema handler that dispatches all tools. When called with name 'get_match_detail', it resolves the tool definition from TOOL_BY_NAME, validates sport, calls paramMap to build query params, invokes callApi with the tool's path, and returns the JSON envelope.
server.setRequestHandler(CallToolRequestSchema, async (req) => { const { name, arguments: rawArgs } = req.params; const tool = TOOL_BY_NAME.get(name); if (!tool) { return { isError: true, content: [{ type: "text", text: `Unknown tool: ${name}` }], }; } const args = rawArgs ?? {}; if (args.sport && !SPORTS.includes(args.sport)) { return { isError: true, content: [ { type: "text", text: `Invalid sport '${args.sport}'. Must be one of: ${SPORTS.join(", ")}.` }, ], }; } const params = tool.paramMap(args); let result; try { result = await callApi(tool.path, params); } catch (err) { return { isError: true, content: [{ type: "text", text: `Network error calling SportScore API: ${err.message}` }], }; } const envelope = { tool: name, request_url: result.url, http_status: result.status, data: result.body, ...attributionFooter(), }; return { content: [{ type: "text", text: JSON.stringify(envelope, null, 2) }], isError: result.status >= 400, }; });