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

Function withTool

packages/core/test/tool-write.test.ts:63–89  ·  view source on GitHub ↗
(directory: string, body: (registry: ToolRegistry.Interface) => Effect.Effect<A, E, R>)

Source from the content-addressed store, hash-verified

61).pipe(Layer.provide(LayerNode.compile(FSUtil.node)))
62
63const withTool = <A, E, R>(directory: string, body: (registry: ToolRegistry.Interface) => Effect.Effect<A, E, R>) => {
64 const activeLocation = Layer.succeed(
65 Location.Service,
66 Location.Service.of(location({ directory: AbsolutePath.make(directory) })),
67 )
68 return Effect.gen(function* () {
69 return yield* body(yield* ToolRegistry.Service)
70 }).pipe(
71 Effect.provide(
72 AppNodeBuilder.build(
73 LayerNode.group([
74 ToolRegistry.node,
75 ToolRegistry.toolsNode,
76 LocationMutation.node,
77 FileMutation.node,
78 WriteTool.node,
79 ]),
80 [
81 [FSUtil.node, filesystem],
82 [Location.node, activeLocation],
83 [PermissionV2.node, permission],
84 [ToolOutputStore.node, ToolOutputStore.nodeWithoutConfig],
85 ],
86 ),
87 ),
88 )
89}
90
91const call = (input: typeof WriteTool.Input.Type, id = "call-write") => ({
92 sessionID,

Callers 1

tool-write.test.tsFile · 0.70

Calls 3

locationFunction · 0.90
bodyFunction · 0.50
makeMethod · 0.45

Tested by

no test coverage detected