MCPcopy Index your code
hub / github.com/codeaashu/claude-code / processToolResultBlock

Function processToolResultBlock

src/utils/toolResultStorage.ts:205–226  ·  view source on GitHub ↗
(
  tool: {
    name: string
    maxResultSizeChars: number
    mapToolResultToToolResultBlockParam: (
      result: T,
      toolUseID: string,
    ) => ToolResultBlockParam
  },
  toolUseResult: T,
  toolUseID: string,
)

Source from the content-addressed store, hash-verified

203 * Maps the result to the API format and persists large results to disk.
204 */
205export async function processToolResultBlock<T>(
206 tool: {
207 name: string
208 maxResultSizeChars: number
209 mapToolResultToToolResultBlockParam: (
210 result: T,
211 toolUseID: string,
212 ) => ToolResultBlockParam
213 },
214 toolUseResult: T,
215 toolUseID: string,
216): Promise<ToolResultBlockParam> {
217 const toolResultBlock = tool.mapToolResultToToolResultBlockParam(
218 toolUseResult,
219 toolUseID,
220 )
221 return maybePersistLargeToolResult(
222 toolResultBlock,
223 tool.name,
224 getPersistenceThreshold(tool.name, tool.maxResultSizeChars),
225 )
226}
227
228/**
229 * Process a pre-mapped tool result block. Applies persistence for large results

Callers 3

processBashCommandFunction · 0.85
addToolResultFunction · 0.85

Calls 2

getPersistenceThresholdFunction · 0.85

Tested by

no test coverage detected