MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / processCell

Function processCell

source code/utils/notebook.ts:85–119  ·  view source on GitHub ↗
(
  cell: NotebookCell,
  index: number,
  codeLanguage: string,
  includeLargeOutputs: boolean,
)

Source from the content-addressed store, hash-verified

83}
84
85function processCell(
86 cell: NotebookCell,
87 index: number,
88 codeLanguage: string,
89 includeLargeOutputs: boolean,
90): NotebookCellSource {
91 const cellId = cell.id ?? `cell-${index}`
92 const cellData: NotebookCellSource = {
93 cellType: cell.cell_type,
94 source: Array.isArray(cell.source) ? cell.source.join('') : cell.source,
95 execution_count:
96 cell.cell_type === 'code' ? cell.execution_count || undefined : undefined,
97 cell_id: cellId,
98 }
99 // Avoid giving text cells the code language.
100 if (cell.cell_type === 'code') {
101 cellData.language = codeLanguage
102 }
103
104 if (cell.cell_type === 'code' && cell.outputs?.length) {
105 const outputs = cell.outputs.map(processOutput)
106 if (!includeLargeOutputs && isLargeOutputs(outputs)) {
107 cellData.outputs = [
108 {
109 output_type: 'stream',
110 text: `Outputs are too large to include. Use ${BASH_TOOL_NAME} with: cat <notebook_path> | jq '.cells[${index}].outputs'`,
111 },
112 ]
113 } else {
114 cellData.outputs = outputs
115 }
116 }
117
118 return cellData
119}
120
121function cellContentToToolResult(cell: NotebookCellSource): TextBlockParam {
122 const metadata = []

Callers 1

readNotebookFunction · 0.85

Calls 1

isLargeOutputsFunction · 0.85

Tested by

no test coverage detected