Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cecli/tools/read_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ def execute(cls, coder, show, **kwargs):
)
continue

# Models sometimes pass line numbers as int; coerce before str ops.
start_text = str(start_text)
end_text = str(end_text)

if start_text.count("\n") > 4 or end_text.count("\n") > 4:
error_outputs.append(
cls.format_error(
Expand Down Expand Up @@ -609,8 +613,8 @@ def format_output(cls, coder, mcp_server, tool_response):
coder.io.tool_output("")
for i, show_op in enumerate(show_ops):
file_path = show_op.get("file_path", "")
start_text = strip_hashline(show_op.get("start_text", "")).strip()
end_text = strip_hashline(show_op.get("end_text", "")).strip()
start_text = strip_hashline(str(show_op.get("start_text", ""))).strip()
end_text = strip_hashline(str(show_op.get("end_text", ""))).strip()

# Format as "show: • file_path • start_text • end_text • padding"
formatted_query = (
Expand All @@ -627,6 +631,8 @@ def format_error(cls, coder, error_text, file_path, start_text, end_text, operat
"""Format error output for the ReadRange tool."""

# Truncate start_text to first line with ellipsis if multiline
start_text = str(start_text or "")
end_text = str(end_text or "")
start_line = (start_text or "N/A").split("\n")[0]
if start_text and start_text.count("\n") > 0:
start_line = start_line + " ..."
Expand Down
Loading