Skip to content

Commit ed2ad1b

Browse files
committed
Extract PaginatedRequest and PaginatedResult types
1 parent 9f9c738 commit ed2ad1b

File tree

1 file changed

+24
-57
lines changed

1 file changed

+24
-57
lines changed

schema/schema.ts

Lines changed: 24 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,8 @@ export interface ProgressNotification extends Notification {
250250
};
251251
}
252252

253-
/* Resources */
254-
/**
255-
* Sent from the client to request a list of resources the server has.
256-
*/
257-
export interface ListResourcesRequest extends Request {
258-
method: "resources/list";
253+
/* Pagination */
254+
export interface PaginatedRequest extends Request {
259255
params?: {
260256
/**
261257
* An opaque token representing the current pagination position.
@@ -265,44 +261,41 @@ export interface ListResourcesRequest extends Request {
265261
};
266262
}
267263

268-
/**
269-
* The server's response to a resources/list request from the client.
270-
*/
271-
export interface ListResourcesResult extends Result {
272-
resources: Resource[];
273-
264+
export interface PaginatedResult extends Result {
274265
/**
275266
* An opaque token representing the pagination position after the last returned result.
276267
* If present, there may be more results available.
277268
*/
278269
nextCursor?: Cursor;
279270
}
280271

272+
/* Resources */
273+
/**
274+
* Sent from the client to request a list of resources the server has.
275+
*/
276+
export interface ListResourcesRequest extends PaginatedRequest {
277+
method: "resources/list";
278+
}
279+
280+
/**
281+
* The server's response to a resources/list request from the client.
282+
*/
283+
export interface ListResourcesResult extends PaginatedResult {
284+
resources: Resource[];
285+
}
286+
281287
/**
282288
* Sent from the client to request a list of resource templates the server has.
283289
*/
284-
export interface ListResourceTemplatesRequest extends Request {
290+
export interface ListResourceTemplatesRequest extends PaginatedRequest {
285291
method: "resources/templates/list";
286-
params?: {
287-
/**
288-
* An opaque token representing the current pagination position.
289-
* If provided, the server should return results starting after this cursor.
290-
*/
291-
cursor?: Cursor;
292-
};
293292
}
294293

295294
/**
296295
* The server's response to a resources/templates/list request from the client.
297296
*/
298-
export interface ListResourceTemplatesResult extends Result {
297+
export interface ListResourceTemplatesResult extends PaginatedResult {
299298
resourceTemplates: ResourceTemplate[];
300-
301-
/**
302-
* An opaque token representing the pagination position after the last returned result.
303-
* If present, there may be more results available.
304-
*/
305-
nextCursor?: Cursor;
306299
}
307300

308301
/**
@@ -477,28 +470,15 @@ export interface BlobResourceContents extends ResourceContents {
477470
/**
478471
* Sent from the client to request a list of prompts and prompt templates the server has.
479472
*/
480-
export interface ListPromptsRequest extends Request {
473+
export interface ListPromptsRequest extends PaginatedRequest {
481474
method: "prompts/list";
482-
params?: {
483-
/**
484-
* An opaque token representing the current pagination position.
485-
* If provided, the server should return results starting after this cursor.
486-
*/
487-
cursor?: Cursor;
488-
};
489475
}
490476

491477
/**
492478
* The server's response to a prompts/list request from the client.
493479
*/
494-
export interface ListPromptsResult extends Result {
480+
export interface ListPromptsResult extends PaginatedResult {
495481
prompts: Prompt[];
496-
497-
/**
498-
* An opaque token representing the pagination position after the last returned result.
499-
* If present, there may be more results available.
500-
*/
501-
nextCursor?: Cursor;
502482
}
503483

504484
/**
@@ -576,28 +556,15 @@ export interface PromptListChangedNotification extends Notification {
576556
/**
577557
* Sent from the client to request a list of tools the server has.
578558
*/
579-
export interface ListToolsRequest extends Request {
559+
export interface ListToolsRequest extends PaginatedRequest {
580560
method: "tools/list";
581-
params?: {
582-
/**
583-
* An opaque token representing the current pagination position.
584-
* If provided, the server should return results starting after this cursor.
585-
*/
586-
cursor?: Cursor;
587-
};
588561
}
589562

590563
/**
591564
* The server's response to a tools/list request from the client.
592565
*/
593-
export interface ListToolsResult extends Result {
566+
export interface ListToolsResult extends PaginatedResult {
594567
tools: Tool[];
595-
596-
/**
597-
* An opaque token representing the pagination position after the last returned result.
598-
* If present, there may be more results available.
599-
*/
600-
nextCursor?: Cursor;
601568
}
602569

603570
/**

0 commit comments

Comments
 (0)