Skip to content

Commit b400ce5

Browse files
committed
Mark numbers as integers where possible
1 parent c7713e9 commit b400ce5

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/types.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const JSONRPC_VERSION = "2.0";
1313
/**
1414
* A progress token, used to associate progress notifications with the original request.
1515
*/
16-
export const ProgressTokenSchema = z.union([z.string(), z.number()]);
16+
export const ProgressTokenSchema = z.union([z.string(), z.number().int()]);
1717

1818
export const RequestSchema = z.object({
1919
method: z.string(),
@@ -47,7 +47,7 @@ export const ResultSchema = z.object({
4747
/**
4848
* A uniquely identifying ID for a request in JSON-RPC.
4949
*/
50-
export const RequestIdSchema = z.union([z.string(), z.number()]);
50+
export const RequestIdSchema = z.union([z.string(), z.number().int()]);
5151

5252
/**
5353
* A request that expects a response.
@@ -90,7 +90,7 @@ export const JSONRPCErrorSchema = z.object({
9090
/**
9191
* The error type that occurred.
9292
*/
93-
code: z.number(),
93+
code: z.number().int(),
9494
/**
9595
* A short description of the error. The message SHOULD be limited to a concise single sentence.
9696
*/
@@ -218,14 +218,10 @@ export const ProgressNotificationSchema = NotificationSchema.extend({
218218
progressToken: ProgressTokenSchema,
219219
/**
220220
* The progress thus far. This should increase every time progress is made, even if the total is unknown.
221-
*
222-
* @TJS-type number
223221
*/
224222
progress: z.number(),
225223
/**
226224
* Total number of items to process (or total progress required), if known.
227-
*
228-
* @TJS-type number
229225
*/
230226
total: z.optional(z.number())
231227
})
@@ -599,14 +595,11 @@ export const CreateMessageRequestSchema = RequestSchema.extend({
599595
* A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
600596
*/
601597
includeContext: z.optional(z.enum(["none", "thisServer", "allServers"])),
602-
/**
603-
* @TJS-type number
604-
*/
605598
temperature: z.optional(z.number()),
606599
/**
607600
* The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.
608601
*/
609-
maxTokens: z.number(),
602+
maxTokens: z.number().int(),
610603
stopSequences: z.optional(z.array(z.string())),
611604
/**
612605
* Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
@@ -703,7 +696,7 @@ export const CompleteResultSchema = ResultSchema.extend({
703696
/**
704697
* The total number of completion options available. This can exceed the number of values actually sent in the response.
705698
*/
706-
total: z.optional(z.number()),
699+
total: z.optional(z.number().int()),
707700
/**
708701
* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
709702
*/

0 commit comments

Comments
 (0)