Calculate Shelem score
calculate_shelem_scoreScore a completed Shelem hand from the bid and captured points, applying contract and threshold rules to return both teams' updated totals.
Instructions
Score one completed Shelem hand and return both teams' new totals.
Pass the cumulative scores from before the hand, the declaring team, the bid, and how many points were captured (defending_points, declarer_points, or outcome "mak"/"sweep"). The engine applies the doubled sweep award, failed and heavily failed bids, Shelem/sar-shelem (+330/-330/-660), the 1000-point rule for a defending team, and the 1165 winning threshold. All arithmetic is integer and deterministic.
Invalid or contradictory input returns an error and no score.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"team1_score": "<team1_score>",
"team2_score": "<team2_score>",
"bid": "<bid>"
},
"name": "calculate_shelem_score"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bid | Yes | The winning bid: 100, 105, ..., 165. Expand spoken abbreviations first ("20" is 120). | |
| outcome | No | "mak": the declarer captured exactly the bid. "sweep": the defenders captured nothing. Use instead of, or consistently with, the point fields. | |
| contract | No | Omit below 165. Required when bid is 165: "shelem", "sare-shelem" or "normal" (scored differently on failure). | |
| hakem_team | No | Team of the Hakem (the declarer): 1 or 2. | |
| team1_score | Yes | Team 1 cumulative score before this hand. May be negative. | |
| team2_score | Yes | Team 2 cumulative score before this hand. May be negative. | |
| bidding_team | No | Team that won the bidding: 1 or 2. Must equal hakem_team when both are given. At least one of the two is required. | |
| bid_successful | No | Optional cross-check. The captured points decide success; if this flag disagrees the hand is rejected. Mak is successful. | |
| declarer_points | No | Points captured by the declaring team: 0-165, multiple of 5. Must sum to 165 with defending_points when both are given. | |
| defending_points | No | Points captured by the defending team: 0-165, multiple of 5. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hand | Yes | ||
| winner | Yes | 1 or 2 when the game is finished, otherwise null. | |
| explanation | Yes | Plain-English account of how the hand was scored. | |
| game_finished | Yes | True when exactly one team reached 1165 or more. | |
| score_changes | Yes | ||
| updated_team1_score | Yes | Team 1 total after the hand. | |
| updated_team2_score | Yes | Team 2 total after the hand. |