{"id":"score-state","title":"Score state for tennis, golf handicap differentials and cricket overs","description":"Replays a tennis point sequence (ITF Rules of Tennis: games, deuce, tie-breaks, match tie-break, who serves), computes a golf Score Differential and Handicap Index (World Handicap System), or tallies a cricket innings ball by ball (overs.balls, wides and no-balls, maidens, wickets), for agents that must verify a reported score. Optionally checks a claimed score against the replay and names the first illegal point or ball. Does NOT apply the WHS soft/hard cap, exceptional-score reductions or 9-hole expected scores, tennis variants beyond No-Ad and the final-set options, or cricket penalty runs; those return unknown or unsupported.","roi":"Catches a mistold score or an impossible point sequence for one $0.005 call.","audience":"business","package":"creative-games-kit","channels":["x402","mcp"],"endpoint":{"method":"POST","url":"https://agents.writerslogic.com/api/v1/score-state","path":"/api/v1/score-state","contentType":"application/json"},"price":{"amount":"0.005","currency":"USDC","network":"base","perCall":true,"failedCallsCharged":false},"inputSchema":{"type":"object","additionalProperties":false,"required":["sport"],"properties":{"sport":{"type":"string","enum":["tennis","golf","cricket"],"description":"Selects which block below is read."},"tennis":{"type":"object","additionalProperties":false,"required":["points"],"description":"For sport=tennis.","properties":{"bestOf":{"type":"integer","enum":[3,5],"description":"Default 3."},"finalSet":{"type":"string","enum":["tiebreak","advantage","super-tiebreak-10"],"description":"tiebreak (default): 7-point tie-break at 6-6 in every set. advantage: no tie-break in the final set. super-tiebreak-10: a 10-point tie-break replaces the final set (Appendix VI)."},"noAd":{"type":"boolean","description":"Appendix VI No-Ad: a deciding point at deuce. Default false."},"firstServer":{"type":"string","enum":["a","b"],"description":"Who serves the first game. Default a."},"points":{"type":"string","maxLength":2000,"description":"Point winners from the first point of the match, one character each: \"a\" or \"b\" (players, not server/receiver). Up to 2000.","minLength":1},"claim":{"type":"object","additionalProperties":false,"description":"Optional claims to verify against the replay.","properties":{"winner":{"type":"string","enum":["a","b"]},"setsWon":{"type":"array","items":{"type":"integer","description":"games or sets","minimum":0,"maximum":20},"maxItems":2,"minItems":2,"description":"Sets won [a, b]."},"games":{"type":"array","items":{"type":"integer","description":"games or sets","minimum":0,"maximum":20},"maxItems":2,"minItems":2,"description":"Games in the current set [a, b] (0-0 after a set ends)."},"server":{"type":"string","enum":["a","b"],"description":"Who serves the next point."}}}}},"golf":{"type":"object","additionalProperties":false,"description":"For sport=golf: a round, a list of differentials, or both.","properties":{"round":{"type":"object","additionalProperties":false,"required":["courseRating","slopeRating"],"properties":{"adjustedGrossScore":{"type":"integer","description":"18-hole adjusted gross score. Give this or holes.","minimum":18,"maximum":300},"holes":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["par","gross","strokes"],"properties":{"par":{"type":"integer","description":"Hole par.","minimum":3,"maximum":6},"gross":{"type":"integer","description":"Gross strokes.","minimum":1,"maximum":30},"strokes":{"type":"integer","description":"Handicap strokes received (negative for a plus handicap).","minimum":-2,"maximum":4}}},"maxItems":18,"description":"Exactly 18 holes; each score is limited to net double bogey (par + 2 + strokes), or par + 5 before a Handicap Index exists."},"indexEstablished":{"type":"boolean","description":"Default true. False: limit holes to par + 5 (Rule 3.1a)."},"holesPlayed":{"type":"integer","enum":[9,18],"description":"Default 18. 9 returns unsupported."},"courseRating":{"type":"number","description":"Course Rating.","minimum":20,"maximum":90},"slopeRating":{"type":"integer","description":"Slope Rating.","minimum":55,"maximum":155},"pcc":{"type":"number","description":"Playing Conditions Calculation adjustment, -1.0 to +3.0 (Rule 5.1a). Default 0.","minimum":-1,"maximum":3}}},"differentials":{"type":"array","items":{"type":"number","description":"A Score Differential.","minimum":-20,"maximum":80},"maxItems":40,"minItems":1,"description":"Scoring record, oldest first; the most recent 20 are used."},"lowHandicapIndex":{"type":"number","description":"Low Handicap Index (365 days), used only to detect that the soft cap would apply.","minimum":-10,"maximum":54},"claim":{"type":"object","additionalProperties":false,"properties":{"scoreDifferential":{"type":"number","description":"Claimed Score Differential."},"handicapIndex":{"type":"number","description":"Claimed Handicap Index."}}}}},"cricket":{"type":"object","additionalProperties":false,"required":["events"],"description":"For sport=cricket: one innings, ball by ball.","properties":{"events":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["ball","wide","noball","dead"],"description":"ball: a valid delivery. wide / noball: delivery that does not count (Laws 21, 22). dead: called dead before the striker could play it (Law 17.3.2.1)."},"runs":{"type":"integer","description":"ball: runs scored. wide/noball: runs in addition to the 1-run penalty. Default 0.","minimum":0,"maximum":12},"runsKind":{"type":"string","enum":["bat","bye","legbye"],"description":"Whose runs: default bat. Not for wides."},"wicket":{"type":"boolean","description":"A batter was dismissed on this delivery."}}},"maxItems":1000,"minItems":1,"description":"Deliveries in order."},"maxOvers":{"type":"integer","description":"Innings limit in overs, if any.","minimum":1,"maximum":200},"maxWickets":{"type":"integer","description":"Wickets that end the innings. Default 10.","minimum":1,"maximum":10},"claim":{"type":"object","additionalProperties":false,"properties":{"overs":{"type":"string","maxLength":8,"description":"Claimed overs.balls, for example \"3.4\"."},"validBalls":{"type":"integer","description":"Claimed valid balls bowled.","minimum":0,"maximum":1200},"runs":{"type":"integer","description":"Claimed total runs.","minimum":0},"wickets":{"type":"integer","description":"Claimed wickets.","minimum":0,"maximum":10},"maidens":{"type":"integer","description":"Claimed maiden overs.","minimum":0,"maximum":200},"inningsOver":{"type":"boolean","description":"Claimed that the innings has ended (needs maxOvers or all wickets down)."}}}}}}},"resultSchema":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass."},"sport":{"type":"string"},"state":{"description":"Sport-specific state. Tennis: setsWon, sets, games, points, gameScore, server, winner. Golf: scoreDifferential, handicapIndex and inputs. Cricket: overs, runs, wickets, extras, maidens, overSummaries."},"summary":{"type":"string","description":"One-line score."},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"outputSchema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass."},"sport":{"type":"string"},"state":{"description":"Sport-specific state. Tennis: setsWon, sets, games, points, gameScore, server, winner. Golf: scoreDifferential, handicapIndex and inputs. Cricket: overs, runs, wickets, extras, maidens, overSummaries."},"summary":{"type":"string","description":"One-line score."},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]},"example":{"sport":"tennis","tennis":{"points":"aaaabbbbaaaabbbbaabaaabbbbbbaaaaaa","bestOf":3,"claim":{"setsWon":[0,0]}}},"openapiOperation":{"operationId":"score_state","summary":"Score state for tennis, golf handicap differentials and cricket overs","description":"Replays a tennis point sequence (ITF Rules of Tennis: games, deuce, tie-breaks, match tie-break, who serves), computes a golf Score Differential and Handicap Index (World Handicap System), or tallies a cricket innings ball by ball (overs.balls, wides and no-balls, maidens, wickets), for agents that must verify a reported score. Optionally checks a claimed score against the replay and names the first illegal point or ball. Does NOT apply the WHS soft/hard cap, exceptional-score reductions or 9-hole expected scores, tennis variants beyond No-Ad and the final-set options, or cricket penalty runs; those return unknown or unsupported.\n\nPrice: 0.005 USDC on Base (x402).","x-x402-price-usdc":"0.005","x-x402-amount":"5000","x-payment-info":{"protocols":["x402"],"price":{"mode":"fixed","currency":"USD","amount":"0.005"}},"x-audience":"business","x-sample-url":"https://agents.writerslogic.com/api/v1/samples/score-state","security":[{"x402":[]},{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["sport"],"properties":{"sport":{"type":"string","enum":["tennis","golf","cricket"],"description":"Selects which block below is read."},"tennis":{"type":"object","additionalProperties":false,"required":["points"],"description":"For sport=tennis.","properties":{"bestOf":{"type":"integer","enum":[3,5],"description":"Default 3."},"finalSet":{"type":"string","enum":["tiebreak","advantage","super-tiebreak-10"],"description":"tiebreak (default): 7-point tie-break at 6-6 in every set. advantage: no tie-break in the final set. super-tiebreak-10: a 10-point tie-break replaces the final set (Appendix VI)."},"noAd":{"type":"boolean","description":"Appendix VI No-Ad: a deciding point at deuce. Default false."},"firstServer":{"type":"string","enum":["a","b"],"description":"Who serves the first game. Default a."},"points":{"type":"string","maxLength":2000,"description":"Point winners from the first point of the match, one character each: \"a\" or \"b\" (players, not server/receiver). Up to 2000.","minLength":1},"claim":{"type":"object","additionalProperties":false,"description":"Optional claims to verify against the replay.","properties":{"winner":{"type":"string","enum":["a","b"]},"setsWon":{"type":"array","items":{"type":"integer","description":"games or sets","minimum":0,"maximum":20},"maxItems":2,"minItems":2,"description":"Sets won [a, b]."},"games":{"type":"array","items":{"type":"integer","description":"games or sets","minimum":0,"maximum":20},"maxItems":2,"minItems":2,"description":"Games in the current set [a, b] (0-0 after a set ends)."},"server":{"type":"string","enum":["a","b"],"description":"Who serves the next point."}}}}},"golf":{"type":"object","additionalProperties":false,"description":"For sport=golf: a round, a list of differentials, or both.","properties":{"round":{"type":"object","additionalProperties":false,"required":["courseRating","slopeRating"],"properties":{"adjustedGrossScore":{"type":"integer","description":"18-hole adjusted gross score. Give this or holes.","minimum":18,"maximum":300},"holes":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["par","gross","strokes"],"properties":{"par":{"type":"integer","description":"Hole par.","minimum":3,"maximum":6},"gross":{"type":"integer","description":"Gross strokes.","minimum":1,"maximum":30},"strokes":{"type":"integer","description":"Handicap strokes received (negative for a plus handicap).","minimum":-2,"maximum":4}}},"maxItems":18,"description":"Exactly 18 holes; each score is limited to net double bogey (par + 2 + strokes), or par + 5 before a Handicap Index exists."},"indexEstablished":{"type":"boolean","description":"Default true. False: limit holes to par + 5 (Rule 3.1a)."},"holesPlayed":{"type":"integer","enum":[9,18],"description":"Default 18. 9 returns unsupported."},"courseRating":{"type":"number","description":"Course Rating.","minimum":20,"maximum":90},"slopeRating":{"type":"integer","description":"Slope Rating.","minimum":55,"maximum":155},"pcc":{"type":"number","description":"Playing Conditions Calculation adjustment, -1.0 to +3.0 (Rule 5.1a). Default 0.","minimum":-1,"maximum":3}}},"differentials":{"type":"array","items":{"type":"number","description":"A Score Differential.","minimum":-20,"maximum":80},"maxItems":40,"minItems":1,"description":"Scoring record, oldest first; the most recent 20 are used."},"lowHandicapIndex":{"type":"number","description":"Low Handicap Index (365 days), used only to detect that the soft cap would apply.","minimum":-10,"maximum":54},"claim":{"type":"object","additionalProperties":false,"properties":{"scoreDifferential":{"type":"number","description":"Claimed Score Differential."},"handicapIndex":{"type":"number","description":"Claimed Handicap Index."}}}}},"cricket":{"type":"object","additionalProperties":false,"required":["events"],"description":"For sport=cricket: one innings, ball by ball.","properties":{"events":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["type"],"properties":{"type":{"type":"string","enum":["ball","wide","noball","dead"],"description":"ball: a valid delivery. wide / noball: delivery that does not count (Laws 21, 22). dead: called dead before the striker could play it (Law 17.3.2.1)."},"runs":{"type":"integer","description":"ball: runs scored. wide/noball: runs in addition to the 1-run penalty. Default 0.","minimum":0,"maximum":12},"runsKind":{"type":"string","enum":["bat","bye","legbye"],"description":"Whose runs: default bat. Not for wides."},"wicket":{"type":"boolean","description":"A batter was dismissed on this delivery."}}},"maxItems":1000,"minItems":1,"description":"Deliveries in order."},"maxOvers":{"type":"integer","description":"Innings limit in overs, if any.","minimum":1,"maximum":200},"maxWickets":{"type":"integer","description":"Wickets that end the innings. Default 10.","minimum":1,"maximum":10},"claim":{"type":"object","additionalProperties":false,"properties":{"overs":{"type":"string","maxLength":8,"description":"Claimed overs.balls, for example \"3.4\"."},"validBalls":{"type":"integer","description":"Claimed valid balls bowled.","minimum":0,"maximum":1200},"runs":{"type":"integer","description":"Claimed total runs.","minimum":0},"wickets":{"type":"integer","description":"Claimed wickets.","minimum":0,"maximum":10},"maidens":{"type":"integer","description":"Claimed maiden overs.","minimum":0,"maximum":200},"inningsOver":{"type":"boolean","description":"Claimed that the innings has ended (needs maxOvers or all wickets down)."}}}}}}},"example":{"sport":"tennis","tennis":{"points":"aaaabbbbaaaabbbbaabaaabbbbbbaaaaaa","bestOf":3,"claim":{"setsWon":[0,0]}}}}}},"responses":{"200":{"description":"Paid result with provenance","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"status":{"type":"string","enum":["pass","fail","unknown","unsupported"],"description":"pass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass."},"sport":{"type":"string"},"state":{"description":"Sport-specific state. Tennis: setsWon, sets, games, points, gameScore, server, winner. Golf: scoreDifferential, handicapIndex and inputs. Cricket: overs, runs, wickets, extras, maidens, overSummaries."},"summary":{"type":"string","description":"One-line score."},"witnesses":{"type":"array","items":{"type":"object","properties":{"ruleId":{"type":"string"},"detail":{"type":"string"},"path":{"type":"string","description":"JSON pointer or dotted path into the input."},"offset":{"type":"integer"},"index":{"type":"integer"},"expected":{"description":"What the rule required."},"actual":{"description":"What the input had."}}}},"versions":{"type":"object","description":"Every semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile)."},"limits":{"type":"array","items":{"type":"string"}},"deterministic":{"type":"boolean","description":"Always true: pure code, no model."}}},"_provenance":{"type":"object","description":"C2PA-aligned manifest and W3C VC 2.0 (eddsa-jcs-2022) issued by the hub DID; verify at POST /api/v1/verify-provenance"}},"required":["data","_provenance"]}}}},"400":{"description":"Invalid request (no payment consumed)","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"401":{"description":"Invalid X-API-KEY","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}},"402":{"description":"Payment required or invalid","content":{"application/json":{"schema":{"type":"object","description":"x402 v2 PaymentRequired (also base64 in the PAYMENT-REQUIRED header)","properties":{"x402Version":{"type":"integer"},"error":{"type":"string"},"code":{"type":"string"},"resource":{"type":"object"},"accepts":{"type":"array","items":{"type":"object"}},"extensions":{"type":"object"}}}}}},"502":{"description":"Upstream failure; the payment is released or not settled","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}}}}}}},"links":{"docs":"https://agents.writerslogic.com/docs/score-state/","docsJson":"https://agents.writerslogic.com/docs/score-state.json","sample":"https://agents.writerslogic.com/api/v1/samples/score-state","openapi":"https://agents.writerslogic.com/openapi.json","catalog":"https://agents.writerslogic.com/api/v1/catalog","verifyProvenance":"https://agents.writerslogic.com/api/v1/verify-provenance","index":"https://agents.writerslogic.com/docs/index.json"}}