ZIm/crates/assistant_tools/src
Agus Zubiaga fd17f2d8ae
agent: Enrich grep tool output with syntax information (#29601)
The `grep` tool used to include 4 lines of context around the match, but
the lines included would often be unhelpful. This PR improves this
behavior by using the range of the parent syntax node that contains the
full line(s) matched.

The match headers will also now include symbol breadcrumbs so that the
model can already gather code structure before/without reading files.

````md
### impl GitRepository for RealGitRepository › fn compare_checkpoints › L1278-1284
```rust
                let result = git
                    .run(&[
                        "diff-tree",
                        "--quiet",
                        &left.commit_sha.to_string(),
                        &right.commit_sha.to_string(),
                    ])
```
````

This positively impacts the `add_arg_to_trait_method` eval example with
better diff output, fewer tool failures, and reduced total turns.

Note: We have some plans to use a an "elision" approach where we would
combine all matches for a given file, skipping lines between them while
keeping symbol declaration lines. The theory is that this would be map
more closely to the expected input for edits. For now, this PR is a
significant improvement.

Release Notes:

- Agent: Enrich `grep` tool output with syntax information
2025-04-29 17:03:02 +00:00
..
batch_tool Add Batch tool call for calling multiple tools (#27621) 2025-03-27 18:21:26 -04:00
code_action_tool Add code action tool and rename tool (#28453) 2025-04-09 22:38:01 -04:00
code_symbols_tool Add Code Symbols tool (#27733) 2025-03-31 05:13:13 +00:00
contents_tool Add contents_tool (#28738) 2025-04-15 00:54:25 -04:00
copy_path_tool Add copy-path tool (#27371) 2025-03-24 21:21:55 -04:00
create_directory_tool Add Create Directory Tool (#27505) 2025-03-26 11:59:03 -04:00
create_file_tool Add create-file-tool (#27381) 2025-03-25 10:56:41 -04:00
delete_path_tool Delete tool uses paths instead of globs (#26715) 2025-03-16 11:58:25 +01:00
diagnostics_tool Systematically optimize agentic editing performance (#28961) 2025-04-19 02:47:59 +00:00
edit_file_tool Systematically optimize agentic editing performance (#28961) 2025-04-19 02:47:59 +00:00
fetch_tool assistant_tools: Add fetch tool (#26999) 2025-03-18 16:25:51 +00:00
find_path_tool agent: Improve initial file search quality (#29317) 2025-04-23 21:24:41 -03:00
find_replace_tool Add code action tool and rename tool (#28453) 2025-04-09 22:38:01 -04:00
grep_tool Rename regex search tool to grep and accept an include glob pattern (#29100) 2025-04-20 00:53:30 +00:00
list_directory_tool agent: Improve initial file search quality (#29317) 2025-04-23 21:24:41 -03:00
move_path_tool Add move_path tool (#27366) 2025-03-24 14:45:19 +00:00
open_tool Add Open Tool (#27499) 2025-03-27 18:20:59 -04:00
read_file_tool Systematically optimize agentic editing performance (#28961) 2025-04-19 02:47:59 +00:00
rename_tool Add code action tool and rename tool (#28453) 2025-04-09 22:38:01 -04:00
symbol_info_tool Add symbol info tool (#27742) 2025-03-31 00:23:03 -04:00
terminal_tool agent: Create TerminalToolCard and display shell output while it's running (#29546) 2025-04-29 16:06:43 +00:00
thinking_tool Add thinking tool (#26675) 2025-03-14 16:26:22 -04:00
ui agent: Render path search results with ToolCard (#28894) 2025-04-25 14:42:51 -03:00
assistant_tools.rs Remove unnecessary fields from the tool schemas (#29381) 2025-04-24 18:09:25 -07:00
batch_tool.rs agent: Improve initial file search quality (#29317) 2025-04-23 21:24:41 -03:00
code_action_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
code_symbols_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
contents_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
copy_path_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
create_directory_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
create_file_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
delete_path_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
diagnostics_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
edit_file_tool.rs agent: Create TerminalToolCard and display shell output while it's running (#29546) 2025-04-29 16:06:43 +00:00
fetch_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
find_path_tool.rs agent: Render path search results with ToolCard (#28894) 2025-04-25 14:42:51 -03:00
grep_tool.rs agent: Enrich grep tool output with syntax information (#29601) 2025-04-29 17:03:02 +00:00
list_directory_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
move_path_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
now_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
open_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
read_file_tool.rs agent tools: Make read_file.end_line inclusive (#29524) 2025-04-28 09:37:13 +00:00
rename_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
replace.rs edit tool: Handle over-indentation in replace_with_flexible_indent (#29153) 2025-04-21 11:02:08 -03:00
schema.rs agent: Improve compatibility when using MCP servers with Gemini models (#28700) 2025-04-14 21:55:25 +02:00
symbol_info_tool.rs Refactor markdown formatting utilities to avoid building intermediate strings (#29511) 2025-04-27 19:04:51 +00:00
terminal_tool.rs agent: Create TerminalToolCard and display shell output while it's running (#29546) 2025-04-29 16:06:43 +00:00
thinking_tool.rs agent: Render diffs for the edit file tool (#29234) 2025-04-23 15:43:33 -03:00
ui.rs agent: Refine the web search tool call UI (#29190) 2025-04-22 09:51:57 -03:00
web_search_tool.rs agent: Create TerminalToolCard and display shell output while it's running (#29546) 2025-04-29 16:06:43 +00:00