# Make grep tool results clickable in agent panel \(\#59230\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/40211567b8df25ac98b5ec01ac7a11513dd23b89)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 40211567b8df25ac98b5ec01ac7a11513dd23b89

Requested commit: 40211567b8df25ac98b5ec01ac7a11513dd23b89

Commit: 40211567b8df25ac98b5ec01ac7a11513dd23b89

Tree: da8b77da8d7d9201c452d1bb7fa46c00c77fb2b7

Author: MartinYe1234

Committer: GitHub

## Message

```
Make grep tool results clickable in agent panel (#59230)

The agent panel's `grep` tool output previously rendered file paths and
line numbers as plain markdown text, so search results weren't clickable
(unlike `find_path`, which emits `ResourceLink` content blocks).

This PR makes `grep` results clickable in the same way `find_path` does:

- `grep` now streams a `ResourceLink` content block per match
(`crates/foo/bar.rs#L12-15` → `file:///abs/path#L12-15`) followed by the
code snippet, via `event_stream.update_fields`, and sets `locations` on
the tool call.
- `render_resource_link` in `agent_ui` now splits an optional `#L...`
fragment off `file://` URIs before resolving the project-relative path,
so labels render as `path#L12-15` instead of falling back to the raw
absolute URI. Clicking opens the file at the matched line (handled by
the existing `MentionUri` selection parsing).
- The model-facing text output of the tool is unchanged.

Closes AI-401

Release Notes:

- Improved the agent panel so that file search results from the agent's
`grep` tool are clickable and open the file at the matched line.
```

## Parents

- [10628c3d2cafc50f78a8861d7d6882b6ecd439ce](https://git.cafe/gitcafe/zed/commit/10628c3d2cafc50f78a8861d7d6882b6ecd439ce?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/40211567b8df25ac98b5ec01ac7a11513dd23b89?format=markdown)
