Parent
#328. Split from #226.
Problem
get_outline (documentTools.ts) and list_chat_rooms (chatTools.ts) return every heading, with no cap. Hosts cap a tool result near 150 000 characters, and a document can hold 5 MiB. structuredContent repeats the whole list, so the result is about twice the text. read_document and read_chat_thread already stop at MAX_READ_CHARS.
What to do
Reuse the MAX_READ_CHARS loop in read_chat_thread (chatTools.ts). Stop adding lines at MAX_READ_CHARS. Cut structuredContent to the same entries. Add one line: [Truncated: showing N of M headings.]
Acceptance
No new test: the change copies a shipped loop.
Parent
#328. Split from #226.
Problem
get_outline(documentTools.ts) andlist_chat_rooms(chatTools.ts) return every heading, with no cap. Hosts cap a tool result near 150 000 characters, and a document can hold 5 MiB.structuredContentrepeats the whole list, so the result is about twice the text.read_documentandread_chat_threadalready stop atMAX_READ_CHARS.What to do
Reuse the
MAX_READ_CHARSloop inread_chat_thread(chatTools.ts). Stop adding lines atMAX_READ_CHARS. CutstructuredContentto the same entries. Add one line:[Truncated: showing N of M headings.]Acceptance
MAX_READ_CHARSand say so.structuredContentholds only the shown entries.No new test: the change copies a shipped loop.