MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / formatFileReadResult

Function formatFileReadResult

src/core/mentions/index.ts:79–97  ·  view source on GitHub ↗

* Formats file content to look like a read_file tool result. * Includes Gemini-style truncation warning when content is truncated.

(filePath: string, result: ExtractTextResult)

Source from the content-addressed store, hash-verified

77 * Includes Gemini-style truncation warning when content is truncated.
78 */
79function formatFileReadResult(filePath: string, result: ExtractTextResult): string {
80 const header = `[read_file for '${filePath}']`
81
82 if (result.wasTruncated && result.linesShown) {
83 const [start, end] = result.linesShown
84 const nextOffset = end + 1
85 return `${header}
86IMPORTANT: File content truncated.
87Status: Showing lines ${start}-${end} of ${result.totalLines} total lines.
88To read more: Use the read_file tool with offset=${nextOffset} and limit=${DEFAULT_LINE_LIMIT}.
89
90File: ${filePath}
91${result.content}`
92 }
93
94 return `${header}
95File: ${filePath}
96${result.content}`
97}
98
99export async function parseMentions(
100 text: string,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected