@@ -106,7 +106,6 @@ async def test_server_version_is_the_package_version(web: FakeWeb) -> None:
106106# --------------------------------------------------------------------------
107107
108108
109- # KNOWN BUG #1624: pins current (wrong) behavior; the fix changes this assertion.
110109async def test_list_tools_wire_shape (web : FakeWeb ) -> None :
111110 async with connect () as (session , _ ):
112111 result = await session .list_tools ()
@@ -128,13 +127,13 @@ async def test_list_tools_wire_shape(web: FakeWeb) -> None:
128127 "title" : "Url" ,
129128 "type" : "string" ,
130129 },
131- # #1624: pydantic's gt/lt emit the numeric (draft 6+) form of
132- # exclusiveMinimum/ exclusiveMaximum, which some clients reject.
130+ # #1624: inclusive minimum/maximum, never exclusiveMinimum/
131+ # exclusiveMaximum, which some clients (Gemini) reject.
133132 "max_length" : {
134133 "default" : 5000 ,
135134 "description" : "Maximum number of characters to return." ,
136- "exclusiveMaximum " : 1000000 ,
137- "exclusiveMinimum " : 0 ,
135+ "maximum " : 999999 ,
136+ "minimum " : 1 ,
138137 "title" : "Max Length" ,
139138 "type" : "integer" ,
140139 },
@@ -183,7 +182,8 @@ async def test_call_with_only_url_applies_defaults(web: FakeWeb) -> None:
183182 ({}, "'url'" ),
184183 ({"url" : "" }, "''" ),
185184 ({"url" : 5 }, "5" ),
186- # #1624: the bounds come from exclusiveMinimum/exclusiveMaximum.
185+ # #1624: the bounds are minimum 1 and maximum 999999, so the rejected
186+ # values are the same as under the old exclusive 0 and 1000000.
187187 ({"url" : PAGE , "max_length" : 0 }, "0" ),
188188 ({"url" : PAGE , "max_length" : 1000000 }, "1000000" ),
189189 ({"url" : PAGE , "start_index" : - 1 }, "-1" ),
@@ -204,6 +204,18 @@ async def test_schema_violations_are_rejected_by_the_sdk(
204204 assert web .requests == []
205205
206206
207+ @pytest .mark .parametrize ("max_length" , [1 , 999999 ])
208+ async def test_max_length_bounds_are_inclusive (web : FakeWeb , max_length : int ) -> None :
209+ # #1624: the edges of the inclusive range pass both the SDK's schema check
210+ # and Fetch's own validation, and the page is fetched.
211+ web .add (ROBOTS , plain ("" , status = 404 ))
212+ web .add (PAGE , plain ("hello" ))
213+ async with connect () as (session , _ ):
214+ result = await call (session , {"url" : PAGE , "max_length" : max_length })
215+ assert wire (result )["isError" ] is False
216+ assert web .urls () == [ROBOTS , PAGE ]
217+
218+
207219@pytest .mark .parametrize ("url" , ["not a url" , "example.com/page" , "http://" ])
208220async def test_invalid_url_is_rejected_by_pydantic (web : FakeWeb , url : str ) -> None :
209221 # jsonschema does not check `format: uri`, so these reach Fetch(**arguments)
0 commit comments