MCPcopy Create free account
hub / github.com/anomalyco/opencode / sanitizeToolResultOutput

Function sanitizeToolResultOutput

packages/opencode/src/provider/transform.ts:70–83  ·  view source on GitHub ↗
(content: ToolResultPart)

Source from the content-addressed store, hash-verified

68 _options: Record<string, unknown>,
69): ModelMessage[] {
70 const sanitizeToolResultOutput = (content: ToolResultPart) => {
71 if (content.output.type === "text" || content.output.type === "error-text") {
72 content.output.value = sanitizeSurrogates(content.output.value)
73 }
74 if (content.output.type === "content") {
75 content.output.value = content.output.value.map((item) => {
76 if (item.type === "text") {
77 item.text = sanitizeSurrogates(item.text)
78 }
79 return item
80 })
81 }
82 return content
83 }
84
85 msgs = msgs.map((msg) => {
86 switch (msg.role) {

Callers 1

normalizeMessagesFunction · 0.85

Calls 1

sanitizeSurrogatesFunction · 0.85

Tested by

no test coverage detected