You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v1-compat: `registerTool`/`registerPrompt` accept a raw Zod shape (`{ field: z.string() }`) for `inputSchema`/`outputSchema`/`argsSchema` again. The shape is auto-wrapped in `z.object()` and a one-time deprecation warning is emitted. Wrap in `z.object({...})` to silence the warning; the shim will be removed in v3.
Copy file name to clipboardExpand all lines: packages/server/src/server/mcp.ts
+50-3Lines changed: 50 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@ import {
32
32
assertCompleteRequestResourceTemplate,
33
33
deprecate,
34
34
isStandardSchema,
35
+
normalizeRawShapeSchema,
35
36
promptArgumentsFromStandardSchema,
36
37
ProtocolError,
37
38
ProtocolErrorCode,
@@ -876,6 +877,31 @@ export class McpServer {
876
877
_meta?: Record<string,unknown>;
877
878
},
878
879
cb: ToolCallback<InputArgs>
880
+
): RegisteredTool;
881
+
/** @deprecated Pass a Standard Schema (e.g. wrap your raw shape in `z.object({...})`). Raw-shape inputs are auto-wrapped at runtime. Removed in v3. */
thrownewError(`Tool ${name} is already registered`);
@@ -887,8 +913,8 @@ export class McpServer {
887
913
name,
888
914
title,
889
915
description,
890
-
inputSchema,
891
-
outputSchema,
916
+
normalizeRawShapeSchema(inputSchema),
917
+
normalizeRawShapeSchema(outputSchema),
892
918
annotations,
893
919
{taskSupport: 'forbidden'},
894
920
_meta,
@@ -931,6 +957,27 @@ export class McpServer {
931
957
_meta?: Record<string,unknown>;
932
958
},
933
959
cb: PromptCallback<Args>
960
+
): RegisteredPrompt;
961
+
/** @deprecated Pass a Standard Schema (e.g. wrap your raw shape in `z.object({...})`). Raw-shape inputs are auto-wrapped at runtime. Removed in v3. */
0 commit comments