diff --git a/lib/Discovery_Schema.cpp b/lib/Discovery_Schema.cpp index 360dd11e8..51ebc3fbc 100644 --- a/lib/Discovery_Schema.cpp +++ b/lib/Discovery_Schema.cpp @@ -2003,13 +2003,14 @@ std::string Discovery_Schema::fts_search_llm( } delete resultset; - // If include_objects, fetch object details - if (include_objects) { - proxy_error("FTS search: include_objects=%d, objects_to_fetch size=%zu\n", include_objects ? 1 : 0, objects_to_fetch.size()); + // If include_objects AND query is not empty (search mode), fetch object details + // For list mode (empty query), we don't include objects to avoid huge responses + if (include_objects && !query.empty()) { + proxy_info("FTS search: include_objects=true (search mode), objects_to_fetch size=%zu\n", objects_to_fetch.size()); } - if (include_objects && !objects_to_fetch.empty()) { - proxy_info("FTS search: include_objects=true, objects_to_fetch size=%zu\n", objects_to_fetch.size()); + if (include_objects && !query.empty() && !objects_to_fetch.empty()) { + proxy_info("FTS search: Fetching object details for %zu objects\n", objects_to_fetch.size()); // First, build a map of object_name -> schema_name by querying the objects table std::map object_to_schema; diff --git a/lib/Query_Tool_Handler.cpp b/lib/Query_Tool_Handler.cpp index b4f3f8deb..f6d587f23 100644 --- a/lib/Query_Tool_Handler.cpp +++ b/lib/Query_Tool_Handler.cpp @@ -728,7 +728,7 @@ json Query_Tool_Handler::get_tool_list() { tools.push_back(create_tool_schema( "llm.search", - "Full-text search across LLM artifacts. For question_templates, returns example_sql, related_objects, template_json, and confidence. Use include_objects=true to get full object schema details.", + "Full-text search across LLM artifacts. For question_templates, returns example_sql, related_objects, template_json, and confidence. Use include_objects=true with a non-empty query to get full object schema details (for search mode only). Empty query (list mode) returns only templates without objects to avoid huge responses.", {"run_id"}, {{"query", "string"}, {"limit", "integer"}, {"include_objects", "boolean"}} ));