Skip to content

Commit 099c2e2

Browse files
committed
Update client and server convenience methods
1 parent 45a4c9e commit 099c2e2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/client/index.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import {
2929
ListToolsResultSchema,
3030
EmptyResultSchema,
3131
LoggingLevel,
32+
ListResourceTemplatesRequest,
33+
ListResourceTemplatesResultSchema,
3234
} from "../types.js";
3335

3436
/**
@@ -177,6 +179,17 @@ export class Client<
177179
);
178180
}
179181

182+
async listResourceTemplates(
183+
params?: ListResourceTemplatesRequest["params"],
184+
onprogress?: ProgressCallback,
185+
) {
186+
return this.request(
187+
{ method: "resources/templates/list", params },
188+
ListResourceTemplatesResultSchema,
189+
onprogress,
190+
);
191+
}
192+
180193
async readResource(
181194
params: ReadResourceRequest["params"],
182195
onprogress?: ProgressCallback,
@@ -223,4 +236,8 @@ export class Client<
223236
onprogress,
224237
);
225238
}
239+
240+
async sendRootsListChanged() {
241+
return this.notification({ method: "notifications/roots/list_changed" });
242+
}
226243
}

src/server/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import {
2323
EmptyResultSchema,
2424
LoggingMessageNotification,
2525
ResourceUpdatedNotification,
26+
ListRootsRequest,
27+
ListRootsResultSchema,
2628
} from "../types.js";
2729

2830
/**
@@ -154,6 +156,17 @@ export class Server<
154156
);
155157
}
156158

159+
async listRoots(
160+
params?: ListRootsRequest["params"],
161+
onprogress?: ProgressCallback,
162+
) {
163+
return this.request(
164+
{ method: "roots/list", params },
165+
ListRootsResultSchema,
166+
onprogress,
167+
);
168+
}
169+
157170
async sendLoggingMessage(params: LoggingMessageNotification["params"]) {
158171
return this.notification({ method: "notifications/message", params });
159172
}

0 commit comments

Comments
 (0)