Read the content of a specific chapter.
(
title: Annotated[str, ParamMeta(description="Chapter title to read (supports multi-level index e.g. 'Intro/Background')")],
_context: Dict[str, Any] | None = None,
)
| 252 | |
| 253 | |
| 254 | def report_read_chapter( |
| 255 | title: Annotated[str, ParamMeta(description="Chapter title to read (supports multi-level index e.g. 'Intro/Background')")], |
| 256 | _context: Dict[str, Any] | None = None, |
| 257 | ) -> str: |
| 258 | """ |
| 259 | Read the content of a specific chapter. |
| 260 | """ |
| 261 | ctx = FileToolContext(_context) |
| 262 | _, report_file = _get_files(ctx) |
| 263 | _, report_lock = _get_locks(ctx) |
| 264 | |
| 265 | with FileLock(report_lock): |
| 266 | lines = _read_report_lines(report_file) |
| 267 | |
| 268 | start, end = _find_chapter_range(lines, title) |
| 269 | if start == -1: |
| 270 | return f"Chapter '{title}' not found." |
| 271 | |
| 272 | # Return content (excluding header) |
| 273 | # start is the header line, so start+1 |
| 274 | return "\\n".join(lines[start+1:end]) |
| 275 | |
| 276 | |
| 277 | def report_outline( |
nothing calls this directly
no test coverage detected