MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / truncateText

Function truncateText

sdk/src/tools/read-url.ts:309–323  ·  view source on GitHub ↗
(
  text: string,
  maxChars: number,
)

Source from the content-addressed store, hash-verified

307}
308
309function truncateText(
310 text: string,
311 maxChars: number,
312): {
313 text: string
314 truncated: boolean
315} {
316 if (text.length <= maxChars) {
317 return { text, truncated: false }
318 }
319 return {
320 text: `${text.slice(0, maxChars).trimEnd()}\n\n[Content truncated]`,
321 truncated: true,
322 }
323}
324
325export async function readUrl({
326 url,

Callers 1

readUrlFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected