get_standings
Retrieve the current standings table for any league or competition using a sport and slug, such as premier-league or nba.
Instructions
Get the current standings table for a league or competition by slug (e.g. 'premier-league', 'la-liga', 'nba').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sport | Yes | Sport to query. One of football, basketball, cricket, tennis. | |
| slug | Yes | Competition slug. |
Implementation Reference
- src/index.js:99-113 (schema)Input schema definition for get_standings tool: defines the sport (enum of football, basketball, cricket, tennis) and slug (competition slug like 'premier-league') parameters.
{ name: "get_standings", description: "Get the current standings table for a league or competition by slug (e.g. 'premier-league', 'la-liga', 'nba').", inputSchema: { type: "object", properties: { sport: sportSchema, slug: { type: "string", description: "Competition slug." }, }, required: ["sport", "slug"], }, path: "/api/widget/standings/", paramMap: (args) => ({ sport: args.sport, slug: args.slug }), }, - src/index.js:100-100 (registration)Tool name registration in TOOLS array with name 'get_standings', mapping to path '/api/widget/standings/' and paramMap function.
name: "get_standings", - src/index.js:228-270 (handler)Generic CallToolRequestSchema handler that routes all tool calls (including get_standings) by looking up the tool config from TOOL_BY_NAME, calling the API via callApi() with tool.path and tool.paramMap(args), and returning the response.
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, }; });