rapidoddsapi-mcp 0.1.2__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,19 @@
2
2
 
3
3
  Notable changes to this package. Versions follow [semantic versioning](https://semver.org).
4
4
 
5
+ ## 0.2.0
6
+
7
+ - `list_sports(sport)` now returns every bookmaker that can be requested for
8
+ that sport, alongside its market types. There was no way to discover a
9
+ bookmaker name: the API has no endpoint for them and does not reject unknown
10
+ ones, it just returns no prices. A model asked which bookmakers were covered
11
+ would therefore guess names and pay for each attempt, and a casing slip such
12
+ as `Palmerbet` for `PalmerBet` looked identical to the book not existing
13
+ - Tool descriptions say not to guess bookmaker or market names, and where the
14
+ valid ones come from
15
+ - Soccer and tennis now list every feed rather than only the European ones,
16
+ since Australian and American books price them too
17
+
5
18
  ## 0.1.2
6
19
 
7
20
  - Certificates are verified against the operating system's trust store. On
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rapidoddsapi-mcp
3
- Version: 0.1.2
3
+ Version: 0.2.0
4
4
  Summary: MCP server for RapidOddsAPI: bookmaker odds, live scores, arbitrage and value bets.
5
5
  Project-URL: Homepage, https://rapidoddsapi.com
6
6
  Project-URL: Documentation, https://rapidoddsapi.com/docs
@@ -4,6 +4,6 @@ Exposes bookmaker odds, live scores, arbitrage and value bets as MCP tools,
4
4
  backed by the official `rapidoddsapi` SDK.
5
5
  """
6
6
 
7
- __version__ = "0.1.2"
7
+ __version__ = "0.2.0"
8
8
 
9
9
  __all__ = ["__version__"]
@@ -42,6 +42,27 @@ def default_bookmakers(sport: str) -> tuple[str, ...]:
42
42
  return _REGIONS.get(sport.upper(), _FALLBACK)
43
43
 
44
44
 
45
+ def region_bookmakers(sport: str) -> Sequence[str]:
46
+ """Every feed in this sport's region.
47
+
48
+ The API has no bookmaker endpoint and does not validate the names, so a
49
+ name that is not a feed returns an empty result rather than an error.
50
+ Without this list the only way to discover a feed is to guess and pay for
51
+ the attempt, so it has to be handed over up front.
52
+ """
53
+ from rapidoddsapi import AU_BOOKMAKERS, BOOKMAKERS, US_BOOKMAKERS
54
+
55
+ # Soccer and tennis are priced everywhere, by Australian and American books
56
+ # as much as European ones, so the honest answer for them is every feed.
57
+ # Only the domestic codes are genuinely regional.
58
+ pools: dict[tuple[str, ...], Sequence[str]] = {
59
+ AU_DEFAULT: AU_BOOKMAKERS,
60
+ US_DEFAULT: US_BOOKMAKERS,
61
+ EU_DEFAULT: BOOKMAKERS,
62
+ }
63
+ return pools[default_bookmakers(sport)]
64
+
65
+
45
66
  def wide_bookmakers(
46
67
  sport: str,
47
68
  count: int = ARBITRAGE_DEFAULT_COUNT,
@@ -29,6 +29,7 @@ from . import __version__
29
29
  from .defaults import (
30
30
  SHARP_BOOKMAKER,
31
31
  default_bookmakers,
32
+ region_bookmakers,
32
33
  wide_bookmakers,
33
34
  with_sharp,
34
35
  )
@@ -67,6 +68,11 @@ Two rules that keep the cost down:
67
68
  which is the cheapest useful request. Cost multiplies with both the number
68
69
  of market types and the number of bookmakers.
69
70
 
71
+ Never guess a bookmaker or market name. An unknown one is not rejected, it
72
+ comes back with no prices, so trying names to see which work is both slow and
73
+ billable. list_sports(sport) returns every valid name for that sport and costs
74
+ nothing.
75
+
70
76
  list_sports is free. Call it first when unsure of a sport id or a market type.
71
77
  """.strip()
72
78
 
@@ -155,7 +161,13 @@ def list_sports(sport: str | None = None) -> str:
155
161
 
156
162
  With no argument: every sport id, plus which of them have live scores.
157
163
  With a sport: that sport's market types, grouped into game, team and
158
- player_props. Any of those keys is valid as a get_odds market_type.
164
+ player_props, and every bookmaker you can request for it. Any of those
165
+ market keys is valid as a get_odds market_type, and any of those bookmaker
166
+ names is valid as a get_odds bookmaker.
167
+
168
+ Call this before naming bookmakers. Unrecognised names are not an error,
169
+ they return no prices, so probing to find out which exist looks like a
170
+ sport simply having no odds and costs credits for each attempt.
159
171
 
160
172
  A sport being listed means the id is accepted, not that games are on right
161
173
  now. Out of season returns an empty result, which costs nothing.
@@ -178,7 +190,21 @@ def list_sports(sport: str | None = None) -> str:
178
190
  lines.append(f"{group} ({len(keys)}):")
179
191
  lines.extend(f" {key}" for key in keys)
180
192
  lines.append("")
181
- lines.append(credit_line(0, _usage()))
193
+ feeds = region_bookmakers(sport)
194
+ lines.append(f"bookmakers you can request for {info['id']} ({len(feeds)}):")
195
+ lines.extend(f" {feed}" for feed in feeds)
196
+ lines += [
197
+ "",
198
+ "That is the complete list of feeds for this region. A name "
199
+ "not on it returns no prices, so do not try other bookmaker "
200
+ "names to see what happens, each attempt can cost credits.",
201
+ "These are feeds, not brands. One feed often carries several "
202
+ "brands at identical prices, so the number of betting sites "
203
+ "behind them is larger than the number of names here.",
204
+ "Not every feed prices every sport or market.",
205
+ "",
206
+ credit_line(0, _usage()),
207
+ ]
182
208
  return "\n".join(lines)
183
209
 
184
210
  sports = client.list_sports()
@@ -221,9 +247,15 @@ def get_odds(
221
247
  no head_to_head because of the draw, so use head_to_head_3_way or
222
248
  draw_no_bet there. Get exact keys from list_sports(sport).
223
249
 
224
- bookmakers defaults to five that cover the sport's region. Names are odds
225
- feeds, not brands: "Ladbrokes" covers Neds, "Betmakers" covers the 26
226
- brands on that feed. A brand name that is not a feed returns nothing.
250
+ bookmakers defaults to five that cover the sport's region. To use others,
251
+ take the names from list_sports(sport), which lists every feed available.
252
+ Never guess a name: an unknown one returns no prices rather than an error,
253
+ so guessing is indistinguishable from the sport having no odds, and each
254
+ guess can cost credits.
255
+
256
+ Names are odds feeds, not brands. "Ladbrokes" is the feed that also carries
257
+ Neds, "Betmakers" carries the 26 brands running on it, so a brand name that
258
+ is not itself a feed returns nothing.
227
259
  """
228
260
  markets = market_types or ["head_to_head"]
229
261
  books = bookmakers or default_bookmakers(sport)
@@ -108,6 +108,22 @@ class TestDefaults:
108
108
  def test_wide_starts_from_the_region(self):
109
109
  assert list(defaults.wide_bookmakers("AFL"))[:5] == list(defaults.AU_DEFAULT)
110
110
 
111
+ def test_region_bookmakers_is_the_full_regional_list(self):
112
+ """The API has no bookmaker endpoint and does not reject bad names, so
113
+ without a list to hand the only way to find a feed is to guess and pay
114
+ for each attempt."""
115
+ from rapidoddsapi import AU_BOOKMAKERS, BOOKMAKERS, US_BOOKMAKERS
116
+
117
+ assert defaults.region_bookmakers("AFL") == AU_BOOKMAKERS
118
+ assert defaults.region_bookmakers("NFL") == US_BOOKMAKERS
119
+ # Soccer and tennis are priced in every region, not just Europe.
120
+ assert defaults.region_bookmakers("EPL") == BOOKMAKERS
121
+
122
+ def test_region_list_is_a_superset_of_the_default(self):
123
+ for sport in ("AFL", "NFL", "EPL"):
124
+ region = set(defaults.region_bookmakers(sport))
125
+ assert set(defaults.default_bookmakers(sport)) <= region
126
+
111
127
  def test_with_sharp_adds_it_once(self):
112
128
  assert defaults.SHARP_BOOKMAKER in defaults.with_sharp(["Sportsbet"])
113
129
  already = ["Pinnacle", "Sportsbet"]