diff --git a/data/tools/file_read.meta b/data/tools/file_read.meta index dc68ace..5bf3992 100644 --- a/data/tools/file_read.meta +++ b/data/tools/file_read.meta @@ -1,6 +1,6 @@ { "description": "Read a file with line numbers. Prefer segments over full reads.", - "prompt": "## file_read\n\nRead a file with line numbers. Prefer segments over full reads.\n\n**Args**: `path` (required), `start`, `end`, or `head`\n\n- `start`/`end`: 1-indexed line numbers, inclusive. Use integers. Max segment: 2000 lines.\n- No start/end: reads up to 500 lines from line 1.\n- `head`: read first N lines (alternative to start/end).\n\n```\nfile_read(path=\"\")\nfile_read(path=\"\", start=100, end=200)\nfile_read(path=\"\", head=50)\n```\n\n- Use `start`/`end` as integers even though they represent line numbers.\n- Use `head` as an integer alternative to `start`/`end`.\n\n**Constraints**: Absolute paths only.", + "prompt": "## file_read\n\nRead a file with line numbers. Prefer segments over full reads.\n\n**Args**: `path` (required), optional `start` and `end` line numbers\n\n- `start`/`end`: 1-indexed line numbers, inclusive. Use integers. Max segment: 2000 lines.\n- No `start`/`end`: reads up to 500 lines from line 1.\n\n```\nfile_read(path=\"\")\nfile_read(path=\"\", start=100, end=200)\n```\n\n- Use `start`/`end` as integers even though they represent line numbers.\n\n**Constraints**: Absolute paths only.", "args": { "type": "object", "required": [ @@ -18,10 +18,6 @@ "end": { "type": "integer", "description": "1-indexed end line, inclusive (max 2000 line segment). Use an integer." - }, - "head": { - "type": "integer", - "description": "Read first N lines (alternative to start/end). Use an integer." } } }, diff --git a/tools/filetools/internal/filetools/filetools.go b/tools/filetools/internal/filetools/filetools.go index 3d95522..6c2bc87 100644 --- a/tools/filetools/internal/filetools/filetools.go +++ b/tools/filetools/internal/filetools/filetools.go @@ -122,21 +122,12 @@ func Read(m map[string]any) (string, error) { if start < 1 { start = 1 } - hp, e := Int(m, "head", nil) - if e != nil { - return "", e - } ep, e := Int(m, "end", nil) if e != nil { return "", e } end := start + MaxLines - 1 - if hp != nil { - if *hp < 0 { - return "", fmt.Errorf("argument %q must be non-negative", "head") - } - end = start + *hp - 1 - } else if ep != nil { + if ep != nil { end = *ep if end > start+MaxSegment-1 { end = start + MaxSegment - 1