Skip to content

Commit b532047

Browse files
committed
Merge branch 'main' of github.com:modelcontextprotocol/typescript-sdk into feature/v2-monorepo-setup
2 parents 2dee387 + 384311b commit b532047

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modelcontextprotocol/sdk",
3-
"version": "1.25.0",
3+
"version": "1.25.1",
44
"description": "Model Context Protocol implementation for TypeScript",
55
"license": "MIT",
66
"author": "Anthropic, PBC (https://anthropic.com)",

packages/core/src/types/types.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,22 @@ export const JSONRPCResultResponseSchema = z
206206
})
207207
.strict();
208208

209+
/**
210+
* Checks if a value is a valid JSONRPCResultResponse.
211+
* @param value - The value to check.
212+
*
213+
* @returns True if the value is a valid JSONRPCResultResponse, false otherwise.
214+
*/
209215
export const isJSONRPCResultResponse = (value: unknown): value is JSONRPCResultResponse =>
210216
JSONRPCResultResponseSchema.safeParse(value).success;
211217

218+
/**
219+
* @deprecated Use {@link isJSONRPCResultResponse} instead.
220+
*
221+
* Please note that {@link JSONRPCResponse} is a union of {@link JSONRPCResultResponse} and {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCResultResponse})
222+
*/
223+
export const isJSONRPCResponse = isJSONRPCResultResponse;
224+
212225
/**
213226
* Error codes defined by the JSON-RPC specification.
214227
*/
@@ -252,15 +265,32 @@ export const JSONRPCErrorResponseSchema = z
252265
})
253266
.strict();
254267

268+
/**
269+
* @deprecated Use {@link JSONRPCErrorResponseSchema} instead.
270+
*/
271+
export const JSONRPCErrorSchema = JSONRPCErrorResponseSchema;
272+
273+
/**
274+
* Checks if a value is a valid JSONRPCErrorResponse.
275+
* @param value - The value to check.
276+
*
277+
* @returns True if the value is a valid JSONRPCErrorResponse, false otherwise.
278+
*/
255279
export const isJSONRPCErrorResponse = (value: unknown): value is JSONRPCErrorResponse =>
256280
JSONRPCErrorResponseSchema.safeParse(value).success;
257281

282+
/**
283+
* @deprecated Use {@link isJSONRPCErrorResponse} instead.
284+
*/
285+
export const isJSONRPCError = isJSONRPCErrorResponse;
286+
258287
export const JSONRPCMessageSchema = z.union([
259288
JSONRPCRequestSchema,
260289
JSONRPCNotificationSchema,
261290
JSONRPCResultResponseSchema,
262291
JSONRPCErrorResponseSchema
263292
]);
293+
264294
export const JSONRPCResponseSchema = z.union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]);
265295

266296
/* Empty result */
@@ -2409,6 +2439,12 @@ export type JSONRPCRequest = Infer<typeof JSONRPCRequestSchema>;
24092439
export type JSONRPCNotification = Infer<typeof JSONRPCNotificationSchema>;
24102440
export type JSONRPCResponse = Infer<typeof JSONRPCResponseSchema>;
24112441
export type JSONRPCErrorResponse = Infer<typeof JSONRPCErrorResponseSchema>;
2442+
/**
2443+
* @deprecated Use {@link JSONRPCErrorResponse} instead.
2444+
*
2445+
* Please note that spec types have renamed {@link JSONRPCError} to {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCError}) and future versions will remove {@link JSONRPCError}.
2446+
*/
2447+
export type JSONRPCError = JSONRPCErrorResponse;
24122448
export type JSONRPCResultResponse = Infer<typeof JSONRPCResultResponseSchema>;
24132449

24142450
export type JSONRPCMessage = Infer<typeof JSONRPCMessageSchema>;

0 commit comments

Comments
 (0)