MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / maybe_truncate

Function maybe_truncate

codewiki/src/be/agent_tools/str_replace_editor.py:87–93  ·  view source on GitHub ↗

Truncate content and append a notice if content exceeds the specified length.

(content: str, truncate_after: Optional[int] = MAX_RESPONSE_LEN)

Source from the content-addressed store, hash-verified

85
86
87def maybe_truncate(content: str, truncate_after: Optional[int] = MAX_RESPONSE_LEN):
88 """Truncate content and append a notice if content exceeds the specified length."""
89 return (
90 content
91 if not truncate_after or len(content) <= truncate_after
92 else content[:truncate_after] + TRUNCATED_MESSAGE
93 )
94
95
96class Flake8Error:

Callers 2

viewMethod · 0.85
_make_outputMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected