File size: 22,546 Bytes
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
31e8457
689aa9f
31e8457
 
 
689aa9f
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
31e8457
 
 
 
 
689aa9f
 
 
 
 
 
 
 
31e8457
689aa9f
31e8457
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31e8457
689aa9f
31e8457
 
 
 
 
 
 
689aa9f
 
 
31e8457
 
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
31e8457
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
689aa9f
31e8457
 
689aa9f
31e8457
 
 
689aa9f
31e8457
 
689aa9f
31e8457
 
 
689aa9f
 
 
 
31e8457
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
31e8457
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
689aa9f
 
 
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
689aa9f
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
 
 
 
 
689aa9f
 
 
 
 
 
 
31e8457
 
689aa9f
31e8457
 
 
 
 
 
689aa9f
31e8457
 
689aa9f
31e8457
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
import * as Context from "../../Context.ts";
import * as Effect from "../../Effect.ts";
import * as Layer from "../../Layer.ts";
import * as Queue from "../../Queue.ts";
import * as Schema from "../../Schema.ts";
import type { Stdio } from "../../Stdio.ts";
import * as HttpRouter from "../http/HttpRouter.ts";
import * as RpcClient from "../rpc/RpcClient.ts";
import type * as RpcGroup from "../rpc/RpcGroup.ts";
import * as RpcMessage from "../rpc/RpcMessage.ts";
import * as RpcServer from "../rpc/RpcServer.ts";
import { CallToolResult, CompleteResult, ElicitationDeclined, GetPromptResult, InternalError, InvalidParams, McpServerClient, Prompt, Resource, ResourceTemplate, ServerNotificationRpcs, Tool as McpTool } from "./McpSchema.ts";
import type { CallTool, ClientCapabilities, Complete, GetPrompt, Param, PromptMessage, ReadResourceResult } from "./McpSchema.ts";
import * as Tool from "./Tool.ts";
import type * as Toolkit from "./Toolkit.ts";
declare const McpServer_base: Context.ServiceClass<McpServer, "effect/ai/McpServer", {
    readonly notifications: RpcClient.RpcClient<RpcGroup.Rpcs<typeof ServerNotificationRpcs>>;
    readonly notificationsQueue: Queue.Dequeue<RpcMessage.Request<any>>;
    readonly initializedClients: Set<number>;
    readonly tools: ReadonlyArray<{
        readonly tool: McpTool;
        readonly annotations: Context.Context<never>;
    }>;
    readonly addTool: (options: {
        readonly tool: McpTool;
        readonly annotations: Context.Context<never>;
        readonly handle: (payload: any) => Effect.Effect<CallToolResult, never, McpServerClient>;
    }) => Effect.Effect<void>;
    readonly callTool: (requests: typeof CallTool.payloadSchema.Type) => Effect.Effect<CallToolResult, InternalError | InvalidParams, McpServerClient>;
    readonly resources: ReadonlyArray<{
        readonly resource: Resource;
        readonly annotations: Context.Context<never>;
    }>;
    readonly addResource: (options: {
        readonly resource: Resource;
        readonly annotations: Context.Context<never>;
        readonly handle: Effect.Effect<typeof ReadResourceResult.Type, InternalError, McpServerClient>;
    }) => Effect.Effect<void>;
    readonly resourceTemplates: ReadonlyArray<{
        readonly template: ResourceTemplate;
        readonly annotations: Context.Context<never>;
    }>;
    readonly addResourceTemplate: (options: {
        readonly template: ResourceTemplate;
        readonly annotations: Context.Context<never>;
        readonly routerPath: string;
        readonly completions: Record<string, (input: string) => Effect.Effect<CompleteResult, InternalError>>;
        readonly handle: (uri: string, params: Array<string>) => Effect.Effect<typeof ReadResourceResult.Type, InvalidParams | InternalError, McpServerClient>;
    }) => Effect.Effect<void>;
    readonly findResource: (uri: string) => Effect.Effect<typeof ReadResourceResult.Type, InvalidParams | InternalError, McpServerClient>;
    readonly prompts: ReadonlyArray<{
        readonly prompt: Prompt;
        readonly annotations: Context.Context<never>;
    }>;
    readonly addPrompt: (options: {
        readonly prompt: Prompt;
        readonly annotations: Context.Context<never>;
        readonly completions: Record<string, (input: string) => Effect.Effect<CompleteResult, InternalError, McpServerClient>>;
        readonly handle: (params: Record<string, string>) => Effect.Effect<GetPromptResult, InternalError | InvalidParams, McpServerClient>;
    }) => Effect.Effect<void>;
    readonly getPromptResult: (request: typeof GetPrompt.payloadSchema.Type) => Effect.Effect<GetPromptResult, InternalError | InvalidParams, McpServerClient>;
    readonly completion: (complete: typeof Complete.payloadSchema.Type) => Effect.Effect<CompleteResult, InternalError, McpServerClient>;
}>;
/**
 * Service that stores and serves an MCP server's registered tools, resources,
 * prompts, completions, and outgoing notifications.
 *
 * **Details**
 *
 * Handlers use this service to register capabilities and resolve incoming MCP
 * requests.
 *
 * @category server
 * @since 4.0.0
 */
export declare class McpServer extends McpServer_base {
    /**
     * Builds an MCP server service from registered tools, prompts, resources, and completions.
     *
     * @since 4.0.0
     */
    static readonly make: Effect.Effect<{
        readonly notifications: RpcClient.RpcClient<RpcGroup.Rpcs<typeof ServerNotificationRpcs>>;
        readonly notificationsQueue: Queue.Dequeue<RpcMessage.Request<any>>;
        readonly initializedClients: Set<number>;
        readonly tools: ReadonlyArray<{
            readonly tool: McpTool;
            readonly annotations: Context.Context<never>;
        }>;
        readonly addTool: (options: {
            readonly tool: McpTool;
            readonly annotations: Context.Context<never>;
            readonly handle: (payload: any) => Effect.Effect<CallToolResult, never, McpServerClient>;
        }) => Effect.Effect<void>;
        readonly callTool: (requests: typeof CallTool.payloadSchema.Type) => Effect.Effect<CallToolResult, InternalError | InvalidParams, McpServerClient>;
        readonly resources: ReadonlyArray<{
            readonly resource: Resource;
            readonly annotations: Context.Context<never>;
        }>;
        readonly addResource: (options: {
            readonly resource: Resource;
            readonly annotations: Context.Context<never>;
            readonly handle: Effect.Effect<typeof ReadResourceResult.Type, InternalError, McpServerClient>;
        }) => Effect.Effect<void>;
        readonly resourceTemplates: ReadonlyArray<{
            readonly template: ResourceTemplate;
            readonly annotations: Context.Context<never>;
        }>;
        readonly addResourceTemplate: (options: {
            readonly template: ResourceTemplate;
            readonly annotations: Context.Context<never>;
            readonly routerPath: string;
            readonly completions: Record<string, (input: string) => Effect.Effect<CompleteResult, InternalError>>;
            readonly handle: (uri: string, params: Array<string>) => Effect.Effect<typeof ReadResourceResult.Type, InvalidParams | InternalError, McpServerClient>;
        }) => Effect.Effect<void>;
        readonly findResource: (uri: string) => Effect.Effect<typeof ReadResourceResult.Type, InvalidParams | InternalError, McpServerClient>;
        readonly prompts: ReadonlyArray<{
            readonly prompt: Prompt;
            readonly annotations: Context.Context<never>;
        }>;
        readonly addPrompt: (options: {
            readonly prompt: Prompt;
            readonly annotations: Context.Context<never>;
            readonly completions: Record<string, (input: string) => Effect.Effect<CompleteResult, InternalError, McpServerClient>>;
            readonly handle: (params: Record<string, string>) => Effect.Effect<GetPromptResult, InternalError | InvalidParams, McpServerClient>;
        }) => Effect.Effect<void>;
        readonly getPromptResult: (request: typeof GetPrompt.payloadSchema.Type) => Effect.Effect<GetPromptResult, InternalError | InvalidParams, McpServerClient>;
        readonly completion: (complete: typeof Complete.payloadSchema.Type) => Effect.Effect<CompleteResult, InternalError, McpServerClient>;
    }, never, import("../../Scope.ts").Scope>;
    /**
     * Layer that provides the MCP server and client services.
     *
     * @since 4.0.0
     */
    static readonly layer: Layer.Layer<McpServer | McpServerClient>;
}
/**
 * Runs an MCP server over the current `RpcServer.Protocol`.
 *
 * **Details**
 *
 * The server performs initialization and session handling, serves registered
 * tools, resources, and prompts, and forwards queued server notifications to
 * initialized clients.
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const run: (options: {
    readonly name: string;
    readonly version: string;
    readonly extensions?: Record<`${string}/${string}`, unknown> | undefined;
}) => Effect.Effect<never, never, McpServer | RpcServer.Protocol>;
/**
 * Creates a layer that starts an MCP server over an existing
 * `RpcServer.Protocol` and provides the `McpServer` and `McpServerClient`
 * services.
 *
 * **When to use**
 *
 * Use when you already have a custom or externally provided
 * `RpcServer.Protocol` and want to start an MCP server as part of a layer
 * graph.
 *
 * **Details**
 *
 * The returned layer forks `run(options)` in the layer scope and merges
 * `McpServer.layer`, so registration layers can use the `McpServer` service
 * while the server is running.
 *
 * **Gotchas**
 *
 * Unlike `layerStdio` and `layerHttp`, this layer does not install a concrete
 * transport. The surrounding layer graph must provide `RpcServer.Protocol`.
 *
 * @see {@link run} for the effect form used by this layer
 * @see {@link layerStdio} for a stdio-backed layer that installs the MCP protocol and NDJSON-RPC serialization
 * @see {@link layerHttp} for an HTTP-backed layer that registers with `HttpRouter` and installs JSON-RPC serialization
 *
 * @category layers
 * @since 4.0.0
 */
export declare const layer: (options: {
    readonly name: string;
    readonly version: string;
    readonly extensions?: Record<`${string}/${string}`, unknown> | undefined;
}) => Layer.Layer<McpServer | McpServerClient, never, RpcServer.Protocol>;
/**
 * Runs the McpServer, using stdio for input and output.
 *
 * **Example** (Running an MCP server over stdio)
 *
 * ```ts
 * import { Effect, Layer, Logger, Schema } from "effect"
 * import { NodeRuntime, NodeStdio } from "@effect/platform-node"
 * import { McpSchema, McpServer } from "effect/unstable/ai"
 *
 * const idParam = McpSchema.param("id", Schema.Number)
 *
 * // Define a resource template for a README file
 * const ReadmeTemplate = McpServer.resource`file://readme/${idParam}`({
 *   name: "README Template",
 *   // You can add auto-completion for the ID parameter
 *   completion: {
 *     id: (_) => Effect.succeed([1, 2, 3, 4, 5])
 *   },
 *   content: Effect.fn(function*(_uri, id) {
 *     return `# MCP Server Demo - ID: ${id}`
 *   })
 * })
 *
 * // Define a test prompt with parameters
 * const TestPrompt = McpServer.prompt({
 *   name: "Test Prompt",
 *   description: "A test prompt to demonstrate MCP server capabilities",
 *   parameters: {
 *     flightNumber: Schema.String
 *   },
 *   completion: {
 *     flightNumber: () => Effect.succeed(["FL123", "FL456", "FL789"])
 *   },
 *   content: ({ flightNumber }) =>
 *     Effect.succeed(`Get the booking details for flight number: ${flightNumber}`)
 * })
 *
 * // Merge all the resources and prompts into a single server layer
 * const ServerLayer = Layer.mergeAll(
 *   ReadmeTemplate,
 *   TestPrompt
 * ).pipe(
 *   // Provide the MCP server implementation
 *   Layer.provide(McpServer.layerStdio({
 *     name: "Demo Server",
 *     version: "1.0.0",
 *   })),
 *   Layer.provide(NodeStdio.layer),
 *   Layer.provide(Layer.succeed(Logger.LogToStderr)(true))
 * )
 *
 * Layer.launch(ServerLayer).pipe(NodeRuntime.runMain)
 * ```
 *
 * @category layers
 * @since 4.0.0
 */
export declare const layerStdio: (options: {
    readonly name: string;
    readonly version: string;
    readonly extensions?: Record<`${string}/${string}`, unknown> | undefined;
}) => Layer.Layer<McpServer | McpServerClient, never, Stdio>;
/**
 * Registers an HTTP POST JSON-RPC route at `options.path` on the current
 * `HttpRouter`.
 *
 * **When to use**
 *
 * Use to expose an MCP server through an existing `HttpRouter`.
 *
 * **Details**
 *
 * This layer composes `layer(options)`, `RpcServer.layerProtocolHttp(options)`,
 * and `RpcSerialization.layerJsonRpc()`.
 *
 * @see {@link layerStdio} for exposing the server over stdio
 * @see {@link layer} for the base MCP server layer without a transport protocol
 *
 * @category layers
 * @since 4.0.0
 */
export declare const layerHttp: (options: {
    readonly name: string;
    readonly version: string;
    readonly path: HttpRouter.PathInput;
    readonly extensions?: Record<`${string}/${string}`, unknown> | undefined;
}) => Layer.Layer<McpServer | McpServerClient, never, HttpRouter.HttpRouter>;
/**
 * Registers a `Toolkit` with the `McpServer`.
 *
 * @category tools
 * @since 4.0.0
 */
export declare const registerToolkit: <Tools extends Record<string, Tool.Any>>(toolkit: Toolkit.Toolkit<Tools>) => Effect.Effect<void, never, McpServer | Tool.HandlersFor<Tools> | Exclude<Tool.HandlerServices<Tools>, McpServerClient>>;
/**
 * Registers an `AiToolkit` with the `McpServer`.
 *
 * @category tools
 * @since 4.0.0
 */
export declare const toolkit: <Tools extends Record<string, Tool.Any>>(toolkit: Toolkit.Toolkit<Tools>) => Layer.Layer<never, never, Tool.HandlersFor<Tools> | Exclude<Tool.HandlerServices<Tools>, McpServerClient>>;
/**
 * Utility type that validates a completion-handler record against the allowed
 * parameter keys.
 *
 * @category utility types
 * @since 4.0.0
 */
export type ValidateCompletions<Completions, Keys extends string> = Completions & {
    readonly [K in keyof Completions]: K extends Keys ? (input: string) => any : never;
};
/**
 * Completion-handler map for a resource URI template.
 *
 * **Details**
 *
 * Each schema interpolation contributes a parameter key, using an explicit
 * `Param` name when present or `paramN` otherwise, and each handler returns
 * candidate values for that parameter.
 *
 * @category models
 * @since 4.0.0
 */
export type ResourceCompletions<Schemas extends ReadonlyArray<Schema.Top>> = {
    readonly [K in Extract<keyof Schemas, `${number}`> as Schemas[K] extends Param<infer Id, infer _S> ? Id : `param${K}`]: (input: string) => Effect.Effect<Array<Schemas[K]["Type"]>, any, any>;
};
/**
 * Registers an MCP resource or resource template from an Effect program.
 *
 * **When to use**
 *
 * Use when you are already inside an Effect program with an `McpServer`
 * service and need to add a concrete resource or URI-template resource
 * directly.
 *
 * @see {@link resource} for the layer-based resource registration wrapper
 *
 * @category resources
 * @since 4.0.0
 */
export declare const registerResource: {
    /**
     * Registers an MCP resource or resource template from an Effect program.
     *
     * **When to use**
     *
     * Use when you are already inside an Effect program with an `McpServer`
     * service and need to add a concrete resource or URI-template resource
     * directly.
     *
     * @see {@link resource} for the layer-based resource registration wrapper
     *
     * @category resources
     * @since 4.0.0
     */
    <E, R>(options: {
        readonly uri: string;
        readonly name: string;
        readonly description?: string | undefined;
        readonly mimeType?: string | undefined;
        readonly audience?: ReadonlyArray<"user" | "assistant"> | undefined;
        readonly priority?: number | undefined;
        readonly content: Effect.Effect<typeof ReadResourceResult.Type | string | Uint8Array, E, R>;
        readonly annotations?: Context.Context<never> | undefined;
    }): Effect.Effect<void, never, Exclude<R, McpServerClient> | McpServer>;
    /**
     * Registers an MCP resource or resource template from an Effect program.
     *
     * **When to use**
     *
     * Use when you are already inside an Effect program with an `McpServer`
     * service and need to add a concrete resource or URI-template resource
     * directly.
     *
     * @see {@link resource} for the layer-based resource registration wrapper
     *
     * @category resources
     * @since 4.0.0
     */
    <const Schemas extends ReadonlyArray<Schema.Top>>(segments: TemplateStringsArray, ...schemas: Schemas): <E, R, const Completions extends Partial<ResourceCompletions<Schemas>> = {}>(options: {
        readonly name: string;
        readonly description?: string | undefined;
        readonly mimeType?: string | undefined;
        readonly audience?: ReadonlyArray<"user" | "assistant"> | undefined;
        readonly priority?: number | undefined;
        readonly completion?: ValidateCompletions<Completions, keyof ResourceCompletions<Schemas>> | undefined;
        readonly content: (uri: string, ...params: {
            readonly [K in keyof Schemas]: Schemas[K]["Type"];
        }) => Effect.Effect<typeof ReadResourceResult.Type | string | Uint8Array, E, R>;
        readonly annotations?: Context.Context<never> | undefined;
    }) => Effect.Effect<void, never, Exclude<Schemas[number]["DecodingServices"] | Schemas[number]["EncodingServices"] | R | (Completions[keyof Completions] extends (input: string) => infer Ret ? Ret extends Effect.Effect<infer _A, infer _E, infer _R> ? _R : never : never), McpServerClient> | McpServer>;
};
/**
 * Creates a layer that registers an MCP resource or resource template.
 *
 * **When to use**
 *
 * Use to compose resource registration into an MCP server layer.
 *
 * @see {@link registerResource} for the Effect-level resource registration API
 *
 * @category resources
 * @since 4.0.0
 */
export declare const resource: {
    /**
     * Creates a layer that registers an MCP resource or resource template.
     *
     * **When to use**
     *
     * Use to compose resource registration into an MCP server layer.
     *
     * @see {@link registerResource} for the Effect-level resource registration API
     *
     * @category resources
     * @since 4.0.0
     */
    <E, R>(options: {
        readonly uri: string;
        readonly name: string;
        readonly description?: string | undefined;
        readonly mimeType?: string | undefined;
        readonly audience?: ReadonlyArray<"user" | "assistant"> | undefined;
        readonly priority?: number | undefined;
        readonly content: Effect.Effect<typeof ReadResourceResult.Type | string | Uint8Array, E, R>;
    }): Layer.Layer<never, never, Exclude<R, McpServerClient>>;
    /**
     * Creates a layer that registers an MCP resource or resource template.
     *
     * **When to use**
     *
     * Use to compose resource registration into an MCP server layer.
     *
     * @see {@link registerResource} for the Effect-level resource registration API
     *
     * @category resources
     * @since 4.0.0
     */
    <const Schemas extends ReadonlyArray<Schema.Top>>(segments: TemplateStringsArray, ...schemas: Schemas): <E, R, const Completions extends Partial<ResourceCompletions<Schemas>> = {}>(options: {
        readonly name: string;
        readonly description?: string | undefined;
        readonly mimeType?: string | undefined;
        readonly audience?: ReadonlyArray<"user" | "assistant"> | undefined;
        readonly priority?: number | undefined;
        readonly completion?: ValidateCompletions<Completions, keyof ResourceCompletions<Schemas>> | undefined;
        readonly content: (uri: string, ...params: {
            readonly [K in keyof Schemas]: Schemas[K]["Type"];
        }) => Effect.Effect<typeof ReadResourceResult.Type | string | Uint8Array, E, R>;
    }) => Layer.Layer<never, never, Exclude<R | (Completions[keyof Completions] extends (input: string) => infer Ret ? Ret extends Effect.Effect<infer _A, infer _E, infer _R> ? _R : never : never), McpServerClient>>;
};
/**
 * Registers an MCP prompt from an Effect program.
 *
 * **When to use**
 *
 * Use when you are already inside an Effect program with an `McpServer`
 * service and need to add a prompt handler directly.
 *
 * **Details**
 *
 * Parameters are decoded with the supplied schema, completion handlers encode
 * per-parameter suggestions, and string prompt content is converted into a user
 * text message.
 *
 * @see {@link prompt} for the layer-based prompt registration wrapper
 *
 * @category prompts
 * @since 4.0.0
 */
