MCPcopy Index your code
hub / github.com/anomalyco/opencode / execute

Function execute

packages/opencode/src/session/tools.ts:98–128  ·  view source on GitHub ↗
(args, options)

Source from the content-addressed store, hash-verified

96 description: item.description,
97 inputSchema: jsonSchema(schema),
98 execute(args, options) {
99 return run.promise(
100 Effect.gen(function* () {
101 const ctx = context(args, options)
102 yield* plugin.trigger(
103 "tool.execute.before",
104 { tool: item.id, sessionID: ctx.sessionID, callID: ctx.callID },
105 { args },
106 )
107 const result = yield* item.execute(args, ctx)
108 const output = {
109 ...result,
110 attachments: result.attachments?.map((attachment) => ({
111 ...attachment,
112 id: PartID.ascending(),
113 sessionID: ctx.sessionID,
114 messageID: input.processor.message.id,
115 })),
116 }
117 yield* plugin.trigger(
118 "tool.execute.after",
119 { tool: item.id, sessionID: ctx.sessionID, callID: ctx.callID, args },
120 output,
121 )
122 if (options.abortSignal?.aborted) {
123 yield* input.processor.completeToolCall(options.toolCallId, output)
124 }
125 return output
126 }),
127 )
128 },
129 })
130 }
131

Callers 1

tools.tsFile · 0.70

Calls 9

toRecordFunction · 0.85
parseReadMcpResourceArgsFunction · 0.85
formatMcpResourceContentFunction · 0.85
readResourceMethod · 0.80
contextFunction · 0.70
executeMethod · 0.65
getServerCapabilitiesMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected