MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / report_read_chapter

Function report_read_chapter

functions/function_calling/deep_research.py:254–274  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

252
253
254def 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
277def report_outline(

Callers

nothing calls this directly

Calls 6

ParamMetaClass · 0.90
FileToolContextClass · 0.90
_get_filesFunction · 0.85
_get_locksFunction · 0.85
_read_report_linesFunction · 0.85
_find_chapter_rangeFunction · 0.85

Tested by

no test coverage detected