on main help sign in
fix(tools): standardize error message capitalization
83a2dediko
internal/agent/tools/view.go+4−4
@@ -177,19 +177,19 @@ func NewViewTool(
177 }
177 }
178
178
179 if len(suggestions) > 0 {
179 if len(suggestions) > 0 {
180− return fantasy.NewTextErrorResponse(fmt.Sprintf("File not found: %s\n\nDid you mean one of these?\n%s",
180+ return fantasy.NewTextErrorResponse(fmt.Sprintf("file not found: %s\n\nDid you mean one of these?\n%s",
181 filePath, strings.Join(suggestions, "\n"))), nil
181 filePath, strings.Join(suggestions, "\n"))), nil
182 }
182 }
183 }
183 }
184
184
185− return fantasy.NewTextErrorResponse(fmt.Sprintf("File not found: %s", filePath)), nil
185+ return fantasy.NewTextErrorResponse(fmt.Sprintf("file not found: %s", filePath)), nil
186 }
186 }
187 return fantasy.ToolResponse{}, fmt.Errorf("error accessing file: %w", err)
187 return fantasy.ToolResponse{}, fmt.Errorf("error accessing file: %w", err)
188 }
188 }
189
189
190 // Check if it's a directory
190 // Check if it's a directory
191 if fileInfo.IsDir() {
191 if fileInfo.IsDir() {
192− return fantasy.NewTextErrorResponse(fmt.Sprintf("Path is a directory, not a file: %s", filePath)), nil
192+ return fantasy.NewTextErrorResponse(fmt.Sprintf("path is a directory, not a file: %s", filePath)), nil
193 }
193 }
194
194
195 // Set default limit if not provided (no limit for SKILL.md files)
195 // Set default limit if not provided (no limit for SKILL.md files)
@@ -448,7 +448,7 @@ func readBuiltinFile(params ViewParams, skillTracker *skills.Tracker) (fantasy.T
448
448
449 data, err := fs.ReadFile(builtinFS, embeddedPath)
449 data, err := fs.ReadFile(builtinFS, embeddedPath)
450 if err != nil {
450 if err != nil {
451− return fantasy.NewTextErrorResponse(fmt.Sprintf("Builtin file not found: %s", params.FilePath)), nil
451+ return fantasy.NewTextErrorResponse(fmt.Sprintf("builtin file not found: %s", params.FilePath)), nil
452 }
452 }
453
453
454 content := string(data)
454 content := string(data)
internal/agent/tools/write.go+3−3
@@ -69,13 +69,13 @@ func NewWriteTool(
69 oldContent := ""
69 oldContent := ""
70 if err == nil {
70 if err == nil {
71 if fileInfo.IsDir() {
71 if fileInfo.IsDir() {
72− return fantasy.NewTextErrorResponse(fmt.Sprintf("Path is a directory, not a file: %s", filePath)), nil
72+ return fantasy.NewTextErrorResponse(fmt.Sprintf("path is a directory, not a file: %s", filePath)), nil
73 }
73 }
74
74
75 modTime := fileInfo.ModTime().Truncate(time.Second)
75 modTime := fileInfo.ModTime().Truncate(time.Second)
76 lastRead := filetracker.LastReadTime(ctx, sessionID, filePath)
76 lastRead := filetracker.LastReadTime(ctx, sessionID, filePath)
77 if modTime.After(lastRead) {
77 if modTime.After(lastRead) {
78− return fantasy.NewTextErrorResponse(fmt.Sprintf("File %s has been modified since it was last read.\nLast modification: %s\nLast read: %s\n\nPlease read the file again before modifying it.",
78+ return fantasy.NewTextErrorResponse(fmt.Sprintf("file %s has been modified since it was last read.\nLast modification: %s\nLast read: %s\n\nPlease read the file again before modifying it.",
79 filePath, modTime.Format(time.RFC3339), lastRead.Format(time.RFC3339))), nil
79 filePath, modTime.Format(time.RFC3339), lastRead.Format(time.RFC3339))), nil
80 }
80 }
81
81
@@ -83,7 +83,7 @@ func NewWriteTool(
83 if readErr == nil {
83 if readErr == nil {
84 oldContent = string(oldBytes)
84 oldContent = string(oldBytes)
85 if oldContent == params.Content {
85 if oldContent == params.Content {
86− return fantasy.NewTextErrorResponse(fmt.Sprintf("File %s already contains the exact content. No changes made.", filePath)), nil
86+ return fantasy.NewTextErrorResponse(fmt.Sprintf("file %s already contains the exact content. No changes made.", filePath)), nil
87 }
87 }
88 }
88 }
89 } else if !os.IsNotExist(err) {
89 } else if !os.IsNotExist(err) {