summaryrefslogtreecommitdiffhomepage
path: root/internal/llm/tools/view.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/llm/tools/view.go')
-rw-r--r--internal/llm/tools/view.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/internal/llm/tools/view.go b/internal/llm/tools/view.go
index 3fa4ca116..dc02b34f3 100644
--- a/internal/llm/tools/view.go
+++ b/internal/llm/tools/view.go
@@ -24,6 +24,11 @@ type viewTool struct {
lspClients map[string]*lsp.Client
}
+type ViewResponseMetadata struct {
+ FilePath string `json:"file_path"`
+ Content string `json:"content"`
+}
+
const (
ViewToolName = "view"
MaxReadSize = 250 * 1024
@@ -180,7 +185,13 @@ func (v *viewTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
output += "\n</file>\n"
output += getDiagnostics(filePath, v.lspClients)
recordFileRead(filePath)
- return NewTextResponse(output), nil
+ return WithResponseMetadata(
+ NewTextResponse(output),
+ ViewResponseMetadata{
+ FilePath: filePath,
+ Content: content,
+ },
+ ), nil
}
func addLineNumbers(content string, startLine int) string {