@@ -236,33 +236,6 @@ return check_cli_wrap(function(opts)
236236
2372372. **Key Points**:
238238%s
239-
240- 3. Example Tool Call
241- **Querying a project and retrieve the 10 most relevant files with keywords "keyword1" and "keyword2"**
242- ```
243- {
244- "_attr": "vectorcode",
245- {
246- "action": "query",
247- "options": {
248- "query": ["keyword1", "keyword2"],
249- "count": 10,
250- "project_root": "/path/to/project",
251- }
252- }
253- }
254- ```
255-
256- **Listing available projects**
257- ```
258- {
259- "_attr": "vectorcode",
260- {
261- "action": "ls"
262- }
263- }
264- ```
265-
266239]] ,
267240 table.concat (guidelines , " \n " )
268241 )
@@ -279,13 +252,10 @@ return check_cli_wrap(function(opts)
279252 )
280253 )
281254 stderr = cc_common .flatten_table_to_string (stderr )
282- agent .chat :add_message ({
283- role = " user" ,
284- content = string.format (
285- " VectorCode tool failed with the following error:\n " ,
286- stderr
287- ),
288- }, { visible = false })
255+ agent .chat :add_tool_output (
256+ self ,
257+ string.format (" VectorCode tool failed with the following error:\n " , stderr )
258+ )
289259 end ,
290260 --- @param agent CodeCompanion.Agent
291261 --- @param cmd table
@@ -299,9 +269,9 @@ return check_cli_wrap(function(opts)
299269 agent .chat .ui :unlock_buf ()
300270 for i , file in pairs (stdout ) do
301271 if opts .max_num < 0 or i <= opts .max_num then
302- agent .chat :add_message ({
303- role = " user " ,
304- content = string.format (
272+ agent .chat :add_tool_output (
273+ self ,
274+ string.format (
305275 [[ Here is a file the VectorCode tool retrieved:
306276<path>
307277%s
@@ -313,7 +283,11 @@ return check_cli_wrap(function(opts)
313283 file .path ,
314284 file .document
315285 ),
316- }, { visible = false , id = file .path })
286+ string.format (
287+ " VectorCode retrieved: `%s`" ,
288+ string.gsub (file .path , vim .fs .normalize (" ~" ), " ~" )
289+ )
290+ )
317291 agent .chat .references :add ({
318292 source = cc_common .tool_result_source ,
319293 id = file .path ,
@@ -323,13 +297,11 @@ return check_cli_wrap(function(opts)
323297 end
324298 elseif cmd .command == " ls" then
325299 for _ , col in pairs (stdout ) do
326- agent .chat :add_message ({
327- role = " user" ,
328- content = string.format (
329- " <collection>%s</collection>" ,
330- col [" project-root" ]
331- ),
332- }, { visible = false })
300+ agent .chat :add_tool_output (
301+ self ,
302+ string.format (" <collection>%s</collection>" , col [" project-root" ]),
303+ " Fetched all indexed project from VectorCode."
304+ )
333305 end
334306 end
335307 if opts .auto_submit [cmd .command ] then
0 commit comments