MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / buildElicit

Function buildElicit

packages/core/sdk/src/executor.ts:6246–6267  ·  view source on GitHub ↗
(
      address: ToolAddress,
      args: unknown,
      handler: ElicitationHandler,
    )

Source from the content-addressed store, hash-verified

6244 : defaultElicitationHandler;
6245
6246 const buildElicit = (
6247 address: ToolAddress,
6248 args: unknown,
6249 handler: ElicitationHandler,
6250 ): Elicit => {
6251 return (request: ElicitationRequest) =>
6252 Effect.gen(function* () {
6253 const response: ElicitationResponse = yield* handler({
6254 address,
6255 args,
6256 request,
6257 source: "tool",
6258 });
6259 if (response.action !== "accept") {
6260 return yield* new ElicitationDeclinedError({
6261 address,
6262 action: response.action,
6263 });
6264 }
6265 return response;
6266 });
6267 };
6268
6269 // The single source of truth for "will enforceApproval pause this call".
6270 // Read before pre-approval arg validation so the extra validation pass

Callers 2

executeFunction · 0.85
invokeWithFunction · 0.85

Calls 1

handlerFunction · 0.50

Tested by

no test coverage detected