@@ -277,6 +277,57 @@ def test_large_result_is_stored_as_resource(self):
277277 self .assertEqual (contents [0 ].mime_type , "application/json" )
278278 self .assertIn ('"type": "text"' , contents [0 ].content )
279279
280+ def test_store_results_false_returns_large_result_inline (self ):
281+ manager = ToolManager ()
282+ manager .tools_registry = {
283+ "tables_db_list" : {
284+ "definition" : make_tool ("tables_db_list" , "List all databases." ),
285+ "function" : object (),
286+ "parameter_types" : {},
287+ },
288+ }
289+ runtime = Operator (
290+ manager ,
291+ lambda name , arguments , * _ : [
292+ types .TextContent (type = "text" , text = "x" * 1200 )
293+ ],
294+ store_results = False ,
295+ )
296+
297+ result = runtime .execute_public_tool (
298+ "appwrite_call_tool" ,
299+ {"tool_name" : "tables_db_list" },
300+ )
301+
302+ self .assertEqual (result [0 ].text , "x" * 1200 )
303+ self .assertNotIn ("appwrite://operator/results/" , result [0 ].text )
304+
305+ def test_store_results_false_returns_image_inline (self ):
306+ manager = ToolManager ()
307+ manager .tools_registry = {
308+ "avatars_get_qr" : {
309+ "definition" : make_tool ("avatars_get_qr" , "Get a QR code." ),
310+ "function" : object (),
311+ "parameter_types" : {},
312+ },
313+ }
314+ runtime = Operator (
315+ manager ,
316+ lambda name , arguments , * _ : [
317+ types .ImageContent (type = "image" , data = "aW1hZ2U=" , mimeType = "image/png" )
318+ ],
319+ store_results = False ,
320+ )
321+
322+ result = runtime .execute_public_tool (
323+ "appwrite_call_tool" ,
324+ {"tool_name" : "avatars_get_qr" },
325+ )
326+
327+ self .assertEqual (len (result ), 1 )
328+ self .assertIsInstance (result [0 ], types .ImageContent )
329+ self .assertEqual (result [0 ].mimeType , "image/png" )
330+
280331
281332if __name__ == "__main__" :
282333 unittest .main ()
0 commit comments