McpServer unstable
Builds Model Context Protocol (MCP) servers with Effect.
The McpServer service stores the tools, resources, resource templates,
prompts, completions, and outgoing notifications exposed by a server. This
module also includes the server runner, custom protocol,
stdio, and HTTP layers, registration helpers, and APIs that let handlers ask
the connected client for structured input or read its advertised
capabilities.
Accessors
clientCapabilities
unstableAccesses the current client's capabilities.
Signature
declare const clientCapabilities: Effect.Effect<ClientCapabilities, never, McpRequestContext>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.
Signature
declare const elicit: <S extends Schema.ConstraintEncoder<Record<string, unknown>, unknown>>(options: { readonly message: string; readonly schema: S;}) => Effect.Effect<S["Type"], ElicitationDeclined, McpServerClient | S["DecodingServices"]>Handlers
registerPrompt
unstableRegisters an MCP prompt from an Effect program.
Details
Decodes parameters and encodes completion suggestions using their schemas. String content becomes a user text message.
See
- prompt for the layer-based prompt registration wrapper
Signature
declare function registerPrompt<E, R, Params extends Fields = {}, Completions extends { [K in string | number | symbol]: (input: string, context: { readonly arguments?: { [key: string]: string; };} | undefined) => Effect<Array<Params[K]["Type"]>, any, any> } = {}>(options: { readonly annotations?: Context<never>; readonly completion?: ValidateCompletions<Completions, Extract<keyof Params, string>>; readonly content: (params: View<Params>) => Effect<string | Array<PromptMessage>, E, R>; readonly description?: string; readonly name: string; readonly parameters?: Params; readonly title?: string;}): Effect<void, never, McpServer | Exclude<R, McpRequestContext> | Exclude<DecodingServices<Params>, McpRequestContext> | Exclude<Params[Extract<keyof Completions, keyof Params>]["EncodingServices"], McpRequestContext> | Exclude<CompletionServices<Completions>, McpRequestContext>>registerResource
unstableRegisters an MCP resource or resource template from an Effect program.
See
- resource for the layer-based resource registration wrapper
Signature
declare const registerResource: { <E, R>(options: { readonly annotations?: Context.Context<never>; readonly audience?: ReadonlyArray<"user" | "assistant">; readonly content: Effect.Effect<ReadResourceResult | string | Uint8Array, E, R>; readonly description?: string; readonly mimeType?: string; readonly name: string; readonly priority?: number; readonly uri: string; }): Effect<void, never, McpServer | Exclude<R, McpRequestContext>>; <Schemas extends readonly Array<Constraint>>(segments: TemplateStringsArray, ...schemas: Schemas): <E, R, Completions extends Partial<ResourceCompletions<Schemas>> = {}>(options: { readonly annotations?: Context.Context<never>; readonly audience?: ReadonlyArray<"user" | "assistant">; readonly completion?: ValidateCompletions<Completions, keyof ResourceCompletions<Schemas>>; readonly content: (uri: string, ...params: { [K in keyof Schemas]: Schemas[K]["Type"] }) => Effect.Effect<ReadResourceResult | string | Uint8Array, E, R>; readonly description?: string; readonly mimeType?: string; readonly name: string; readonly priority?: number; }) => Effect<void, never, McpServer | Exclude<R, McpRequestContext> | Exclude<Schemas[number]["DecodingServices"], McpRequestContext> | Exclude<Schemas[number]["EncodingServices"], McpRequestContext> | Exclude<CompletionServices<Completions>, McpRequestContext>>;}registerToolkit
unstableRegisters a Toolkit with the McpServer.
Signature
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[keyof Tools]>, McpRequestContext>>Layers
Creates a layer that starts an MCP server over an existing
RpcServer.Protocol and provides McpServer. Request handlers receive
McpRequestContext; initialized legacy requests additionally receive
McpServerClient.
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
- run for the effect form used by this layer
- layerStdio for a stdio-backed layer that installs the MCP protocol and NDJSON-RPC serialization
- layerHttp for an HTTP-backed layer that registers with
HttpRouterand installs JSON-RPC serialization
Signature
declare function layer(options: { readonly description?: string; readonly extensions?: { [key: `${string}/${string}`]: Json; }; readonly icons?: readonly Array<Icon>; readonly instructions?: string; readonly name: string; readonly protocols: readonly [ProtocolAdapter<ProtocolVersion, RuntimeDescriptor>, ProtocolAdapter<ProtocolVersion, RuntimeDescriptor>]; readonly version: string; readonly websiteUrl?: string;}): Layer<McpServerClient | McpServer, IllegalArgumentError, Protocol>Registers a Streamable HTTP MCP endpoint at options.path.
When to use
Use to expose an MCP server through an existing HttpRouter.
Details
POST serves JSON-RPC and accepted notification-only requests return 202.
Header mismatches, unsupported protocol versions, and invalid session-header
usage return JSON-RPC errors with status 400.
Unknown modern RPC methods return a JSON-RPC method-not-found error with
status 404. Session requests without MCP-Protocol-Version use the version
negotiated at initialization. Unsupported HTTP methods return 405.
Requests with an Origin header are rejected unless the exact origin
appears in allowedOrigins; Origin-less non-browser clients
remain valid. The surrounding HTTP server remains responsible for binding
to an appropriate interface and installing authentication.
With allowSessionTermination, a DELETE carrying Mcp-Session-Id ends that
session with 204 and interrupts its in-flight requests; later requests with
that id get 404. DELETE validates the session and MCP-Protocol-Version
headers like POST. Without the option, or when only sessionless revisions
such as v2026_07_28 are configured, DELETE returns 405. Any caller
holding a session id can end that session, so authenticate requests in the
surrounding router.
Set allowSubscriptions: false to disable v2026_07_28 subscriptions.
Discovery advertises listChanged: false, and subscriptions/listen returns
Method not found. Request-scoped progress and logs, legacy protocols, and
default subscription behavior are unchanged.
The layer runs one long-lived MCP server that every POST shares. For
serverless hosts where execution must belong to each request, use
layerHttpRequestScoped instead.
layerHttp always implements the single-endpoint Streamable HTTP topology.
Using v2024_11_05 here is a custom compatibility transport for that
revision's schema. It does not implement the historical two-endpoint
HTTP+SSE transport, GET SSE, event resumption, or session expiry.
Gotchas
This layer starts a scoped server fiber. For sharing it across Cloudflare
Workers requests, see HttpRouter.toWebHandler for setup and limitations.
See
- layerStdio for exposing the server over stdio
- layer for the base MCP server layer without a transport protocol
Signature
declare function layerHttp(options: { readonly allowedOrigins?: readonly Array<string>; readonly allowSessionTermination?: boolean; readonly allowSubscriptions?: boolean; readonly description?: string; readonly extensions?: { [key: `${string}/${string}`]: Json; }; readonly icons?: readonly Array<Icon>; readonly instructions?: string; readonly name: string; readonly path: PathInput; readonly protocols: readonly [ProtocolAdapter<ProtocolVersion, RuntimeDescriptor>, ProtocolAdapter<ProtocolVersion, RuntimeDescriptor>]; readonly version: string; readonly websiteUrl?: string;}): Layer<McpServerClient | McpServer, IllegalArgumentError, HttpRouter>layerHttpRequestScoped
unstableRegisters a request-scoped Streamable HTTP MCP endpoint at options.path.
When to use
Use when serving on serverless hosts such as Cloudflare Workers, where execution must belong to the HTTP request rather than a shared long-lived server.
Details
Each POST runs its own server in the request scope, with no background
fiber, timer, or queue consumer left after the response body completes.
Only sessionless protocols such as v2026_07_28 are accepted. Tools,
resources, prompts, completions, multi round-trip input requests, and the
request's own progress and log notifications are supported. Legacy reverse
requests through McpServer.elicit are not available.
Discovery advertises listChanged: false, subscriptions/listen returns
Method not found, and DELETE returns 405. Request-scoped clients receive
no broadcast notifications such as list changes. Those still reach clients
of a layerHttp endpoint sharing the same McpServer, and are dropped when
no such endpoint exists. Use layerHttp on a long-lived host for sessions,
subscriptions, or legacy reverse requests.
HTTP admission, origin checks, and JSON-RPC errors follow layerHttp.
Configuring a sessionful protocol through an untyped caller fails layer
construction with IllegalArgumentError.
See
- layerHttp for the long-lived HTTP transport and HTTP admission policy
Signature
declare function layerHttpRequestScoped(options: { readonly allowedOrigins?: readonly Array<string>; readonly description?: string; readonly extensions?: { [key: `${string}/${string}`]: Json; }; readonly icons?: readonly Array<Icon>; readonly instructions?: string; readonly name: string; readonly path: PathInput; readonly protocols: readonly [ProtocolAdapter<ProtocolVersion, StatelessRuntimeDescriptor>, ProtocolAdapter<ProtocolVersion, StatelessRuntimeDescriptor>]; readonly version: string; readonly websiteUrl?: string;}): Layer<McpServerClient | McpServer, IllegalArgumentError, HttpRouter>layerStdio
unstableCreates a layer that runs an MCP server over standard input and output.
When to use
Use when an MCP client launches the server as a subprocess and communicates through newline-delimited JSON-RPC messages.
Details
The selected protocol adapter controls the dated RPC schemas and JSON-RPC
batch policy. The layer provides McpServer, supplies request-scoped
McpRequestContext and legacy McpServerClient services to handlers, and
requires Stdio.
See
Signature
declare function layerStdio(options: { readonly description?: string; readonly extensions?: { [key: `${string}/${string}`]: Json; }; readonly icons?: readonly Array<Icon>; readonly instructions?: string; readonly name: string; readonly protocols: readonly [ProtocolAdapter<ProtocolVersion, RuntimeDescriptor>, ProtocolAdapter<ProtocolVersion, RuntimeDescriptor>]; readonly version: string; readonly websiteUrl?: string;}): Layer<McpServerClient | McpServer, IllegalArgumentError, Stdio>Creates a layer that registers an MCP prompt.
See
- registerPrompt for the Effect-level prompt registration API
Signature
declare function prompt<E, R, Params extends Fields = {}, Completions extends { [K in string | number | symbol]: (input: string, context: { readonly arguments?: { [key: string]: string; };} | undefined) => Effect<Array<Params[K]["Type"]>, any, any> } = {}>(options: { readonly annotations?: Context<never>; readonly completion?: ValidateCompletions<Completions, Extract<keyof Params, string>>; readonly content: (params: View<Params>) => Effect<string | Array<PromptMessage>, E, R>; readonly description?: string; readonly name: string; readonly parameters?: Params; readonly title?: string;}): Layer<never, never, Exclude<R, McpRequestContext> | Exclude<DecodingServices<Params>, McpRequestContext> | Exclude<Params[Extract<keyof Completions, keyof Params>]["EncodingServices"], McpRequestContext> | Exclude<CompletionServices<Completions>, McpRequestContext>>Creates a layer that registers an MCP resource or resource template.
See
- registerResource for the Effect-level resource registration API
Signature
declare const resource: { <E, R>(options: { readonly audience?: ReadonlyArray<"user" | "assistant">; readonly content: Effect.Effect<ReadResourceResult | string | Uint8Array, E, R>; readonly description?: string; readonly mimeType?: string; readonly name: string; readonly priority?: number; readonly uri: string; }): Layer<never, never, Exclude<R, McpRequestContext>>; <Schemas extends readonly Array<Constraint>>(segments: TemplateStringsArray, ...schemas: Schemas): <E, R, Completions extends Partial<ResourceCompletions<Schemas>> = {}>(options: { readonly audience?: ReadonlyArray<"user" | "assistant">; readonly completion?: ValidateCompletions<Completions, keyof ResourceCompletions<Schemas>>; readonly content: (uri: string, ...params: { [K in keyof Schemas]: Schemas[K]["Type"] }) => Effect.Effect<ReadResourceResult | string | Uint8Array, E, R>; readonly description?: string; readonly mimeType?: string; readonly name: string; readonly priority?: number; }) => Layer<never, never, Exclude<R, McpRequestContext> | Exclude<Schemas[number]["DecodingServices"], McpRequestContext> | Exclude<Schemas[number]["EncodingServices"], McpRequestContext> | Exclude<CompletionServices<Completions>, McpRequestContext>>;}Registers an AiToolkit with the McpServer.
Signature
declare function toolkit<Tools extends Record<string, Any>>(toolkit: Toolkit<Tools>): Layer<never, never, HandlersFor<Tools> | Exclude<HandlerServices<Tools[keyof Tools]>, McpRequestContext>>Models
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.
Signature
type ResourceCompletions<Schemas extends ReadonlyArray<Schema.Constraint>> = { [K in Extract<keyof Schemas, `${number}`>]: (input: string, context: CompletionContext) => Effect.Effect<Array<Schemas[K]["Type"]>, any, any> }Running
Runs an MCP server over the current RpcServer.Protocol.
Details
The server serves registered tools, resources, and prompts. The selected MCP runtime handles protocol lifecycle state and determines which clients receive queued server notifications.
Signature
declare const run: (options: { readonly description?: string; readonly extensions?: ServerExtensions; readonly icons?: ReadonlyArray<McpSchema.Icon>; readonly instructions?: string; readonly name: string; readonly protocols: Arr.NonEmptyReadonlyArray<McpProtocol.ProtocolAdapter>; readonly version: string; readonly websiteUrl?: string;}) => Effect.Effect<never, Cause.IllegalArgumentError, McpServer | RpcServer.Protocol>Services
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.
Signature
declare class McpServer extends Shape<"effect/ai/McpServer", { readonly addPrompt: (options: { readonly annotations: Context<never>; readonly completions: Record<string, (input: string, context: CompletionContext) => Effect.Effect<CompleteResult, InternalError, McpRequestContext>>; readonly handle: (params: Record<string, string>) => Effect<GetPromptResult | InputRequired, InvalidParams | InternalError, McpRequestContext>; readonly prompt: Prompt; }) => Effect<void>; readonly addResource: (options: { readonly annotations: Context<never>; readonly handle: Effect<ReadResourceResult, InternalError, McpRequestContext>; readonly resource: Resource; }) => Effect<void>; readonly addResourceTemplate: (options: { readonly annotations: Context<never>; readonly completions: Record<string, (input: string, context: CompletionContext) => Effect.Effect<CompleteResult, InternalError>>; readonly handle: (uri: string, params: Array<string>) => Effect<ReadResourceResult, InvalidParams | InternalError, McpRequestContext>; readonly routerPath: string; readonly template: ResourceTemplate; }) => Effect<void>; readonly addTool: (options: { readonly annotations: Context<never>; readonly handle: (payload: any) => Effect<CallToolResult | InputRequired, InvalidParams | InternalError, McpRequestContext>; readonly tool: Tool; }) => Effect<void>; readonly callTool: (requests: { readonly _meta?: { [key: string]: Json; readonly progressToken?: string | number; }; readonly arguments?: { [key: string]: any; }; readonly name: string; }) => Effect<CallToolResult, InvalidParams | InternalError, McpServerClient>; readonly completion: (complete: { readonly argument: { readonly name: string; readonly value: string; }; readonly context?: { readonly arguments?: { [key: string]: string; }; }; readonly ref: ResourceReference | PromptReference; }) => Effect<CompleteResult, InvalidParams | InternalError, McpServerClient>; readonly findResource: (uri: string) => Effect<ReadResourceResult, McpErrorBase | InvalidParams | InternalError, McpServerClient>; readonly getPromptResult: (request: { readonly _meta?: { [key: string]: Json; readonly progressToken?: string | number; }; readonly arguments?: { [key: string]: string; }; readonly name: string; readonly title?: string; }) => Effect<GetPromptResult, InvalidParams | InternalError, McpServerClient>; readonly notifications: { "notifications/cancelled": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; readonly reason?: string; readonly requestId: string | number; }, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/message": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; readonly data: any; readonly level: "error" | "debug" | "info" | "notice" | "warning" | "critical" | "alert" | "emergency"; readonly logger?: string; }, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/progress": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; readonly message?: string; readonly progress: number; readonly progressToken: string | number; readonly total?: number; }, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/prompts/list_changed": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; } | undefined, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/resources/list_changed": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; } | undefined, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/resources/updated": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; readonly uri: string; }, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/tools/list_changed": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; } | undefined, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; }; readonly notifyElicitationComplete: (options: { readonly clientId: number; readonly elicitationId: string; }) => Effect<void>; readonly prompts: readonly Array<{ readonly annotations: Context<never>; readonly prompt: Prompt; }>; readonly resources: readonly Array<{ readonly annotations: Context<never>; readonly resource: Resource; }>; readonly resourceTemplates: readonly Array<{ readonly annotations: Context<never>; readonly template: ResourceTemplate; }>; readonly tools: readonly Array<{ readonly annotations: Context<never>; readonly tool: Tool; }>;}, this> { constructor(_: never); static readonly layer: Layer<McpServerClient | McpServer>; static readonly make: Effect<{ readonly addPrompt: (options: { readonly annotations: Context<never>; readonly completions: Record<string, (input: string, context: CompletionContext) => Effect.Effect<CompleteResult, InternalError, McpRequestContext>>; readonly handle: (params: Record<string, string>) => Effect<GetPromptResult | InputRequired, InvalidParams | InternalError, McpRequestContext>; readonly prompt: Prompt; }) => Effect<void>; readonly addResource: (options: { readonly annotations: Context<never>; readonly handle: Effect<ReadResourceResult, InternalError, McpRequestContext>; readonly resource: Resource; }) => Effect<void>; readonly addResourceTemplate: (options: { readonly annotations: Context<never>; readonly completions: Record<string, (input: string, context: CompletionContext) => Effect.Effect<CompleteResult, InternalError>>; readonly handle: (uri: string, params: Array<string>) => Effect<ReadResourceResult, InvalidParams | InternalError, McpRequestContext>; readonly routerPath: string; readonly template: ResourceTemplate; }) => Effect<void>; readonly addTool: (options: { readonly annotations: Context<never>; readonly handle: (payload: any) => Effect<CallToolResult | InputRequired, InvalidParams | InternalError, McpRequestContext>; readonly tool: Tool; }) => Effect<void>; readonly callTool: (requests: { readonly _meta?: { [key: string]: Json; readonly progressToken?: string | number; }; readonly arguments?: { [key: string]: any; }; readonly name: string; }) => Effect<CallToolResult, InvalidParams | InternalError, McpServerClient>; readonly completion: (complete: { readonly argument: { readonly name: string; readonly value: string; }; readonly context?: { readonly arguments?: { [key: string]: string; }; }; readonly ref: ResourceReference | PromptReference; }) => Effect<CompleteResult, InvalidParams | InternalError, McpServerClient>; readonly findResource: (uri: string) => Effect<ReadResourceResult, McpErrorBase | InvalidParams | InternalError, McpServerClient>; readonly getPromptResult: (request: { readonly _meta?: { [key: string]: Json; readonly progressToken?: string | number; }; readonly arguments?: { [key: string]: string; }; readonly name: string; readonly title?: string; }) => Effect<GetPromptResult, InvalidParams | InternalError, McpServerClient>; readonly notifications: { "notifications/cancelled": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; readonly reason?: string; readonly requestId: string | number; }, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/message": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; readonly data: any; readonly level: "error" | "debug" | "info" | "notice" | "warning" | "critical" | "alert" | "emergency"; readonly logger?: string; }, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/progress": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; readonly message?: string; readonly progress: number; readonly progressToken: string | number; readonly total?: number; }, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/prompts/list_changed": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; } | undefined, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/resources/list_changed": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; } | undefined, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/resources/updated": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; readonly uri: string; }, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; "notifications/tools/list_changed": <AsQueue extends boolean = false, Discard = false>(input: { readonly _meta?: { [key: string]: unknown; }; } | undefined, options?: { readonly context?: Context<never>; readonly discard?: Discard; readonly headers?: Input; }) => Effect<Discard extends true ? void : void, Discard extends true ? never : never, never>; }; readonly notifyElicitationComplete: (options: { readonly clientId: number; readonly elicitationId: string; }) => Effect<void>; readonly prompts: readonly Array<{ readonly annotations: Context<never>; readonly prompt: Prompt; }>; readonly resources: readonly Array<{ readonly annotations: Context<never>; readonly resource: Resource; }>; readonly resourceTemplates: readonly Array<{ readonly annotations: Context<never>; readonly template: ResourceTemplate; }>; readonly tools: readonly Array<{ readonly annotations: Context<never>; readonly tool: Tool; }>; }, never, Scope>;}Utility Types
Utility type that collects the services required by the handlers of a completion-handler record, including handlers declared as optional.
Signature
type CompletionServices<Completions> = { [K in keyof Completions]: NonNullable<Completions[K]> extends (...args: any) => infer Ret ? Effect.Services<Ret> : never }[keyof Completions]Utility type that validates a completion-handler record against the allowed parameter keys.
Signature
type ValidateCompletions<Completions, Keys extends string> = Completions & { [K in keyof Completions]: K extends Keys ? (input: string, context: CompletionContext) => any : never }