improved tool debugging

This commit is contained in:
Luxferre
2026-03-22 12:01:29 +02:00
parent 77d0d17c89
commit cd2de78c2c
16 changed files with 986 additions and 592 deletions
+15 -9
View File
@@ -12,14 +12,16 @@ import (
func DefaultInternalTools() map[string]ToolDefinition {
return map[string]ToolDefinition{
"read_file": {
Name: "read_file",
Description: "Read a file, optionally with line windowing. Every line is prefixed with 'line:hash:' (e.g. '1:abcd:content').",
Name: "read_file",
Description: "Read a file, optionally with line windowing. " +
"Every line is prefixed with 'line:hash:' (e.g. '1:abcd:content').",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"path": map[string]interface{}{"type": "string"},
"offset": map[string]interface{}{"type": "integer", "description": "Starting line number (0-indexed)"},
"limit": map[string]interface{}{"type": "integer", "description": "Number of lines to read"},
"path": map[string]interface{}{"type": "string"},
"offset": map[string]interface{}{"type": "integer",
"description": "Starting line number (0-indexed)"},
"limit": map[string]interface{}{"type": "integer", "description": "Number of lines to read"},
},
"required": []string{"path"},
},
@@ -41,8 +43,9 @@ func DefaultInternalTools() map[string]ToolDefinition {
Handler: writeFileHandler,
},
"grep_file": {
Name: "grep_file",
Description: "Regex search with surrounding context. Every line is prefixed with 'line:hash:' (e.g. '1:abcd:content').",
Name: "grep_file",
Description: "Regex search with surrounding context. " +
"Every line is prefixed with 'line:hash:' (e.g. '1:abcd:content').",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
@@ -56,8 +59,11 @@ func DefaultInternalTools() map[string]ToolDefinition {
Handler: grepFileHandler,
},
"edit_file": {
Name: "edit_file",
Description: "Replace a string or a block of lines in a file. If 'old_string' contains 'line:hash:' prefixes for every line, it performs a precise replacement at the specified line numbers. Otherwise, it performs a standard first-occurrence replacement. Both multiline strings and 'line:hash:' stripping are supported.",
Name: "edit_file",
Description: "Replace a string or a block of lines in a file. " +
"If 'old_string' contains 'line:hash:' prefixes for every line, it performs a precise replacement " +
"at the specified line numbers. Otherwise, it performs a standard first-occurrence replacement. " +
"Both multiline strings and 'line:hash:' stripping are supported.",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{