MCPcopy Index your code
hub / github.com/Effect-TS/effect / onFromClient

Method onFromClient

packages/ai/ai/src/McpServer.ts:171–195  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

169 const notifications = yield* RpcClient.makeNoSerialization(ServerNotificationRpcs, {
170 spanPrefix: "McpServer/Notifications",
171 onFromClient(options): Effect.Effect<void> {
172 const message = options.message
173 if (message._tag !== "Request") {
174 return Effect.void
175 }
176 if (message.tag.includes("list_changed")) {
177 if (!listChangedHandles.has(message.tag)) {
178 listChangedHandles.set(
179 message.tag,
180 setTimeout(() => {
181 notificationsMailbox.unsafeOffer(message)
182 listChangedHandles.delete(message.tag)
183 }, 0)
184 )
185 }
186 } else {
187 notificationsMailbox.unsafeOffer(message)
188 }
189 return notifications.write({
190 clientId: 0,
191 requestId: message.id,
192 _tag: "Exit",
193 exit: Exit.void as any
194 })
195 }
196 })
197
198 return McpServer.of({

Callers 4

onEffectRequestFunction · 0.80
RpcClient.tsFile · 0.80
sendInterruptFunction · 0.80
writeFunction · 0.80

Calls 3

setMethod · 0.65
unsafeOfferMethod · 0.65
writeMethod · 0.65

Tested by

no test coverage detected