Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 107 additions & 32 deletions schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@
],
"type": "object"
},
"Cursor": {
"description": "An opaque token used to represent a cursor for pagination.",
"type": "string"
},
"EmptyResult": {
"$ref": "#/definitions/Result"
},
Expand Down Expand Up @@ -678,16 +682,10 @@
"type": "string"
},
"params": {
"additionalProperties": {},
"properties": {
"_meta": {
"properties": {
"progressToken": {
"$ref": "#/definitions/ProgressToken",
"description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications."
}
},
"type": "object"
"cursor": {
"description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
"type": "string"
}
},
"type": "object"
Expand All @@ -706,6 +704,10 @@
"description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
"type": "object"
},
"nextCursor": {
"description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
"type": "string"
},
"prompts": {
"items": {
"$ref": "#/definitions/Prompt"
Expand All @@ -718,24 +720,18 @@
],
"type": "object"
},
"ListResourcesRequest": {
"description": "Sent from the client to request a list of resources the server has.",
"ListResourceTemplatesRequest": {
"description": "Sent from the client to request a list of resource templates the server has.",
"properties": {
"method": {
"const": "resources/list",
"const": "resources/templates/list",
"type": "string"
},
"params": {
"additionalProperties": {},
"properties": {
"_meta": {
"properties": {
"progressToken": {
"$ref": "#/definitions/ProgressToken",
"description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications."
}
},
"type": "object"
"cursor": {
"description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
"type": "string"
}
},
"type": "object"
Expand All @@ -746,19 +742,63 @@
],
"type": "object"
},
"ListResourcesResult": {
"description": "The server's response to a resources/list request from the client.",
"ListResourceTemplatesResult": {
"description": "The server's response to a resources/templates/list request from the client.",
"properties": {
"_meta": {
"additionalProperties": {},
"description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
"type": "object"
},
"nextCursor": {
"description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
"type": "string"
},
"resourceTemplates": {
"items": {
"$ref": "#/definitions/ResourceTemplate"
},
"type": "array"
}
},
"required": [
"resourceTemplates"
],
"type": "object"
},
"ListResourcesRequest": {
"description": "Sent from the client to request a list of resources the server has.",
"properties": {
"method": {
"const": "resources/list",
"type": "string"
},
"params": {
"properties": {
"cursor": {
"description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
"type": "string"
}
},
"type": "object"
}
},
"required": [
"method"
],
"type": "object"
},
"ListResourcesResult": {
"description": "The server's response to a resources/list request from the client.",
"properties": {
"_meta": {
"additionalProperties": {},
"description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
"type": "object"
},
"nextCursor": {
"description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
"type": "string"
},
"resources": {
"items": {
Expand All @@ -767,6 +807,9 @@
"type": "array"
}
},
"required": [
"resources"
],
"type": "object"
},
"ListToolsRequest": {
Expand All @@ -777,16 +820,10 @@
"type": "string"
},
"params": {
"additionalProperties": {},
"properties": {
"_meta": {
"properties": {
"progressToken": {
"$ref": "#/definitions/ProgressToken",
"description": "If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications."
}
},
"type": "object"
"cursor": {
"description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
"type": "string"
}
},
"type": "object"
Expand All @@ -805,6 +842,10 @@
"description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
"type": "object"
},
"nextCursor": {
"description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
"type": "string"
},
"tools": {
"items": {
"$ref": "#/definitions/Tool"
Expand Down Expand Up @@ -883,6 +924,40 @@
],
"type": "object"
},
"PaginatedRequest": {
"properties": {
"method": {
"type": "string"
},
"params": {
"properties": {
"cursor": {
"description": "An opaque token representing the current pagination position.\nIf provided, the server should return results starting after this cursor.",
"type": "string"
}
},
"type": "object"
}
},
"required": [
"method"
],
"type": "object"
},
"PaginatedResult": {
"properties": {
"_meta": {
"additionalProperties": {},
"description": "This result property is reserved by the protocol to allow clients and servers to attach additional metadata to their responses.",
"type": "object"
},
"nextCursor": {
"description": "An opaque token representing the pagination position after the last returned result.\nIf present, there may be more results available.",
"type": "string"
}
},
"type": "object"
},
"PingRequest": {
"description": "A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.",
"properties": {
Expand Down
53 changes: 45 additions & 8 deletions schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export const JSONRPC_VERSION = "2.0";
*/
export type ProgressToken = string | number;

/**
* An opaque token used to represent a cursor for pagination.
*/
export type Cursor = string;

export interface Request {
method: string;
params?: {
Expand Down Expand Up @@ -245,20 +250,52 @@ export interface ProgressNotification extends Notification {
};
}

/* Pagination */
export interface PaginatedRequest extends Request {
params?: {
/**
* An opaque token representing the current pagination position.
* If provided, the server should return results starting after this cursor.
*/
cursor?: Cursor;
};
}

export interface PaginatedResult extends Result {
/**
* An opaque token representing the pagination position after the last returned result.
* If present, there may be more results available.
*/
nextCursor?: Cursor;
}

/* Resources */
/**
* Sent from the client to request a list of resources the server has.
*/
export interface ListResourcesRequest extends Request {
export interface ListResourcesRequest extends PaginatedRequest {
method: "resources/list";
}

/**
* The server's response to a resources/list request from the client.
*/
export interface ListResourcesResult extends Result {
resourceTemplates?: ResourceTemplate[];
resources?: Resource[];
export interface ListResourcesResult extends PaginatedResult {
resources: Resource[];
}

/**
* Sent from the client to request a list of resource templates the server has.
*/
export interface ListResourceTemplatesRequest extends PaginatedRequest {
method: "resources/templates/list";
}

/**
* The server's response to a resources/templates/list request from the client.
*/
export interface ListResourceTemplatesResult extends PaginatedResult {
resourceTemplates: ResourceTemplate[];
}

/**
Expand Down Expand Up @@ -433,14 +470,14 @@ export interface BlobResourceContents extends ResourceContents {
/**
* Sent from the client to request a list of prompts and prompt templates the server has.
*/
export interface ListPromptsRequest extends Request {
export interface ListPromptsRequest extends PaginatedRequest {
method: "prompts/list";
}

/**
* The server's response to a prompts/list request from the client.
*/
export interface ListPromptsResult extends Result {
export interface ListPromptsResult extends PaginatedResult {
prompts: Prompt[];
}

Expand Down Expand Up @@ -519,14 +556,14 @@ export interface PromptListChangedNotification extends Notification {
/**
* Sent from the client to request a list of tools the server has.
*/
export interface ListToolsRequest extends Request {
export interface ListToolsRequest extends PaginatedRequest {
method: "tools/list";
}

/**
* The server's response to a tools/list request from the client.
*/
export interface ListToolsResult extends Result {
export interface ListToolsResult extends PaginatedResult {
tools: Tool[];
}

Expand Down