Return type standardization

This commit is contained in:
2026-07-27 00:35:20 -07:00
parent baa48d7cec
commit f0e5267828
8 changed files with 47 additions and 48 deletions
+3 -3
View File
@@ -35,7 +35,7 @@ async def handle(args: Dict[str, Any]):
# Case 1: No pattern and no lines provided -> Dump whole file
if not pattern and not lines_str:
output = [f"{i+1}: {line}" for i, line in enumerate(all_lines)]
return {"text": "".join(output)}
return [{"type": "text", "text": "".join(output)}]
# Determine target line numbers (1-based)
target_lines: Set[int] = set()
@@ -61,7 +61,7 @@ async def handle(args: Dict[str, Any]):
raise ToolError(f"Error parsing line indices: {e}")
if not target_lines:
return {"text": "No matching lines found."}
return [{"type": "text", "text": "No matching lines found."}]
# Expand targets with context
lines_to_show: Set[int] = set()
@@ -83,4 +83,4 @@ async def handle(args: Dict[str, Any]):
output.append(f"{ln}: {all_lines[ln-1]}")
last_line = ln
return {"text": "".join(output)}
return [{"type": "text", "text": "".join(output)}]