MCPcopy
hub / github.com/anomalyco/opencode / toolSnapshot

Function toolSnapshot

packages/opencode/src/cli/cmd/run/tool.ts:1359–1371  ·  view source on GitHub ↗
(commit: StreamCommit, raw: string)

Source from the content-addressed store, hash-verified

1357}
1358
1359export function toolSnapshot(commit: StreamCommit, raw: string): ToolSnapshot | undefined {
1360 const ctx = toolFrame(commit, raw)
1361 const draw = rule(ctx.name)?.snap
1362 if (!draw) {
1363 return undefined
1364 }
1365
1366 try {
1367 return draw(props(ctx))
1368 } catch {
1369 return undefined
1370 }
1371}
1372
1373function textBody(content: string): RunEntryBody | undefined {
1374 if (!content) {

Callers 1

structuredBodyFunction · 0.85

Calls 4

toolFrameFunction · 0.85
ruleFunction · 0.85
propsFunction · 0.85
drawFunction · 0.70

Tested by

no test coverage detected