Update client and server convenience methods
This commit is contained in:
parent
45a4c9ee37
commit
099c2e2be3
2 changed files with 30 additions and 0 deletions
|
|
@ -29,6 +29,8 @@ import {
|
|||
ListToolsResultSchema,
|
||||
EmptyResultSchema,
|
||||
LoggingLevel,
|
||||
ListResourceTemplatesRequest,
|
||||
ListResourceTemplatesResultSchema,
|
||||
} from "../types.js";
|
||||
|
||||
/**
|
||||
|
|
@ -177,6 +179,17 @@ export class Client<
|
|||
);
|
||||
}
|
||||
|
||||
async listResourceTemplates(
|
||||
params?: ListResourceTemplatesRequest["params"],
|
||||
onprogress?: ProgressCallback,
|
||||
) {
|
||||
return this.request(
|
||||
{ method: "resources/templates/list", params },
|
||||
ListResourceTemplatesResultSchema,
|
||||
onprogress,
|
||||
);
|
||||
}
|
||||
|
||||
async readResource(
|
||||
params: ReadResourceRequest["params"],
|
||||
onprogress?: ProgressCallback,
|
||||
|
|
@ -223,4 +236,8 @@ export class Client<
|
|||
onprogress,
|
||||
);
|
||||
}
|
||||
|
||||
async sendRootsListChanged() {
|
||||
return this.notification({ method: "notifications/roots/list_changed" });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ import {
|
|||
EmptyResultSchema,
|
||||
LoggingMessageNotification,
|
||||
ResourceUpdatedNotification,
|
||||
ListRootsRequest,
|
||||
ListRootsResultSchema,
|
||||
} from "../types.js";
|
||||
|
||||
/**
|
||||
|
|
@ -154,6 +156,17 @@ export class Server<
|
|||
);
|
||||
}
|
||||
|
||||
async listRoots(
|
||||
params?: ListRootsRequest["params"],
|
||||
onprogress?: ProgressCallback,
|
||||
) {
|
||||
return this.request(
|
||||
{ method: "roots/list", params },
|
||||
ListRootsResultSchema,
|
||||
onprogress,
|
||||
);
|
||||
}
|
||||
|
||||
async sendLoggingMessage(params: LoggingMessageNotification["params"]) {
|
||||
return this.notification({ method: "notifications/message", params });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue