MCPcopy Index your code
hub / github.com/simstudioai/sim / stripToolResultOutput

Function stripToolResultOutput

apps/sim/lib/copilot/chat/persisted-message.ts:97–110  ·  view source on GitHub ↗
(message: PersistedMessage)

Source from the content-addressed store, hash-verified

95 * read-side consumers.
96 */
97export function stripToolResultOutput(message: PersistedMessage): PersistedMessage {
98 if (!message.contentBlocks?.length) return message
99 let changed = false
100 const contentBlocks = message.contentBlocks.map((block) => {
101 const toolCall = block.toolCall
102 const result = toolCall?.result
103 if (!toolCall || !result || typeof result !== 'object' || !('output' in result)) return block
104 changed = true
105 const strippedResult: { success: boolean; error?: string } = { success: result.success }
106 if (result.error !== undefined) strippedResult.error = result.error
107 return { ...block, toolCall: { ...toolCall, result: strippedResult } }
108 })
109 return changed ? { ...message, contentBlocks } : message
110}
111
112// ---------------------------------------------------------------------------
113// Write: OrchestratorResult → PersistedMessage

Callers 3

toRowFunction · 0.90
loadCopilotChatMessagesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected