@@ -220,6 +220,20 @@ type StripWireOnly<T> = T extends unknown ? { [K in keyof T as K extends WireOnl
220220 */
221221type WidenStructuredContent < T > = T extends unknown ? { [ K in keyof T ] : K extends 'structuredContent' ? unknown : T [ K ] } : never ;
222222
223+ /**
224+ * SEP-2106: re-types `outputSchema` on the schema-inferred `Tool` to the loose JSON Schema 2020-12
225+ * shape (any JSON Schema document, not just `type:'object'`). The era-neutral runtime schema in
226+ * `schemas.ts` keeps the 2025 `type:'object'` constraint for wire-parse byte-identity (Q10-L2); only
227+ * the public TypeScript type widens. `Omit<T,'outputSchema'> & {…}` cannot be used here because
228+ * `Omit` over an index-signatured type erases the known keys.
229+ */
230+ type Sep2106OutputSchema = { $schema ?: string ; [ k : string ] : unknown } ;
231+ type WidenToolOutputSchema < T > = T extends unknown
232+ ? { [ K in keyof T ] : K extends 'outputSchema' ? Sep2106OutputSchema | undefined : T [ K ] }
233+ : never ;
234+ /** Re-maps a schema-inferred type's `tools` member to the public (widened) {@linkcode Tool}`[]`. */
235+ type WithPublicTools < T > = T extends unknown ? { [ K in keyof T ] : K extends 'tools' ? Tool [ ] : T [ K ] } : never ;
236+
223237/* JSON-RPC types */
224238export type ProgressToken = Infer < typeof ProgressTokenSchema > ;
225239export type Cursor = Infer < typeof CursorSchema > ;
@@ -404,9 +418,14 @@ export type PromptListChangedNotification = Infer<typeof PromptListChangedNotifi
404418/* Tools */
405419export type ToolAnnotations = Infer < typeof ToolAnnotationsSchema > ;
406420export type ToolExecution = Infer < typeof ToolExecutionSchema > ;
407- export type Tool = Infer < typeof ToolSchema > ;
421+ /**
422+ * `outputSchema` is widened to the loose SEP-2106 shape (any JSON Schema 2020-12 document, not just
423+ * `type:'object'`). The 2025-era wire parse retains the `type:'object'` runtime constraint; only the
424+ * public TypeScript type widens. {@linkcode ListToolsResult}`.tools` carries the same widened shape.
425+ */
426+ export type Tool = WidenToolOutputSchema < Infer < typeof ToolSchema > > ;
408427export type ListToolsRequest = Infer < typeof ListToolsRequestSchema > ;
409- export type ListToolsResult = StripWireOnly < Infer < typeof ListToolsResultSchema > > ;
428+ export type ListToolsResult = WithPublicTools < StripWireOnly < Infer < typeof ListToolsResultSchema > > > ;
410429export type CallToolRequestParams = Infer < typeof CallToolRequestParamsSchema > ;
411430/**
412431 * `structuredContent` is widened to `unknown` per SEP-2106 (the 2026-07-28 protocol revision allows
@@ -925,13 +944,16 @@ export type CreateMessageRequestParamsBase = Omit<CreateMessageRequestParams, 't
925944
926945/**
927946 * {@linkcode CreateMessageRequestParams } with required tools - for tool-enabled overload.
947+ * `tools` keeps the schema-derived (2025-era, `type:'object'` outputSchema) shape: this overload is
948+ * the deprecated 2025-only push-sampling path, and the 2025 wire cannot carry a non-object
949+ * outputSchema regardless.
928950 *
929951 * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
930952 * in the specification for at least twelve months. Migrate to calling LLM
931953 * provider APIs directly.
932954 */
933955export interface CreateMessageRequestParamsWithTools extends CreateMessageRequestParams {
934- tools : Tool [ ] ;
956+ tools : NonNullable < CreateMessageRequestParams [ 'tools' ] > ;
935957}
936958
937959export type CompleteRequestResourceTemplate = ExpandRecursively <
0 commit comments