Skip to content

Commit 65196cc

Browse files
authored
feat: add file path to read tool (#413)
### TL;DR Enhance tool call display by showing file paths for read operations ### What changed? - Added support for displaying file paths in the `ToolCallView` component when the tool kind is "read" - Extracted the file path from the first location in the `locations` array - Created a `displayText` variable that shows "Read {filePath}" for read operations or falls back to the original title - Updated the component to render the new `displayText` instead of just the title ### How to test? 1. Trigger a tool call with kind "read" that includes location data 2. Verify that the tool call displays "Read {filePath}" instead of the generic title 3. Confirm that other tool kinds still display their original titles 4. Check that the UI properly handles cases where location data is missing ### Why make this change? This change improves the user experience by providing more specific and contextual information about read operations. By displaying the actual file path being read, users can more easily understand what files the system is accessing during tool calls, making the interface more informative and transparent.
1 parent adf1f25 commit 65196cc

File tree

1 file changed

+6
-2
lines changed
  • apps/array/src/renderer/features/sessions/components/session-update

1 file changed

+6
-2
lines changed

apps/array/src/renderer/features/sessions/components/session-update/ToolCallView.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,17 @@ interface ToolCallViewProps {
3636
}
3737

3838
export function ToolCallView({ toolCall, turnCancelled }: ToolCallViewProps) {
39-
const { title, kind, status } = toolCall;
39+
const { title, kind, status, locations } = toolCall;
4040
const isIncomplete = status === "pending" || status === "in_progress";
4141
const isLoading = isIncomplete && !turnCancelled;
4242
const isFailed = status === "failed";
4343
const wasCancelled = isIncomplete && turnCancelled;
4444
const KindIcon = kind ? kindIcons[kind] : Wrench;
4545

46+
// For read tool, show file path from locations if available
47+
const filePath = kind === "read" && locations?.[0]?.path;
48+
const displayText = filePath ? `Read ${filePath}` : title;
49+
4650
return (
4751
<Flex align="center" gap="2" className="py-0.5 pl-3">
4852
{isLoading ? (
@@ -51,7 +55,7 @@ export function ToolCallView({ toolCall, turnCancelled }: ToolCallViewProps) {
5155
<KindIcon size={12} className="text-gray-9" />
5256
)}
5357
<Code size="1" color="gray">
54-
{title}
58+
{displayText}
5559
</Code>
5660
{isFailed && (
5761
<Text size="1" color="gray">

0 commit comments

Comments
 (0)