MCPcopy Create free account
hub / github.com/freecodexyz/free-code / cellOutputToToolResult

Function cellOutputToToolResult

src/utils/notebook.ts:134–153  ·  view source on GitHub ↗
(output: NotebookCellSourceOutput)

Source from the content-addressed store, hash-verified

132}
133
134function cellOutputToToolResult(output: NotebookCellSourceOutput) {
135 const outputs: (TextBlockParam | ImageBlockParam)[] = []
136 if (output.text) {
137 outputs.push({
138 text: `\n${output.text}`,
139 type: 'text',
140 })
141 }
142 if (output.image) {
143 outputs.push({
144 type: 'image',
145 source: {
146 data: output.image.image_data,
147 media_type: output.image.media_type,
148 type: 'base64',
149 },
150 })
151 }
152 return outputs
153}
154
155function getToolResultFromCell(cell: NotebookCellSource) {
156 const contentResult = cellContentToToolResult(cell)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected