@orkestrel/mcp 0.0.30 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import type { EmitterErrorHandler } from '@orkestrel/emitter';
2
2
  import type { EmitterHooks } from '@orkestrel/emitter';
3
3
  import type { EmitterInterface } from '@orkestrel/emitter';
4
4
  import type { JSONValue } from '@orkestrel/contract';
5
+ import type { ToolAnnotations } from '@orkestrel/tool';
5
6
  import type { ToolCall } from '@orkestrel/tool';
6
7
  import type { ToolInterface } from '@orkestrel/tool';
7
8
  import type { ToolManagerInterface } from '@orkestrel/tool';
@@ -177,10 +178,11 @@ export declare function buildCancelledNotification(id: JSONRPCId, reason?: strin
177
178
  * @remarks
178
179
  * `capabilities.resources` and `capabilities.prompts` appear only for servers with their
179
180
  * respective managers and derive notification flags from the configured subscription filter.
180
- * `capabilities.completions` is independent and appears only with a completion provider.
181
- * `capabilities.extensions` appears only for a server that configured the extension it
182
- * would name. An advertisement is a promise a client is entitled to act on, so a server
183
- * with no `task` policy omits the member entirely rather than advertising an empty
181
+ * `tools.listChanged` is always advertised because the server produces the family from its
182
+ * own registry. `capabilities.completions` is independent and appears only with a completion
183
+ * provider. `capabilities.extensions` appears only for a server that configured the
184
+ * extension it would name. An advertisement is a promise a client is entitled to act on, so
185
+ * a server with no `task` policy omits the member entirely rather than advertising an empty
184
186
  * record — and its discovery answer stays byte-for-byte what it was before the extension
185
187
  * existed.
186
188
  *
@@ -405,11 +407,10 @@ export declare function buildSubscriptionResult(id: JSONRPCId, identity: MCPIden
405
407
  * Builds the canonical Tool call for one validated MCP `tools/call` request.
406
408
  *
407
409
  * @param request - The original MCP request
408
- * @param caller - Optional consumer-asserted caller context
409
410
  * @param args - Optional once-validated modern arguments; omission retains legacy normalization
410
411
  * @returns The canonical call, or `undefined` when the name is invalid
411
412
  */
412
- export declare function buildToolCall(request: JSONRPCRequest, caller?: unknown, args?: Readonly<Record<string, unknown>>): ToolCall | undefined;
413
+ export declare function buildToolCall(request: JSONRPCRequest, args?: Readonly<Record<string, unknown>>): ToolCall | undefined;
413
414
 
414
415
  /**
415
416
  * Maps a {@link ToolManagerInterface}'s definitions to MCP `tools/list` descriptors
@@ -417,7 +418,8 @@ export declare function buildToolCall(request: JSONRPCRequest, caller?: unknown,
417
418
  *
418
419
  * @remarks
419
420
  * Each {@link import('@orkestrel/tool').ToolDefinition} carries through its
420
- * `name` and (when present) `description`; its open JSON-Schema `parameters`
421
+ * `name`, optional `title` and `description`, and mapped annotation hints;
422
+ * its open JSON-Schema `parameters`
421
423
  * becomes `inputSchema`, defaulting to an empty object schema (`{ type: 'object' }`)
422
424
  * when a tool declares none (MCP requires an `inputSchema`).
423
425
  *
@@ -1488,6 +1490,20 @@ export declare function isMCPCompletionReference(value: unknown): value is MCPCo
1488
1490
  */
1489
1491
  export declare function isMCPCompletionResult(value: unknown): value is MCPCompletionResult;
1490
1492
 
1493
+ /**
1494
+ * Checks whether a subscription filter leaves the built-in tools family to the server.
1495
+ *
1496
+ * @param value - The unknown value to inspect
1497
+ * @returns True if the filter is valid and does not claim tools changes; false otherwise
1498
+ *
1499
+ * @example
1500
+ * ```ts
1501
+ * isMCPConsumerFilter({ promptsListChanged: true }) // true
1502
+ * isMCPConsumerFilter({ toolsListChanged: true }) // false
1503
+ * ```
1504
+ */
1505
+ export declare function isMCPConsumerFilter(value: unknown): value is MCPConsumerFilter;
1506
+
1491
1507
  /**
1492
1508
  * Determines whether a value is one exact dated-schema MCP tool content block.
1493
1509
  *
@@ -2151,6 +2167,24 @@ export declare function isMCPTaskStatus(value: unknown): value is MCPTaskStatus;
2151
2167
  */
2152
2168
  export declare function isMCPTextResource(value: unknown): value is MCPTextResource;
2153
2169
 
2170
+ /**
2171
+ * Checks whether a value carries valid consumed MCP 2026-07-28 tool annotation hints.
2172
+ *
2173
+ * @remarks
2174
+ * Validates only `readOnlyHint` and `destructiveHint`; other wire fields are not consumed, so
2175
+ * the open `objectOf` combinator carries them through unread. Every declared member is
2176
+ * optional, a hostile read answers `false` rather than throwing, and an array is refused.
2177
+ *
2178
+ * @param value - The unknown wire annotations
2179
+ * @returns True if consumed annotation fields are optional booleans; false otherwise
2180
+ *
2181
+ * @example
2182
+ * ```ts
2183
+ * isMCPToolAnnotations({ readOnlyHint: false }) // true
2184
+ * ```
2185
+ */
2186
+ export declare function isMCPToolAnnotations(value: unknown): value is MCPToolAnnotations;
2187
+
2154
2188
  /**
2155
2189
  * Determines whether a value is a supported {@link MCPVersion}.
2156
2190
  *
@@ -2628,6 +2662,19 @@ export declare interface MCPAnnotations {
2628
2662
  readonly lastModified?: string;
2629
2663
  }
2630
2664
 
2665
+ /**
2666
+ * Projects MCP wire hints onto domain tool annotations without inventing defaults.
2667
+ *
2668
+ * @param annotations - The validated MCP wire annotations
2669
+ * @returns The mapped annotations; unmapped wire hints are omitted
2670
+ *
2671
+ * @example
2672
+ * ```ts
2673
+ * mcpAnnotationsToTool({ readOnlyHint: false, destructiveHint: true }) // { pure: false, consequential: true }
2674
+ * ```
2675
+ */
2676
+ export declare function mcpAnnotationsToTool(annotations: MCPToolAnnotations): ToolAnnotations;
2677
+
2631
2678
  /** Represents a base64-encoded audio MCP content block. */
2632
2679
  export declare interface MCPAudioContent {
2633
2680
  readonly type: 'audio';
@@ -2986,9 +3033,11 @@ export declare interface MCPClientInterface {
2986
3033
  *
2987
3034
  * @remarks
2988
3035
  * Runs `tools/list` and maps each descriptor: `name` (narrowed to a string),
2989
- * `description`, and `inputSchema` → `parameters` (the inverse of the server's
2990
- * `parameters` → `inputSchema` rename). Add the returned tools to an agent's
2991
- * {@link ToolManagerInterface} to give it the remote tools.
3036
+ * `title`, `description`, `inputSchema` → `parameters`, and the mapped annotation hints.
3037
+ * The wrapped handler forwards its context signal into {@link call}. The result is a
3038
+ * snapshot; fetch it again to refresh an agent's {@link ToolManagerInterface}.
3039
+ * A summary authored on the remote tool replaces its advertised description, so the
3040
+ * separate summary and full description cannot be recovered from this wire view.
2992
3041
  *
2993
3042
  * @returns The remote tools as local {@link ToolInterface}s, in server order
2994
3043
  */
@@ -3140,6 +3189,12 @@ export declare interface MCPCompletionResult {
3140
3189
  readonly _meta?: MCPResultMetaObject;
3141
3190
  }
3142
3191
 
3192
+ /** Declares the consumer-produced notification families, excluding registry-owned tools changes. */
3193
+ export declare interface MCPConsumerFilter extends MCPSubscriptionFilter {
3194
+ /** Leaves tools changes to the server's registry. */
3195
+ readonly toolsListChanged?: false;
3196
+ }
3197
+
3143
3198
  /** Represents one exact dated-schema tool content block. */
3144
3199
  export declare type MCPContent = MCPTextContent | MCPImageContent | MCPAudioContent | MCPResourceLink | MCPEmbeddedResource;
3145
3200
 
@@ -3357,9 +3412,12 @@ export declare type MCPEra = 'modern' | 'legacy';
3357
3412
  * optional structured context.
3358
3413
  *
3359
3414
  * @remarks
3360
- * {@link MCPClient} throws this error for a remote JSON-RPC `error` response and for a
3361
- * locally detected protocol incompatibility. Local lifecycle and transport conditions such
3362
- * as disconnects and request timeouts remain plain `Error`s. For a remote response, `context`
3415
+ * {@link MCPClient} throws this error for a remote JSON-RPC `error` response, for a locally
3416
+ * detected protocol incompatibility, and for a session-bound request refused because the
3417
+ * client holds no connection — that one carries `-32600`, so a caller separates "reconnect"
3418
+ * from "retry" without reading a message. Local lifecycle and transport conditions that
3419
+ * settle a request already in flight, such as a disconnect and a request timeout, remain
3420
+ * plain `Error`s. For a remote response, `context`
3363
3421
  * carries the optional `error.data` unchanged and is `undefined` when the peer omitted it.
3364
3422
  * This includes the modern reserved paths: `-32020` carries no context, `-32021` may carry
3365
3423
  * `requiredCapabilities`, and `-32022` carries the peer's `supported` revisions and
@@ -3389,12 +3447,19 @@ export declare class MCPError extends Error {
3389
3447
  constructor(message: string, code: number, context?: unknown);
3390
3448
  }
3391
3449
 
3392
- /** Represents the explicit, host-neutral context for one modern tool execution. */
3450
+ /**
3451
+ * Represents the explicit, host-neutral context for one modern tool execution.
3452
+ *
3453
+ * @remarks
3454
+ * The default execution path forwards the request signal and caller to the tool manager.
3455
+ * A delegating execution handler forwards `signal` and `caller` itself.
3456
+ */
3393
3457
  export declare interface MCPExecutionContext {
3394
3458
  readonly request: JSONRPCRequest;
3395
3459
  readonly call: ToolCall;
3396
3460
  readonly tools: ToolManagerInterface;
3397
3461
  readonly signal: AbortSignal;
3462
+ readonly caller?: unknown;
3398
3463
  readonly progress?: MCPProgressInterface;
3399
3464
  }
3400
3465
 
@@ -4840,12 +4905,10 @@ export declare interface MCPServerOptions {
4840
4905
  * Holds the optional explicit execution policy above the canonical live tool registry.
4841
4906
  *
4842
4907
  * @remarks
4843
- * This is also the only way a tool observes cancellation. The default path calls
4844
- * {@link ToolManagerInterface.execute}, whose signature takes a call and nothing else, so
4845
- * there is no seam to hand a signal through — a server with no `execution` runs its tool to
4846
- * completion even after the request that asked for it has ended, and abandons the result.
4847
- * An {@link MCPExecutionHandler} receives `signal` on its {@link MCPExecutionContext} and
4848
- * can stop the work itself.
4908
+ * The default path forwards the request signal and optional caller through
4909
+ * {@link ToolManagerInterface.execute}. An {@link MCPExecutionHandler} receives them on
4910
+ * its {@link MCPExecutionContext}; a delegating handler forwards `signal` and `caller`
4911
+ * to the manager itself. Tool handlers observe the signal to stop their work.
4849
4912
  *
4850
4913
  * A handler returning a complete {@link MCPCallResult} is taken at its word: the server
4851
4914
  * bounds it and re-proves its shape, then sends what the handler composed. Nothing stamps
@@ -4865,7 +4928,13 @@ export declare interface MCPServerOptions {
4865
4928
  * consumer-supplied.
4866
4929
  */
4867
4930
  readonly input?: MCPInputOptions;
4868
- /** Holds the optional event-driven producer for the modern `subscriptions/listen` method. */
4931
+ /**
4932
+ * Holds the optional consumer producer for modern subscriptions. The server supplies the
4933
+ * tools family from its registry independently. The producer advances on stream demand;
4934
+ * a failure terminates the stream after its queued notifications. Registry changes
4935
+ * coalesce while a tools notification remains unread. A consumer filter claiming
4936
+ * `toolsListChanged: true` throws `MCPError` with `JSONRPC_INVALID_PARAMS` at construction.
4937
+ */
4869
4938
  readonly subscription?: MCPSubscriptionOptions;
4870
4939
  /**
4871
4940
  * Holds the optional Tasks extension; the durable store and the deferral decision are
@@ -5097,7 +5166,7 @@ export declare interface MCPStreamControllerInterface extends MCPStream {
5097
5166
  }
5098
5167
 
5099
5168
  /**
5100
- * Names the notification families a client may opt in to on a `subscriptions/listen` stream.
5169
+ * Names the notification families a client may opt in to on a `subscriptions/listen` stream, including built-in registry changes.
5101
5170
  *
5102
5171
  * @remarks
5103
5172
  * Every key here is a wire spelling, carried verbatim from the dated schema's
@@ -5108,7 +5177,7 @@ export declare interface MCPStreamControllerInterface extends MCPStream {
5108
5177
  * and takes the `MCP` prefix; the keys are the protocol's and do not change.
5109
5178
  */
5110
5179
  export declare interface MCPSubscriptionFilter {
5111
- /** Receives `notifications/tools/list_changed` when the server produces it. */
5180
+ /** Receives built-in `notifications/tools/list_changed` from registry add, remove, and clear events. */
5112
5181
  readonly toolsListChanged?: boolean;
5113
5182
  /** Receives `notifications/prompts/list_changed` when the server produces it. */
5114
5183
  readonly promptsListChanged?: boolean;
@@ -5141,9 +5210,13 @@ export declare interface MCPSubscriptionFilter {
5141
5210
  * Produces notifications for one honoured `subscriptions/listen` filter.
5142
5211
  *
5143
5212
  * @remarks
5144
- * The producer parks on its own event source while idle and ends its iterable to close the
5145
- * subscription gracefully. `options.signal` is the per-request cancellation signal; a
5146
- * producer that needs cancellation observes it directly rather than polling.
5213
+ * The producer parks on its own event source while idle. Ending its iterable closes the
5214
+ * subscription gracefully when the honoured filter omits the built-in tools family. A
5215
+ * subscription honouring that family stays open until failure or signal abort.
5216
+ * `options.signal` is the per-request cancellation signal; a producer that needs
5217
+ * cancellation observes it directly rather than polling. The server releases the source's
5218
+ * iterator with that signal's reason, so a `ReadableStream`-backed producer sees its pending
5219
+ * writes reject with the reason the request was aborted with.
5147
5220
  *
5148
5221
  * @param notifications - The requested filter intersected with the server's supported filter
5149
5222
  * @param options - The resolved per-request method options
@@ -5153,9 +5226,19 @@ export declare type MCPSubscriptionHandler = (notifications: MCPSubscriptionFilt
5153
5226
 
5154
5227
  /** Configures the server's built-in `subscriptions/listen` method. */
5155
5228
  export declare interface MCPSubscriptionOptions {
5156
- /** Holds the notification filter this server can actually honour. */
5157
- readonly notifications: MCPSubscriptionFilter;
5158
- /** Opens the producer for one honoured filter. */
5229
+ /**
5230
+ * Holds the consumer's supported filter. A malformed filter, and one claiming
5231
+ * `toolsListChanged: true`, are both invalid.
5232
+ */
5233
+ readonly notifications: MCPConsumerFilter;
5234
+ /**
5235
+ * Opens the consumer producer beside the server's built-in tools producer.
5236
+ *
5237
+ * @remarks
5238
+ * The producer advances on the stream's demand. A failure terminates the stream after
5239
+ * the notifications it already produced. Registry changes coalesce while a tools
5240
+ * notification remains unread.
5241
+ */
5159
5242
  readonly producer: MCPSubscriptionHandler;
5160
5243
  }
5161
5244
 
@@ -5456,7 +5539,7 @@ export declare type MCPTaskDetailResult = MCPTaskDetail & {
5456
5539
  *
5457
5540
  * The returned string is the stable operation key the manager deduplicates on: the same
5458
5541
  * logical call must produce the same key, and two different calls must not. Mint it from
5459
- * the caller and the canonical call — never from `call.id`, which is the client's own
5542
+ * `options.caller` and the canonical call — never from `call.id`, which is the client's own
5460
5543
  * JSON-RPC request id: a retry of one logical call changes it, so dedup never fires, and
5461
5544
  * two principals whose clients both started counting at 1 collide on it.
5462
5545
  *
@@ -5845,8 +5928,22 @@ export declare interface MCPTextStreamControllerInterface extends MCPTextStream
5845
5928
  }
5846
5929
 
5847
5930
  /**
5848
- * Represents one entry of the MCP `tools/list` result — a tool's `name`, optional
5849
- * `description`, and its JSON-Schema `inputSchema`.
5931
+ * Describes tool hints using the MCP 2026-07-28 specification's wire field names.
5932
+ *
5933
+ * @remarks
5934
+ * These hints describe behavior; they do not authorize execution. The domain projection
5935
+ * carries `pure` as `readOnlyHint` and `consequential` as `destructiveHint`.
5936
+ */
5937
+ export declare interface MCPToolAnnotations {
5938
+ readonly title?: string;
5939
+ readonly readOnlyHint?: boolean;
5940
+ readonly destructiveHint?: boolean;
5941
+ readonly idempotentHint?: boolean;
5942
+ readonly openWorldHint?: boolean;
5943
+ }
5944
+
5945
+ /**
5946
+ * Represents one entry of the MCP `tools/list` result with its display metadata and JSON-Schema input.
5850
5947
  *
5851
5948
  * @remarks
5852
5949
  * The wire renaming of a `ToolDefinition`: `name` / `description` carry through,
@@ -5855,8 +5952,10 @@ export declare interface MCPTextStreamControllerInterface extends MCPTextStream
5855
5952
  */
5856
5953
  export declare interface MCPToolDescriptor {
5857
5954
  readonly name: string;
5955
+ readonly title?: string;
5858
5956
  readonly description?: string;
5859
5957
  readonly inputSchema: Readonly<Record<string, unknown>>;
5958
+ readonly annotations?: MCPToolAnnotations;
5860
5959
  }
5861
5960
 
5862
5961
  /** Represents one tool's outcome returned to the model, carried in a sampling completion. */
@@ -6303,4 +6402,17 @@ export declare function supportsFormElicitation(value: unknown): boolean;
6303
6402
  */
6304
6403
  export declare function supportsTask(value: unknown): boolean;
6305
6404
 
6405
+ /**
6406
+ * Projects domain tool annotations onto MCP wire hints without inventing defaults.
6407
+ *
6408
+ * @param annotations - The authored domain annotations
6409
+ * @returns The mapped hints; `untrusted` has no MCP counterpart
6410
+ *
6411
+ * @example
6412
+ * ```ts
6413
+ * toolAnnotationsToMCP({ pure: true, consequential: false }) // { readOnlyHint: true, destructiveHint: false }
6414
+ * ```
6415
+ */
6416
+ export declare function toolAnnotationsToMCP(annotations: ToolAnnotations): MCPToolAnnotations;
6417
+
6306
6418
  export { }
@@ -2,6 +2,7 @@ import type { EmitterErrorHandler } from '@orkestrel/emitter';
2
2
  import type { EmitterHooks } from '@orkestrel/emitter';
3
3
  import type { EmitterInterface } from '@orkestrel/emitter';
4
4
  import type { JSONValue } from '@orkestrel/contract';
5
+ import type { ToolAnnotations } from '@orkestrel/tool';
5
6
  import type { ToolCall } from '@orkestrel/tool';
6
7
  import type { ToolInterface } from '@orkestrel/tool';
7
8
  import type { ToolManagerInterface } from '@orkestrel/tool';
@@ -177,10 +178,11 @@ export declare function buildCancelledNotification(id: JSONRPCId, reason?: strin
177
178
  * @remarks
178
179
  * `capabilities.resources` and `capabilities.prompts` appear only for servers with their
179
180
  * respective managers and derive notification flags from the configured subscription filter.
180
- * `capabilities.completions` is independent and appears only with a completion provider.
181
- * `capabilities.extensions` appears only for a server that configured the extension it
182
- * would name. An advertisement is a promise a client is entitled to act on, so a server
183
- * with no `task` policy omits the member entirely rather than advertising an empty
181
+ * `tools.listChanged` is always advertised because the server produces the family from its
182
+ * own registry. `capabilities.completions` is independent and appears only with a completion
183
+ * provider. `capabilities.extensions` appears only for a server that configured the
184
+ * extension it would name. An advertisement is a promise a client is entitled to act on, so
185
+ * a server with no `task` policy omits the member entirely rather than advertising an empty
184
186
  * record — and its discovery answer stays byte-for-byte what it was before the extension
185
187
  * existed.
186
188
  *
@@ -405,11 +407,10 @@ export declare function buildSubscriptionResult(id: JSONRPCId, identity: MCPIden
405
407
  * Builds the canonical Tool call for one validated MCP `tools/call` request.
406
408
  *
407
409
  * @param request - The original MCP request
408
- * @param caller - Optional consumer-asserted caller context
409
410
  * @param args - Optional once-validated modern arguments; omission retains legacy normalization
410
411
  * @returns The canonical call, or `undefined` when the name is invalid
411
412
  */
412
- export declare function buildToolCall(request: JSONRPCRequest, caller?: unknown, args?: Readonly<Record<string, unknown>>): ToolCall | undefined;
413
+ export declare function buildToolCall(request: JSONRPCRequest, args?: Readonly<Record<string, unknown>>): ToolCall | undefined;
413
414
 
414
415
  /**
415
416
  * Maps a {@link ToolManagerInterface}'s definitions to MCP `tools/list` descriptors
@@ -417,7 +418,8 @@ export declare function buildToolCall(request: JSONRPCRequest, caller?: unknown,
417
418
  *
418
419
  * @remarks
419
420
  * Each {@link import('@orkestrel/tool').ToolDefinition} carries through its
420
- * `name` and (when present) `description`; its open JSON-Schema `parameters`
421
+ * `name`, optional `title` and `description`, and mapped annotation hints;
422
+ * its open JSON-Schema `parameters`
421
423
  * becomes `inputSchema`, defaulting to an empty object schema (`{ type: 'object' }`)
422
424
  * when a tool declares none (MCP requires an `inputSchema`).
423
425
  *
@@ -1488,6 +1490,20 @@ export declare function isMCPCompletionReference(value: unknown): value is MCPCo
1488
1490
  */
1489
1491
  export declare function isMCPCompletionResult(value: unknown): value is MCPCompletionResult;
1490
1492
 
1493
+ /**
1494
+ * Checks whether a subscription filter leaves the built-in tools family to the server.
1495
+ *
1496
+ * @param value - The unknown value to inspect
1497
+ * @returns True if the filter is valid and does not claim tools changes; false otherwise
1498
+ *
1499
+ * @example
1500
+ * ```ts
1501
+ * isMCPConsumerFilter({ promptsListChanged: true }) // true
1502
+ * isMCPConsumerFilter({ toolsListChanged: true }) // false
1503
+ * ```
1504
+ */
1505
+ export declare function isMCPConsumerFilter(value: unknown): value is MCPConsumerFilter;
1506
+
1491
1507
  /**
1492
1508
  * Determines whether a value is one exact dated-schema MCP tool content block.
1493
1509
  *
@@ -2151,6 +2167,24 @@ export declare function isMCPTaskStatus(value: unknown): value is MCPTaskStatus;
2151
2167
  */
2152
2168
  export declare function isMCPTextResource(value: unknown): value is MCPTextResource;
2153
2169
 
2170
+ /**
2171
+ * Checks whether a value carries valid consumed MCP 2026-07-28 tool annotation hints.
2172
+ *
2173
+ * @remarks
2174
+ * Validates only `readOnlyHint` and `destructiveHint`; other wire fields are not consumed, so
2175
+ * the open `objectOf` combinator carries them through unread. Every declared member is
2176
+ * optional, a hostile read answers `false` rather than throwing, and an array is refused.
2177
+ *
2178
+ * @param value - The unknown wire annotations
2179
+ * @returns True if consumed annotation fields are optional booleans; false otherwise
2180
+ *
2181
+ * @example
2182
+ * ```ts
2183
+ * isMCPToolAnnotations({ readOnlyHint: false }) // true
2184
+ * ```
2185
+ */
2186
+ export declare function isMCPToolAnnotations(value: unknown): value is MCPToolAnnotations;
2187
+
2154
2188
  /**
2155
2189
  * Determines whether a value is a supported {@link MCPVersion}.
2156
2190
  *
@@ -2628,6 +2662,19 @@ export declare interface MCPAnnotations {
2628
2662
  readonly lastModified?: string;
2629
2663
  }
2630
2664
 
2665
+ /**
2666
+ * Projects MCP wire hints onto domain tool annotations without inventing defaults.
2667
+ *
2668
+ * @param annotations - The validated MCP wire annotations
2669
+ * @returns The mapped annotations; unmapped wire hints are omitted
2670
+ *
2671
+ * @example
2672
+ * ```ts
2673
+ * mcpAnnotationsToTool({ readOnlyHint: false, destructiveHint: true }) // { pure: false, consequential: true }
2674
+ * ```
2675
+ */
2676
+ export declare function mcpAnnotationsToTool(annotations: MCPToolAnnotations): ToolAnnotations;
2677
+
2631
2678
  /** Represents a base64-encoded audio MCP content block. */
2632
2679
  export declare interface MCPAudioContent {
2633
2680
  readonly type: 'audio';
@@ -2986,9 +3033,11 @@ export declare interface MCPClientInterface {
2986
3033
  *
2987
3034
  * @remarks
2988
3035
  * Runs `tools/list` and maps each descriptor: `name` (narrowed to a string),
2989
- * `description`, and `inputSchema` → `parameters` (the inverse of the server's
2990
- * `parameters` → `inputSchema` rename). Add the returned tools to an agent's
2991
- * {@link ToolManagerInterface} to give it the remote tools.
3036
+ * `title`, `description`, `inputSchema` → `parameters`, and the mapped annotation hints.
3037
+ * The wrapped handler forwards its context signal into {@link call}. The result is a
3038
+ * snapshot; fetch it again to refresh an agent's {@link ToolManagerInterface}.
3039
+ * A summary authored on the remote tool replaces its advertised description, so the
3040
+ * separate summary and full description cannot be recovered from this wire view.
2992
3041
  *
2993
3042
  * @returns The remote tools as local {@link ToolInterface}s, in server order
2994
3043
  */
@@ -3140,6 +3189,12 @@ export declare interface MCPCompletionResult {
3140
3189
  readonly _meta?: MCPResultMetaObject;
3141
3190
  }
3142
3191
 
3192
+ /** Declares the consumer-produced notification families, excluding registry-owned tools changes. */
3193
+ export declare interface MCPConsumerFilter extends MCPSubscriptionFilter {
3194
+ /** Leaves tools changes to the server's registry. */
3195
+ readonly toolsListChanged?: false;
3196
+ }
3197
+
3143
3198
  /** Represents one exact dated-schema tool content block. */
3144
3199
  export declare type MCPContent = MCPTextContent | MCPImageContent | MCPAudioContent | MCPResourceLink | MCPEmbeddedResource;
3145
3200
 
@@ -3357,9 +3412,12 @@ export declare type MCPEra = 'modern' | 'legacy';
3357
3412
  * optional structured context.
3358
3413
  *
3359
3414
  * @remarks
3360
- * {@link MCPClient} throws this error for a remote JSON-RPC `error` response and for a
3361
- * locally detected protocol incompatibility. Local lifecycle and transport conditions such
3362
- * as disconnects and request timeouts remain plain `Error`s. For a remote response, `context`
3415
+ * {@link MCPClient} throws this error for a remote JSON-RPC `error` response, for a locally
3416
+ * detected protocol incompatibility, and for a session-bound request refused because the
3417
+ * client holds no connection — that one carries `-32600`, so a caller separates "reconnect"
3418
+ * from "retry" without reading a message. Local lifecycle and transport conditions that
3419
+ * settle a request already in flight, such as a disconnect and a request timeout, remain
3420
+ * plain `Error`s. For a remote response, `context`
3363
3421
  * carries the optional `error.data` unchanged and is `undefined` when the peer omitted it.
3364
3422
  * This includes the modern reserved paths: `-32020` carries no context, `-32021` may carry
3365
3423
  * `requiredCapabilities`, and `-32022` carries the peer's `supported` revisions and
@@ -3389,12 +3447,19 @@ export declare class MCPError extends Error {
3389
3447
  constructor(message: string, code: number, context?: unknown);
3390
3448
  }
3391
3449
 
3392
- /** Represents the explicit, host-neutral context for one modern tool execution. */
3450
+ /**
3451
+ * Represents the explicit, host-neutral context for one modern tool execution.
3452
+ *
3453
+ * @remarks
3454
+ * The default execution path forwards the request signal and caller to the tool manager.
3455
+ * A delegating execution handler forwards `signal` and `caller` itself.
3456
+ */
3393
3457
  export declare interface MCPExecutionContext {
3394
3458
  readonly request: JSONRPCRequest;
3395
3459
  readonly call: ToolCall;
3396
3460
  readonly tools: ToolManagerInterface;
3397
3461
  readonly signal: AbortSignal;
3462
+ readonly caller?: unknown;
3398
3463
  readonly progress?: MCPProgressInterface;
3399
3464
  }
3400
3465
 
@@ -4840,12 +4905,10 @@ export declare interface MCPServerOptions {
4840
4905
  * Holds the optional explicit execution policy above the canonical live tool registry.
4841
4906
  *
4842
4907
  * @remarks
4843
- * This is also the only way a tool observes cancellation. The default path calls
4844
- * {@link ToolManagerInterface.execute}, whose signature takes a call and nothing else, so
4845
- * there is no seam to hand a signal through — a server with no `execution` runs its tool to
4846
- * completion even after the request that asked for it has ended, and abandons the result.
4847
- * An {@link MCPExecutionHandler} receives `signal` on its {@link MCPExecutionContext} and
4848
- * can stop the work itself.
4908
+ * The default path forwards the request signal and optional caller through
4909
+ * {@link ToolManagerInterface.execute}. An {@link MCPExecutionHandler} receives them on
4910
+ * its {@link MCPExecutionContext}; a delegating handler forwards `signal` and `caller`
4911
+ * to the manager itself. Tool handlers observe the signal to stop their work.
4849
4912
  *
4850
4913
  * A handler returning a complete {@link MCPCallResult} is taken at its word: the server
4851
4914
  * bounds it and re-proves its shape, then sends what the handler composed. Nothing stamps
@@ -4865,7 +4928,13 @@ export declare interface MCPServerOptions {
4865
4928
  * consumer-supplied.
4866
4929
  */
4867
4930
  readonly input?: MCPInputOptions;
4868
- /** Holds the optional event-driven producer for the modern `subscriptions/listen` method. */
4931
+ /**
4932
+ * Holds the optional consumer producer for modern subscriptions. The server supplies the
4933
+ * tools family from its registry independently. The producer advances on stream demand;
4934
+ * a failure terminates the stream after its queued notifications. Registry changes
4935
+ * coalesce while a tools notification remains unread. A consumer filter claiming
4936
+ * `toolsListChanged: true` throws `MCPError` with `JSONRPC_INVALID_PARAMS` at construction.
4937
+ */
4869
4938
  readonly subscription?: MCPSubscriptionOptions;
4870
4939
  /**
4871
4940
  * Holds the optional Tasks extension; the durable store and the deferral decision are
@@ -5097,7 +5166,7 @@ export declare interface MCPStreamControllerInterface extends MCPStream {
5097
5166
  }
5098
5167
 
5099
5168
  /**
5100
- * Names the notification families a client may opt in to on a `subscriptions/listen` stream.
5169
+ * Names the notification families a client may opt in to on a `subscriptions/listen` stream, including built-in registry changes.
5101
5170
  *
5102
5171
  * @remarks
5103
5172
  * Every key here is a wire spelling, carried verbatim from the dated schema's
@@ -5108,7 +5177,7 @@ export declare interface MCPStreamControllerInterface extends MCPStream {
5108
5177
  * and takes the `MCP` prefix; the keys are the protocol's and do not change.
5109
5178
  */
5110
5179
  export declare interface MCPSubscriptionFilter {
5111
- /** Receives `notifications/tools/list_changed` when the server produces it. */
5180
+ /** Receives built-in `notifications/tools/list_changed` from registry add, remove, and clear events. */
5112
5181
  readonly toolsListChanged?: boolean;
5113
5182
  /** Receives `notifications/prompts/list_changed` when the server produces it. */
5114
5183
  readonly promptsListChanged?: boolean;
@@ -5141,9 +5210,13 @@ export declare interface MCPSubscriptionFilter {
5141
5210
  * Produces notifications for one honoured `subscriptions/listen` filter.
5142
5211
  *
5143
5212
  * @remarks
5144
- * The producer parks on its own event source while idle and ends its iterable to close the
5145
- * subscription gracefully. `options.signal` is the per-request cancellation signal; a
5146
- * producer that needs cancellation observes it directly rather than polling.
5213
+ * The producer parks on its own event source while idle. Ending its iterable closes the
5214
+ * subscription gracefully when the honoured filter omits the built-in tools family. A
5215
+ * subscription honouring that family stays open until failure or signal abort.
5216
+ * `options.signal` is the per-request cancellation signal; a producer that needs
5217
+ * cancellation observes it directly rather than polling. The server releases the source's
5218
+ * iterator with that signal's reason, so a `ReadableStream`-backed producer sees its pending
5219
+ * writes reject with the reason the request was aborted with.
5147
5220
  *
5148
5221
  * @param notifications - The requested filter intersected with the server's supported filter
5149
5222
  * @param options - The resolved per-request method options
@@ -5153,9 +5226,19 @@ export declare type MCPSubscriptionHandler = (notifications: MCPSubscriptionFilt
5153
5226
 
5154
5227
  /** Configures the server's built-in `subscriptions/listen` method. */
5155
5228
  export declare interface MCPSubscriptionOptions {
5156
- /** Holds the notification filter this server can actually honour. */
5157
- readonly notifications: MCPSubscriptionFilter;
5158
- /** Opens the producer for one honoured filter. */
5229
+ /**
5230
+ * Holds the consumer's supported filter. A malformed filter, and one claiming
5231
+ * `toolsListChanged: true`, are both invalid.
5232
+ */
5233
+ readonly notifications: MCPConsumerFilter;
5234
+ /**
5235
+ * Opens the consumer producer beside the server's built-in tools producer.
5236
+ *
5237
+ * @remarks
5238
+ * The producer advances on the stream's demand. A failure terminates the stream after
5239
+ * the notifications it already produced. Registry changes coalesce while a tools
5240
+ * notification remains unread.
5241
+ */
5159
5242
  readonly producer: MCPSubscriptionHandler;
5160
5243
  }
5161
5244
 
@@ -5456,7 +5539,7 @@ export declare type MCPTaskDetailResult = MCPTaskDetail & {
5456
5539
  *
5457
5540
  * The returned string is the stable operation key the manager deduplicates on: the same
5458
5541
  * logical call must produce the same key, and two different calls must not. Mint it from
5459
- * the caller and the canonical call — never from `call.id`, which is the client's own
5542
+ * `options.caller` and the canonical call — never from `call.id`, which is the client's own
5460
5543
  * JSON-RPC request id: a retry of one logical call changes it, so dedup never fires, and
5461
5544
  * two principals whose clients both started counting at 1 collide on it.
5462
5545
  *
@@ -5845,8 +5928,22 @@ export declare interface MCPTextStreamControllerInterface extends MCPTextStream
5845
5928
  }
5846
5929
 
5847
5930
  /**
5848
- * Represents one entry of the MCP `tools/list` result — a tool's `name`, optional
5849
- * `description`, and its JSON-Schema `inputSchema`.
5931
+ * Describes tool hints using the MCP 2026-07-28 specification's wire field names.
5932
+ *
5933
+ * @remarks
5934
+ * These hints describe behavior; they do not authorize execution. The domain projection
5935
+ * carries `pure` as `readOnlyHint` and `consequential` as `destructiveHint`.
5936
+ */
5937
+ export declare interface MCPToolAnnotations {
5938
+ readonly title?: string;
5939
+ readonly readOnlyHint?: boolean;
5940
+ readonly destructiveHint?: boolean;
5941
+ readonly idempotentHint?: boolean;
5942
+ readonly openWorldHint?: boolean;
5943
+ }
5944
+
5945
+ /**
5946
+ * Represents one entry of the MCP `tools/list` result with its display metadata and JSON-Schema input.
5850
5947
  *
5851
5948
  * @remarks
5852
5949
  * The wire renaming of a `ToolDefinition`: `name` / `description` carry through,
@@ -5855,8 +5952,10 @@ export declare interface MCPTextStreamControllerInterface extends MCPTextStream
5855
5952
  */
5856
5953
  export declare interface MCPToolDescriptor {
5857
5954
  readonly name: string;
5955
+ readonly title?: string;
5858
5956
  readonly description?: string;
5859
5957
  readonly inputSchema: Readonly<Record<string, unknown>>;
5958
+ readonly annotations?: MCPToolAnnotations;
5860
5959
  }
5861
5960
 
5862
5961
  /** Represents one tool's outcome returned to the model, carried in a sampling completion. */
@@ -6303,4 +6402,17 @@ export declare function supportsFormElicitation(value: unknown): boolean;
6303
6402
  */
6304
6403
  export declare function supportsTask(value: unknown): boolean;
6305
6404
 
6405
+ /**
6406
+ * Projects domain tool annotations onto MCP wire hints without inventing defaults.
6407
+ *
6408
+ * @param annotations - The authored domain annotations
6409
+ * @returns The mapped hints; `untrusted` has no MCP counterpart
6410
+ *
6411
+ * @example
6412
+ * ```ts
6413
+ * toolAnnotationsToMCP({ pure: true, consequential: false }) // { readOnlyHint: true, destructiveHint: false }
6414
+ * ```
6415
+ */
6416
+ export declare function toolAnnotationsToMCP(annotations: ToolAnnotations): MCPToolAnnotations;
6417
+
6306
6418
  export { }