export declare const registerPrompt: <E, R, Params extends Schema.Struct.Fields = {}, const Completions extends { readonly [K in keyof Params]?: (input: string) => Effect.Effect<Array<Params[K]>, any, any>; } = {}>(options: {
    readonly name: string;
    readonly description?: string | undefined;
    readonly parameters?: Params | undefined;
    readonly completion?: ValidateCompletions<Completions, Extract<keyof Params, string>> | undefined;
    readonly content: (params: Params) => Effect.Effect<Array<typeof PromptMessage.Type> | string, E, R>;
    readonly annotations?: Context.Context<never> | undefined;
}) => Effect.Effect<void, never, Exclude<Schema.Struct.DecodingServices<Params> | R, McpServerClient> | McpServer>;
/**
 * Creates a layer that registers an MCP prompt.
 *
 * **When to use**
 *
 * Use to compose prompt registration into an MCP server layer.
 *
 * **Details**
 *
 * Parameters are decoded with the supplied schema, completion handlers encode
 * per-parameter suggestions, and string prompt content is converted into a user
 * text message.
 *
 * @see {@link registerPrompt} for the Effect-level prompt registration API
 *
 * @category prompts
 * @since 4.0.0
 */
export declare const prompt: <E, R, Params extends Schema.Struct.Fields = {}, const Completions extends { readonly [K in keyof Params]?: (input: string) => Effect.Effect<Array<Params[K]["Type"]>, any, any>; } = {}>(options: {
    readonly name: string;
    readonly description?: string | undefined;
    readonly parameters?: Params | undefined;
    readonly completion?: ValidateCompletions<Completions, Extract<keyof Params, string>> | undefined;
    readonly content: (params: Schema.Struct.Type<Params>) => Effect.Effect<Array<typeof PromptMessage.Type> | string, E, R>;
    readonly annotations?: Context.Context<never> | undefined;
}) => Layer.Layer<never, never, Exclude<Schema.Struct.DecodingServices<Params> | R, McpServerClient>>;
/**
 * Collects structured input from the current MCP client and decodes the
 * accepted response with `schema`.
 *
 * **Details**
 *
 * Accepted content is decoded with the supplied schema, declined requests fail
 * with `ElicitationDeclined`, and canceled requests interrupt the effect.
 *
 * @category elicitation
 * @since 4.0.0
 */
export declare const elicit: <S extends Schema.Encoder<Record<string, unknown>, unknown>>(options: {
    readonly message: string;
    readonly schema: S;
}) => Effect.Effect<S["Type"], ElicitationDeclined, McpServerClient | S["DecodingServices"]>;
/**
 * Accesses the current client's capabilities.
 *
 * @category capabilities
 * @since 4.0.0
 */
export declare const clientCapabilities: Effect.Effect<ClientCapabilities, never, McpServerClient>;
export {};
//# sourceMappingURL=McpServer.d.ts.map