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

Function onElicitation

packages/hosts/mcp/src/tool-server.ts:2004–2019  ·  view source on GitHub ↗
(ctx)

Source from the content-addressed store, hash-verified

2002 // instead of as "declined by the user", which nobody did.
2003 let unanswerable: ElicitationRequest | undefined;
2004 const onElicitation: ElicitationHandler = (ctx) => {
2005 // Every invoke is advertised as destructive, so the client's native
2006 // approval covers the selected ID and arguments, even if policy changed.
2007 // Tool-raised prompts still require their own response below.
2008 if (ctx.source === "policy") {
2009 return Effect.succeed({ action: "accept" as const, content: {} });
2010 }
2011 // Anything the tool itself asked for goes to the client natively
2012 // when it can take it; the native bridge already turns a URL
2013 // request into a form for form-only clients.
2014 if (supportsForm || (supportsUrl && Predicate.isTagged(ctx.request, "UrlElicitation"))) {
2015 return native(ctx);
2016 }
2017 unanswerable = ctx.request;
2018 return Effect.succeed({ action: "decline" as const });
2019 };
2020 const outcome = yield* engine.execute(passthroughCallCode(address, args), {
2021 onElicitation,
2022 });

Callers 2

makeElicitingEngineFunction · 0.85

Calls

no outgoing calls

Tested by 1

makeElicitingEngineFunction · 0.68