MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / toolUseToText

Function toolUseToText

src/core/condense/index.ts:21–35  ·  view source on GitHub ↗
(block: Anthropic.Messages.ToolUseBlockParam)

Source from the content-addressed store, hash-verified

19 * This allows the conversation to be summarized without requiring the tools parameter.
20 */
21export function toolUseToText(block: Anthropic.Messages.ToolUseBlockParam): string {
22 let input: string
23 if (typeof block.input === "object" && block.input !== null) {
24 input = Object.entries(block.input)
25 .map(([key, value]) => {
26 const formattedValue =
27 typeof value === "object" && value !== null ? JSON.stringify(value, null, 2) : String(value)
28 return `${key}: ${formattedValue}`
29 })
30 .join("\n")
31 } else {
32 input = String(block.input)
33 }
34 return `[Tool Use: ${block.name}]\n${input}`
35}
36
37/**
38 * Converts a tool_result block to a text representation.

Callers 2

index.spec.tsFile · 0.90
convertToolBlocksToTextFunction · 0.85

Calls 2

entriesMethod · 0.80
StringInterface · 0.50

Tested by

no test coverage detected